diff --git a/app-openbis-command-line/src/python/obis/dm/commands/clone.py b/app-openbis-command-line/src/python/obis/dm/commands/clone.py index 3686533a6e64d0c570879c0d463d579221289bd3..60f7d0ed1b29c922f9da9a6fb9957a5e4ed3f195 100644 --- a/app-openbis-command-line/src/python/obis/dm/commands/clone.py +++ b/app-openbis-command-line/src/python/obis/dm/commands/clone.py @@ -13,14 +13,12 @@ # limitations under the License. # import os -import pybis + from .openbis_command import OpenbisCommand, ContentCopySelector from ..checksum import validate_checksum from ..command_result import CommandResult, CommandException -from ..utils import cd -from ..utils import run_shell -from ..utils import complete_openbis_config from ..repository_utils import copy_repository +from ..utils import cd from ... import dm @@ -40,7 +38,8 @@ class Clone(OpenbisCommand): :param skip_integrity_check: Checksums are not validated if True """ if dm.data_path != dm.metadata_path: - raise CommandException(CommandResult(returncode=-1, output='Clone/move not supported with obis_metadata_folder.')) + raise CommandException(CommandResult(returncode=-1, + output='Clone/move not supported with obis_metadata_folder.')) self.data_set_id = data_set_id self.ssh_user = ssh_user self.content_copy_index = content_copy_index @@ -48,7 +47,6 @@ class Clone(OpenbisCommand): self.load_global_config(dm) super(Clone, self).__init__(dm) - def check_configuration(self): missing_config_settings = [] if self.openbis is None: @@ -57,10 +55,10 @@ class Clone(OpenbisCommand): missing_config_settings.append('user') if len(missing_config_settings) > 0: return CommandResult(returncode=-1, - output="Missing configuration settings for {}.".format(missing_config_settings)) + output="Missing configuration settings for {}.".format( + missing_config_settings)) return CommandResult(returncode=0, output="") - def run(self): result = self.prepare_run() @@ -84,12 +82,14 @@ class Clone(OpenbisCommand): data_set = self.openbis.get_dataset(self.data_set_id) if self.skip_integrity_check != True: data_path = os.path.join(self.data_mgmt.data_path, repository_folder) - invalid_files = validate_checksum(self.openbis, data_set.file_list, data_set.permId, data_path, self.data_mgmt.metadata_path) + invalid_files = validate_checksum(self.openbis, data_set.file_list, data_set.permId, + data_path, self.data_mgmt.metadata_path) if len(invalid_files) > 0: - raise CommandException(CommandResult(returncode=-1, output="Invalid checksum for files {}.".format(str(invalid_files)))) + raise CommandException(CommandResult(returncode=-1, + output="Invalid checksum for files {}.".format( + str(invalid_files)))) return self.add_content_copy_to_openbis(repository_folder) - def checkout_commit(self, content_copy, path): """ Checks out the commit of the content copy from which the clone was made @@ -100,17 +100,17 @@ class Clone(OpenbisCommand): repository_folder = path.split('/')[-1] return self.git_wrapper.git_checkout(commit_hash, relative_repo_path=repository_folder) - def add_content_copy_to_openbis(self, repository_folder): with cd(repository_folder): data_path = os.path.join(self.data_mgmt.data_path, repository_folder) metadata_path = os.path.join(self.data_mgmt.metadata_path, repository_folder) invocation_path = self.data_mgmt.invocation_path data_mgmt = dm.DataMgmt(openbis_config={}, git_config={ - 'find_git': True, - 'data_path': data_path, - 'metadata_path': metadata_path, - 'invocation_path': invocation_path - }) - data_mgmt.set_property(data_mgmt.settings_resolver.config, 'hostname', None, False) + 'find_git': True, + 'data_path': data_path, + 'metadata_path': metadata_path, + 'invocation_path': invocation_path + }) + data_mgmt.set_property(data_mgmt.debug, data_mgmt.settings_resolver.config, 'hostname', + None, False) return data_mgmt.addref()