diff --git a/salt/key.py b/salt/key.py index 1e0f97ed1b..9891bc6c39 100644 --- a/salt/key.py +++ b/salt/key.py @@ -33,6 +33,7 @@ class KeyCLI(object): self.acc = 'minions' self.pend = 'minions_pre' self.rej = 'minions_rejected' + self.den = 'minions_denied' else: self.key = RaetKey(opts) self.acc = 'accepted' @@ -64,6 +65,12 @@ class KeyCLI(object): 'key', self.opts ) + elif status.startswith('den'): + salt.output.display_output( + {'minions_denied': keys[self.den]}, + 'key', + self.opts + ) elif status.startswith('all'): self.list_all() @@ -430,7 +437,15 @@ class Key(object): minions_pre = os.path.join(self.opts['pki_dir'], 'minions_pre') minions_rejected = os.path.join(self.opts['pki_dir'], 'minions_rejected') - return minions_accepted, minions_pre, minions_rejected + + minions_denied = os.path.join(self.opts['pki_dir'], + 'minions_denied') + return ( + minions_accepted, + minions_pre, + minions_rejected, + minions_denied + ) def gen_keys(self): ''' @@ -516,7 +531,13 @@ class Key(object): cur_keys = self.list_keys() for status, keys in match_dict.items(): for key in salt.utils.isorted(keys): - for keydir in ('minions', 'minions_pre', 'minions_rejected'): + key_dirs = ( + 'minions', + 'minions_pre', + 'minions_rejected', + 'minions_denied' + ) + for keydir in key_dirs: if fnmatch.filter(cur_keys.get(keydir, []), key): ret.setdefault(keydir, []).append(key) return ret @@ -537,9 +558,9 @@ class Key(object): ''' Return a dict of managed keys and what the key status are ''' - acc, pre, rej = self._check_minions_directories() + acc, pre, rej, den = self._check_minions_directories() ret = {} - for dir_ in acc, pre, rej: + for dir_ in acc, pre, rej, den: ret[os.path.basename(dir_)] = [] for fn_ in salt.utils.isorted(os.listdir(dir_)): if os.path.isfile(os.path.join(dir_, fn_)):