vaultmanager/modules/VaultManagerKV.py
def kv_copy_secret(self, vault_addr, vault_token, vault_target_addr,
                       vault_target_token, copy_from, copy_to):
        """
        Method running the copy_secret function of KV module

        :param vault_addr: Vault source instance URL
        :type vault_addr: str
        :param vault_token: Vault source token
        :type vault_token: str
        :param vault_target_addr: Vault target instance URL
        :type vault_target_addr: str
        :param vault_target_token: Vault target token
        :type vault_target_token: str
        :param copy_from: Source secret
        :type copy_from: str
        :param copy_to: Target secret
        :type copy_to: str

        :return: bool
        """
        self.logger.debug("KV copy secret starting")
        self.logger.info("Copying %s from %s to %s on %s" %
                         (copy_from, vault_addr, copy_to, vault_target_addr))
        vault_source_client = self.connect_to_vault(vault_addr, vault_token)
        secret_to_copy = vault_source_client.read(copy_from)
        if not len(secret_to_copy):
            raise AttributeError("'%s' is not a valid secret. If you're trying "
                                 "to copy a path, use --copy-path instead" %
                                 copy_from)
        vault_target_client = self.connect_to_vault(
            vault_target_addr,
            vault_target_token
        )
        try:
            vault_target_client.write(copy_to, secret_to_copy, hide_all=True)
        except ValueError as e:
            self.logger.error("Failed to copy secret '%s' to '%s'" %
                              (copy_from, copy_to))
            self.logger.error(e)
            return False
        self.logger.info("Secret '%s' successfully copied to '%s'" %
                         (copy_from, copy_to))
        return True

        Method running the copy_secret function of KV module

        :param vault_addr: Vault source instance URL
        :type vault_addr: str
        :param vault_token: Vault source token
        :type vault_token: str
        :param vault_target_addr: Vault target instance URL
        :type vault_target_addr: str
        :param vault_target_token: Vault target token
        :type vault_target_token: str
        :param copy_from: Source secret
        :type copy_from: str
        :param copy_to: Target secret
        :type copy_to: str

        :return: bool
        
Method running the copy_secret function of KV module
Method running the copy_secret function of KV module
def kv_copy_secret(self, vault_addr, vault_token, vault_target_addr,
                       vault_target_token, copy_from, copy_to):
        self.logger.debug("KV copy secret starting")
        self.logger.info("Copying %s from %s to %s on %s" %
                         (copy_from, vault_addr, copy_to, vault_target_addr))
        vault_source_client = self.connect_to_vault(vault_addr, vault_token)
        secret_to_copy = vault_source_client.read(copy_from)
        if not len(secret_to_copy):
            raise AttributeError("'%s' is not a valid secret. If you're trying "
                                 "to copy a path, use --copy-path instead" %
                                 copy_from)
        vault_target_client = self.connect_to_vault(
            vault_target_addr,
            vault_target_token
        )
        try:
            vault_target_client.write(copy_to, secret_to_copy, hide_all=True)
        except ValueError as e:
            self.logger.error("Failed to copy secret '%s' to '%s'" %
                              (copy_from, copy_to))
            self.logger.error(e)
            return False
        self.logger.info("Secret '%s' successfully copied to '%s'" %
                         (copy_from, copy_to))
        return True
def kv_copy_secret ( self , vault_addr , vault_token , vault_target_addr , vault_target_token , copy_from , copy_to ) : self . logger . debug ( "KV copy secret starting" ) self . logger . info ( "Copying %s from %s to %s on %s" % ( copy_from , vault_addr , copy_to , vault_target_addr ) ) vault_source_client = self . connect_to_vault ( vault_addr , vault_token ) secret_to_copy = vault_source_client . read ( copy_from ) if not len ( secret_to_copy ) : raise AttributeError ( "'%s' is not a valid secret. If you're trying " "to copy a path, use --copy-path instead" % copy_from ) vault_target_client = self . connect_to_vault ( vault_target_addr , vault_target_token ) try : vault_target_client . write ( copy_to , secret_to_copy , hide_all = True ) except ValueError as e : self . logger . error ( "Failed to copy secret '%s' to '%s'" % ( copy_from , copy_to ) ) self . logger . error ( e ) return False self . logger . info ( "Secret '%s' successfully copied to '%s'" % ( copy_from , copy_to ) ) return True
Method running the copy_secret function of KV module
Method running the copy_secret function of KV module
"""
        Method running the copy_secret function of KV module

        :param vault_addr: Vault source instance URL
        :type vault_addr: str
        :param vault_token: Vault source token
        :type vault_token: str
        :param vault_target_addr: Vault target instance URL
        :type vault_target_addr: str
        :param vault_target_token: Vault target token
        :type vault_target_token: str
        :param copy_from: Source secret
        :type copy_from: str
        :param copy_to: Target secret
        :type copy_to: str

        :return: bool
        """
None
self
vault_addr
Vault source instance URL
Vault source instance URL
vault_token
Vault source token
Vault source token
vault_target_addr
Vault target instance URL
Vault target instance URL
vault_target_token
Vault target token
Vault target token
copy_from
None
copy_to
None