Example #1
0
class GpgKeyAction(BaseAction):

    def __init__(self):
        super(GpgKeyAction, self).__init__()
        self.api = GpgKeyAPI()

    def read_content(self, use_prompt):
        gpgkey_file = self.get_option('file')

        if gpgkey_file:
            with open(get_abs_path(gpgkey_file), "r") as f:
                content = f.read()
        elif use_prompt:
            print _("Enter content of the GPG key (finish input with CTRL+D):")
            content = stdin.read()
        else:
            content = None
        return content

    def get_key_id(self, orgName, keyName):
        keys = self.api.gpg_keys_by_organization(orgName, keyName)
        if len(keys) == 0:
            return
        else:
            return keys[0]["id"]
Example #2
0
class GpgKeyAction(BaseAction):

    def __init__(self):
        super(GpgKeyAction, self).__init__()
        self.api = GpgKeyAPI()

    def read_content(self, use_prompt):
        file = self.get_option('file')

        if file:
            with open(get_abs_path(file), "r") as f:
                content = f.read()
        elif use_prompt:
            print _("Enter content of the GPG key (finish input with CTRL+D):")
            content = stdin.read()
        else:
            content = None
        return content

    def get_key_id(self):
        orgName = self.get_option('org')
        keyName = self.get_option('name')

        keys = self.api.gpg_keys_by_organization(orgName, keyName)
        if len(keys) == 0:
            return
        else:
            return keys[0]["id"]
Example #3
0
 def __init__(self):
     super(GpgKeyAction, self).__init__()
     self.api = GpgKeyAPI()
Example #4
0
 def __init__(self):
     super(GpgKeyAction, self).__init__()
     self.api = GpgKeyAPI()