Esempio n. 1
0
class KeyManager:
    def __init__(self):
        self.opts = salt.config.master_config('/etc/salt/master')
        self.mykeymgr = Key(self.opts)

    def get_minion_keys(self, status=None):
        '''Return a list of minion keys matching status type'''
        #  Key.list_status(status)  where status type = accepted, pre, rejected, all
        #  or, use Key.list_keys(self)  --> dict of minions_rejected, minions_pre, minions
        if status not in ['pre', 'accepted', 'rejected']:
            result = None
        else:
            try:
                r_dict = self.mykeymgr.list_status(status)
                k = r_dict.keys()
                result = r_dict.get(k[0], None)
            except Exception, e:
                raise
        return result
Esempio n. 2
0
class KeyManager:
    def __init__(self):
        self.opts = salt.config.master_config("/etc/salt/master")
        self.mykeymgr = Key(self.opts)

    def get_minion_keys(self, status=None):
        """Return a list of minion keys matching status type"""
        #  Key.list_status(status)  where status type = accepted, pre, rejected, all
        #  or, use Key.list_keys(self)  --> dict of minions_rejected, minions_pre, minions
        if status not in ["pre", "accepted", "rejected"]:
            result = None
        else:
            try:
                r_dict = self.mykeymgr.list_status(status)
                k = r_dict.keys()
                result = r_dict.get(k[0], None)
            except Exception, e:
                raise
        return result