expand config_dir and '~/.salt/Saltfile' as last resort

This commit is contained in:
Sergey Kacheev 2017-02-16 15:36:31 +07:00
parent 070904b719
commit 0f36e10e7d

View file

@ -377,6 +377,10 @@ class SaltfileMixIn(six.with_metaclass(MixInMeta, object)):
saltfile = ''
if os.path.isfile(saltfile):
self.options.saltfile = saltfile
else:
saltfile = os.path.join(os.path.expanduser("~"), '.salt', 'Saltfile')
if os.path.isfile(saltfile):
self.options.saltfile = saltfile
else:
saltfile = self.options.saltfile
@ -498,6 +502,7 @@ class ConfigDirMixIn(six.with_metaclass(MixInMeta, object)):
)
def process_config_dir(self):
self.options.config_dir = os.path.expanduser(self.options.config_dir)
if not os.path.isdir(self.options.config_dir):
# No logging is configured yet
sys.stderr.write(