Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

Commit 24e1a61

Browse files
giusepperh-atomic-bot
authored andcommitted
pull: support src-creds option
Signed-off-by: Giuseppe Scrivano <[email protected]> Closes: #1120 Approved by: ashcrow
1 parent 0435127 commit 24e1a61

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

Atomic/pull.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def cli(subparser):
1919
help=_("Specify the storage. Default is currently '%s'. You can"
2020
" change the default by editing /etc/atomic.conf and changing"
2121
" the 'default_storage' field." % _storage))
22+
pullp.add_argument("--src-creds", dest="src_creds", default=None,
23+
help=_("Use USERNAME[:PASSWORD] for accessing the source registry."))
2224
pullp.add_argument("-t", "--type", dest="reg_type", default=None,
2325
help=_("Pull from an alternative registry type."))
2426
pullp.add_argument("image", help=_("image id"))
@@ -40,6 +42,10 @@ def pull_image(self):
4042
if self.args.debug:
4143
write_out(str(self.args))
4244

45+
src_creds = getattr(self.args, 'src_creds', None)
46+
if src_creds == "":
47+
src_creds = None
48+
4349
be_utils = BackendUtils()
4450
be = be_utils.get_backend_from_string(storage)
4551
self.args.policy_filename = self.policy_filename
@@ -53,7 +59,7 @@ def pull_image(self):
5359
remote_image_obj = be.make_remote_image(self.args.image)
5460
else:
5561
remote_image_obj = None
56-
be.pull_image(self.args.image, remote_image_obj, debug=self.args.debug, assumeyes=self.args.assumeyes)
62+
be.pull_image(self.args.image, remote_image_obj, debug=self.args.debug, assumeyes=self.args.assumeyes, src_creds=src_creds)
5763
except ValueError as e:
5864
raise ValueError("Failed: {}".format(e))
5965
return 0

bash/atomic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ _atomic_images_version() {
390390
_atomic_pull() {
391391
local options_with_args="
392392
-t --type
393+
--src-creds
393394
--storage
394395
"
395396
local all_options="$options_with_args

docs/atomic-pull.1.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ pulling from an atomic registry could be:
7878
**-h** **--help**
7979
Print usage statement
8080

81+
**--src-creds=USERNAME[:PASSWORD]**
82+
Define the credentials to use with the source registry.
83+
8184
**--storage=[ostree|docker]**
8285
Define the destination storage for the pulled image.
8386

0 commit comments

Comments
 (0)