def test_rmtree_no_errors_if_file_does_not_exist(
            self, rm_mock, exists_mock):

        path = '/some/file/path'
        utils.rmtree(path)

        self.method_was_not_called(rm_mock)
        exists_mock.assert_called_once_with(path)
示例#2
0
    def test_rmtree_no_errors_if_file_does_not_exist(self, rm_mock,
                                                     exists_mock):

        path = '/some/file/path'
        utils.rmtree(path)

        self.method_was_not_called(rm_mock)
        exists_mock.assert_called_once_with(path)
示例#3
0
    def save_cobbler_configs(self):
        """Copy config files from container
        """
        container_name = self.make_container_name('cobbler', self.from_version)

        try:
            utils.exec_cmd('docker cp {0}:{1} {2}'.format(
                container_name, self.config.cobbler_container_config_path,
                self.cobbler_config_path))
        except errors.ExecutedErrorNonZeroExitCode:
            utils.rmtree(self.cobbler_config_path)
            raise

        self.verify_cobbler_configs()
示例#4
0
 def save_astute_keys(self):
     """Copy any astute generated keys."""
     container_name = self.make_container_name('astute', self.from_version)
     try:
         utils.exec_cmd('docker cp {0}:{1} {2}'.format(
             container_name, self.config.astute_container_keys_path,
             self.config.working_directory))
     except errors.ExecutedErrorNonZeroExitCode:
         # we need to create default directory because in
         # after_container_creation_command will use it
         # but we want to remove keys
         if os.path.exists(self.config.astute_keys_path):
             utils.rmtree(self.config.astute_keys_path)
             raise
         os.mkdir(self.config.astute_keys_path)
示例#5
0
    def save_cobbler_configs(self):
        """Copy config files from container
        """
        container_name = self.make_container_name(
            'cobbler', self.from_version)

        try:
            utils.exec_cmd('docker cp {0}:{1} {2}'.format(
                container_name,
                self.config.cobbler_container_config_path,
                self.cobbler_config_path))
        except errors.ExecutedErrorNonZeroExitCode:
            utils.rmtree(self.cobbler_config_path)
            raise

        self.verify_cobbler_configs()
 def test_rmtree(self, rm_mock, exists_mock):
     path = '/some/file/path'
     utils.rmtree(path)
     rm_mock.assert_called_once_with(path, ignore_errors=True)
     exists_mock.assert_called_once_with(path)
示例#7
0
 def test_rmtree(self, rm_mock, exists_mock):
     path = '/some/file/path'
     utils.rmtree(path)
     rm_mock.assert_called_once_with(path, ignore_errors=True)
     exists_mock.assert_called_once_with(path)