diff --git a/salt/client.py b/salt/client.py index 1652eed197..760112997d 100644 --- a/salt/client.py +++ b/salt/client.py @@ -82,14 +82,16 @@ class LocalClient(object): ''' Read in the rotating master authentication key ''' + keyfile = os.path.join(self.opts['cachedir'], '.root_key') + # Make sure all key parent directories are accessible + user = self.opts.get('user', 'root') + salt.utils.verify.check_parent_dirs(keyfile, user) + try: - keyfile = os.path.join(self.opts['cachedir'], '.root_key') - # Make sure all key parent directories are accessible - user = self.opts.get('user', 'root') - salt.utils.verify.check_parent_dirs(keyfile, user) with open(keyfile, 'r') as KEY: return KEY.read() except (OSError, IOError): + # In theory, this should never get hit. Belt & suspenders baby! raise SaltClientError(('Problem reading the salt root key. Are' ' you root?'))