Exemple #1
0
    def fetch(self, vault_client, backends):
        """Updates local resource with context on whether this
        backend is actually mounted and available"""
        if not is_mounted(self.backend, self.path, backends) or \
           self.tune_prefix is None:
            return

        backend_details = get_backend(self.backend, self.path, backends)
        self.existing = backend_details['config']
        if backend_details['description']:
            self.existing['description'] = backend_details['description']

        if vault_client.version is None:
            return

        if not self.managed:
            return

        a_prefix = self.tune_prefix
        if self.tune_prefix:
            a_prefix = "%s/" % self.tune_prefix

        v_path = "sys/mounts/%s%s/tune" % (a_prefix, self.path)
        t_resp = vault_client.read(v_path)
        if 'data' not in t_resp:
            e_msg = "Unable to retrieve tuning info for %s" % self
            raise aomi_excep.VaultData(e_msg)

        e_obj = t_resp['data']
        e_obj['description'] = None
        n_path = normalize_vault_path(self.path)
        if n_path in backends:
            a_mount = backends[n_path]
            if 'description' in a_mount and a_mount['description']:
                e_obj['description'] = a_mount['description']

        self.existing = e_obj
Exemple #2
0
    def fetch(self, vault_client, backends):
        """Updates local resource with context on whether this
        backend is actually mounted and available"""
        if not is_mounted(self.backend, self.path, backends) or \
           self.tune_prefix is None:
            return

        backend_details = get_backend(self.backend, self.path, backends)
        self.existing = backend_details['config']
        if backend_details['description']:
            self.existing['description'] = backend_details['description']

        if vault_client.version is None:
            return

        if not self.managed:
            return

        a_prefix = self.tune_prefix
        if self.tune_prefix:
            a_prefix = "%s/" % self.tune_prefix

        v_path = "sys/mounts/%s%s/tune" % (a_prefix, self.path)
        t_resp = vault_client.read(v_path)
        if 'data' not in t_resp:
            e_msg = "Unable to retrieve tuning info for %s" % self
            raise aomi_excep.VaultData(e_msg)

        e_obj = t_resp['data']
        e_obj['description'] = None
        n_path = normalize_vault_path(self.path)
        if n_path in backends:
            a_mount = backends[n_path]
            if 'description' in a_mount and a_mount['description']:
                e_obj['description'] = a_mount['description']

        self.existing = e_obj
Exemple #3
0
 def fetch(self, vault_client):
     if is_mounted(self.backend, self.mount,
                   vault_client.list_secret_backends()):
         self.existing = True
Exemple #4
0
 def fetch(self, backends):
     """Updates local resource with context on whether this
     backend is actually mounted and available"""
     self.existing = is_mounted(self.backend, self.path, backends)
Exemple #5
0
 def fetch(self, vault_client):
     if is_mounted(self.backend,
                   self.mount,
                   vault_client.list_secret_backends()):
         self.existing = True