예제 #1
0
 def setUp(self):
     super(TestSaveImages, self).setUp()
     self.working_dir = tempfile.mkdtemp()
     self.dest_dir = tempfile.mkdtemp()
     self.step = v1_sync.SaveImages(self.working_dir)
     self.step.repo = RepositoryModel('repo1')
     self.step.conduit = mock.MagicMock()
     self.step.parent = mock.MagicMock()
     self.step.parent.step_get_local_units.units_to_download = [{
         'image_id':
         'abc123'
     }]
     self.item = Image(image_id='abc123')
예제 #2
0
    def setUp(self):
        super(TestSaveImages, self).setUp()
        self.working_dir = tempfile.mkdtemp()
        self.dest_dir = tempfile.mkdtemp()
        self.step = v1_sync.SaveImages(self.working_dir)
        self.step.repo = RepositoryModel('repo1')
        self.step.conduit = mock.MagicMock()
        self.step.parent = mock.MagicMock()
        self.step.parent.step_get_local_units.units_to_download = [{
            'image_id':
            'abc123'
        }]

        self.unit = Unit(constants.IMAGE_TYPE_ID, {'image_id': 'abc123'}, {
            'parent': None,
            'size': 2
        }, os.path.join(self.dest_dir, 'abc123'))
예제 #3
0
    def add_v1_steps(self, repo, config):
        """
        Add v1 sync steps.

        :param repo:        repository to sync
        :type  repo:        pulp.plugins.model.Repository
        :param config:      config object for the sync
        :type  config:      pulp.plugins.config.PluginCallConfiguration
        """
        self.add_child(v1_sync.GetMetadataStep())
        # save this step so its "units_to_download" attribute can be accessed later
        self.v1_step_get_local_units = publish_step.GetLocalUnitsStep(
            constants.IMPORTER_TYPE_ID, available_units=self.v1_available_units)
        self.v1_step_get_local_units.step_id = constants.SYNC_STEP_GET_LOCAL_V1
        self.add_child(self.v1_step_get_local_units)
        self.add_child(publish_step.DownloadStep(
            constants.SYNC_STEP_DOWNLOAD_V1, downloads=self.v1_generate_download_requests(),
            repo=repo, config=config, description=_('Downloading remote files')))
        self.add_child(v1_sync.SaveImages())