Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] make config switch select the config dir #38

Closed
mtgxx opened this issue Mar 31, 2011 · 7 comments
Closed

[PATCH] make config switch select the config dir #38

mtgxx opened this issue Mar 31, 2011 · 7 comments

Comments

@mtgxx
Copy link

mtgxx commented Mar 31, 2011

If I have correctly read the code salt-master not only reads the master config file but also the minion configuration. With the "config" option you can only choose another master configuration file. The following is just an idea and not very well tested.

 The patch changes the behavior of the "config" option. It points now
 to the config dir and assumes, that the config files are named "master"
 and "minion".

 Signed-off-by: Matthias Teege <matthias-git@mteege.de>
 ---
  salt/__init__.py |    8 ++++----
  salt/master.py   |    2 +-
  2 files changed, 5 insertions(+), 5 deletions(-)

 diff --git a/salt/__init__.py b/salt/__init__.py
 index 7572fc8..3ac2202 100644
 --- a/salt/__init__.py
 +++ b/salt/__init__.py
 @@ -25,7 +25,7 @@ class Master(object):
      '''
      def __init__(self):
          self.cli = self.__parse_cli()
 -        self.opts = salt.config.master_config(self.cli['config'])
 +        self.opts = salt.config.master_config(self.cli['config'] + '/master')

      def __parse_cli(self):
          '''
 @@ -41,7 +41,7 @@ class Master(object):
          parser.add_option('-c',
                  '--config',
                  dest='config',
 -                default='/etc/salt/master',
 +                default='/etc/salt',
                  help='Pass in an alternative configuration file')

          options, args = parser.parse_args()
 @@ -70,7 +70,7 @@ class Minion(object):
      '''
      def __init__(self):
          self.cli = self.__parse_cli()
 -        self.opts = salt.config.minion_config(self.cli['config'])
 +        self.opts = salt.config.minion_config(self.cli['config'] + '/minion')

      def __parse_cli(self):
          '''
 @@ -86,7 +86,7 @@ class Minion(object):
          parser.add_option('-c',
                  '--config',
                  dest='config',
 -                default='/etc/salt/minion',
 +                default='/etc/salt',
                  help='Pass in an alternative configuration file')

          options, args = parser.parse_args()
 diff --git a/salt/master.py b/salt/master.py
 index 01b4cc5..d6fe85e 100644
 --- a/salt/master.py
 +++ b/salt/master.py
 @@ -112,7 +112,7 @@ class ReqServer(threading.Thread):
          self.key = self.__prep_key()
          self.crypticle = salt.crypt.Crypticle(self.opts['aes'])
          # Make a client
 -        self.local = salt.client.LocalClient()
 +        self.local = salt.client.LocalClient(opts['conf_file'])

      def __prep_key(self):
          '''
 -- 
 1.7.3.4
@thatch45
Copy link
Contributor

hmm, I have the master reading the minion config? I am taking a closer look, as the master should not need to read the minion configuration.
I may have made a mistake with this while trying to set up "baron" support, or masters being minions to higher masters.
I will get back to you
Thanks Matthias.

@mtgxx
Copy link
Author

mtgxx commented Mar 31, 2011

Maybe it was a default value I stumbled over. I can't access my testmachine now. I'll check this issue tomorrow again. So don't waste your time. But the client.LocalClient call should contain the conf_file parameter.

@thatch45
Copy link
Contributor

Yes, I agree there, since the local client needs to read the master config, I will make sure that gets fixed.
Thanks!

@thatch45
Copy link
Contributor

Ok, I see it now, I am embarrassed!
I will get the local client paths fixed ASAP

@thatch45
Copy link
Contributor

thatch45@b5de9c9

Fixed the local client paths issue in the salt client.

I am still investigating the other configuration issue, but if we use a conf_dir instead we can consolidate the pki_dir option as well, so I am mulling it over

@thatch45
Copy link
Contributor

I am not finding any instance of the master loading the minion configuration file, please let me know where that is getting loaded (if it is getting loaded) so I can fix it.

@thatch45
Copy link
Contributor

This looks resolved

sbrennan4 pushed a commit to sbrennan4/salt that referenced this issue Sep 17, 2019
andzn added a commit to andzn/salt that referenced this issue Nov 15, 2021
Publish presence events when using TCP transport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants