vaultmanager/modules/VaultManagerKV.py
def kv_copy_path(self, vault_addr, vault_token, vault_target_addr,
                     vault_target_token, copy_from, copy_to):
        """
        Method running the copy_path 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 path
        :type copy_from: str
        :param copy_to: Target path
        :type copy_to: str

        :return: bool
        """
        self.logger.debug("KV copy path 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)
        exported_kv = self.read_from_vault(copy_from, vault_source_client)
        if not len(exported_kv):
            raise AttributeError("No path to copy")
        if len(exported_kv) == 1 and list(exported_kv.keys())[0] == copy_from:
            raise AttributeError(
                "--copy-path should not be used to copy individual secrets."
                " Use --copy-secret instead"
            )
        vault_target_client = self.connect_to_vault(
            vault_target_addr, vault_target_token
        )
        try:
            self.push_to_vault(
                copy_from, exported_kv, copy_to, vault_target_client
            )
        except ValueError as e:
            self.logger.error("Failed to copy path '%s' to '%s'" %
                              (copy_from, copy_to))
            self.logger.error(e)
            return False
        self.logger.info("Path successfully copied")
        return True

        Method running the copy_path 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 path
        :type copy_from: str
        :param copy_to: Target path
        :type copy_to: str

        :return: bool
        
Method running the copy_path function of KV module
Method running the copy_path function of KV module
def kv_copy_path(self, vault_addr, vault_token, vault_target_addr,
                     vault_target_token, copy_from, copy_to):
        self.logger.debug("KV copy path 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)
        exported_kv = self.read_from_vault(copy_from, vault_source_client)
        if not len(exported_kv):
            raise AttributeError("No path to copy")
        if len(exported_kv) == 1 and list(exported_kv.keys())[0] == copy_from:
            raise AttributeError(
                "--copy-path should not be used to copy individual secrets."
                " Use --copy-secret instead"
            )
        vault_target_client = self.connect_to_vault(
            vault_target_addr, vault_target_token
        )
        try:
            self.push_to_vault(
                copy_from, exported_kv, copy_to, vault_target_client
            )
        except ValueError as e:
            self.logger.error("Failed to copy path '%s' to '%s'" %
                              (copy_from, copy_to))
            self.logger.error(e)
            return False
        self.logger.info("Path successfully copied")
        return True
def kv_copy_path ( self , vault_addr , vault_token , vault_target_addr , vault_target_token , copy_from , copy_to ) : self . logger . debug ( "KV copy path 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 ) exported_kv = self . read_from_vault ( copy_from , vault_source_client ) if not len ( exported_kv ) : raise AttributeError ( "No path to copy" ) if len ( exported_kv ) == 1 and list ( exported_kv . keys ( ) ) [ 0 ] == copy_from : raise AttributeError ( "--copy-path should not be used to copy individual secrets." " Use --copy-secret instead" ) vault_target_client = self . connect_to_vault ( vault_target_addr , vault_target_token ) try : self . push_to_vault ( copy_from , exported_kv , copy_to , vault_target_client ) except ValueError as e : self . logger . error ( "Failed to copy path '%s' to '%s'" % ( copy_from , copy_to ) ) self . logger . error ( e ) return False self . logger . info ( "Path successfully copied" ) return True
Method running the copy_path function of KV module
Method running the copy_path function of KV module
"""
        Method running the copy_path 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 path
        :type copy_from: str
        :param copy_to: Target path
        :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