diff --git a/bin/dock-pulp.py b/bin/dock-pulp.py index b6e7559..1885e3d 100755 --- a/bin/dock-pulp.py +++ b/bin/dock-pulp.py @@ -553,7 +553,10 @@ def do_copy(bopts, bargs): parser.error('You must provide a destination repository and image-id') p = pulp_login(bopts) for img in args[1:]: - p.copy(args[0], img, opts.source) + if opts.source: + p.copy(args[0], img, opts.source) + else: + p.copy(args[0], img) log.info('copying successful') def do_create(bopts, bargs): @@ -860,22 +863,10 @@ def do_sync(bopts, bargs): env = args[0] repo = args[1] - repoinfo = p.syncRepo(env, repo, bopts.config_file) - repoinfo = repoinfo[0] - - if len(repoinfo['images'].keys()) == 0: - oldimgs = [] - else: - oldimgs = repoinfo['images'].keys() - - repoinfo = p.listRepos(repo, True) - repoinfo = repoinfo[0] - newimgs = repoinfo['images'].keys() - imgs = list(set(newimgs) - set(oldimgs)) - imgs.sort() + imgs, manifests = p.syncRepo(env, repo, bopts.config_file) - log.info(repoinfo['id']) - log.info('-' * len(repoinfo['id'])) + log.info(repo) + log.info('-' * len(repo)) log.info('synced images:') if len(imgs) == 0: @@ -883,9 +874,14 @@ def do_sync(bopts, bargs): else: for img in imgs: log.info(img) - for img in imgs: - p.copy('redhat-everything', img, repo) - log.info('') + log.info('') + + if len(manifests) == 0: + log.info(' No new manifests') + else: + for manifest in manifests: + log.info(manifest) + log.info('') def do_tag(bopts, bargs): """ diff --git a/dockpulp/__init__.py b/dockpulp/__init__.py index 0960702..8b9d13a 100644 --- a/dockpulp/__init__.py +++ b/dockpulp/__init__.py @@ -893,7 +893,8 @@ def syncRepo(self, env=None, repo=None, config_file=DEFAULT_CONFIG_FILE, 'feed': feed, 'upstream_name': upstream_name, 'basic_auth_username': basic_auth_username, - 'basic_auth_password': basic_auth_password + 'basic_auth_password': basic_auth_password, + 'enabled_v1': True } } else: @@ -902,6 +903,7 @@ def syncRepo(self, env=None, repo=None, config_file=DEFAULT_CONFIG_FILE, 'ssl_validation': ssl_validation, 'feed': feed, 'upstream_name': upstream_name, + 'enabled_v1': True } } @@ -911,7 +913,36 @@ def syncRepo(self, env=None, repo=None, config_file=DEFAULT_CONFIG_FILE, data=json.dumps(data)) self.watch(tid) - return repoinfo + # Need to maintain HIDDEN + repoinfo = repoinfo[0] + + if len(repoinfo['images'].keys()) == 0: + oldimgs = [] + else: + oldimgs = repoinfo['images'].keys() + + if len(repoinfo['manifests'].keys()) == 0: + oldmanifests = [] + else: + oldmanifests = repoinfo['manifests'].keys() + + repoinfo = self.listRepos(repo, True) + repoinfo = repoinfo[0] + + newimgs = repoinfo['images'].keys() + imgs = list(set(newimgs) - set(oldimgs)) + imgs.sort() + + newmanifests = repoinfo['manifests'].keys() + manifests = list(set(newmanifests) - set(oldmanifests)) + manifests.sort() + + for img in imgs: + self.copy(HIDDEN, img, repo) + for manifest in manifests: + self.copy(HIDDEN, manifest, repo) + + return (imgs, manifests) def updateRepo(self, rid, update): """