Merge "Fix default image registry address lookup"
This commit is contained in:
commit
72bb7fbaa9
@ -145,7 +145,7 @@ class TestContainerImagePush(TestPluginV1):
|
|||||||
mock_task.assert_called_once_with(
|
mock_task.assert_called_once_with(
|
||||||
image_name='namespace/foo',
|
image_name='namespace/foo',
|
||||||
pull_source='docker.io',
|
pull_source='docker.io',
|
||||||
push_destination=parsed_args.registry_url,
|
push_destination='uc.ctlplane.somedomain',
|
||||||
append_tag=parsed_args.append_tag,
|
append_tag=parsed_args.append_tag,
|
||||||
modify_role=None,
|
modify_role=None,
|
||||||
modify_vars=None,
|
modify_vars=None,
|
||||||
@ -198,7 +198,7 @@ class TestContainerImagePush(TestPluginV1):
|
|||||||
mock_task.assert_called_once_with(
|
mock_task.assert_called_once_with(
|
||||||
image_name='containers-storage:docker.io/namespace/foo',
|
image_name='containers-storage:docker.io/namespace/foo',
|
||||||
pull_source=None,
|
pull_source=None,
|
||||||
push_destination=parsed_args.registry_url,
|
push_destination='uc.ctlplane.somedomain',
|
||||||
append_tag=parsed_args.append_tag,
|
append_tag=parsed_args.append_tag,
|
||||||
modify_role=None,
|
modify_role=None,
|
||||||
modify_vars=None,
|
modify_vars=None,
|
||||||
@ -251,7 +251,7 @@ class TestContainerImagePush(TestPluginV1):
|
|||||||
mock_task.assert_called_once_with(
|
mock_task.assert_called_once_with(
|
||||||
image_name='containers-storage:docker.io/namespace/foo',
|
image_name='containers-storage:docker.io/namespace/foo',
|
||||||
pull_source=None,
|
pull_source=None,
|
||||||
push_destination=parsed_args.registry_url,
|
push_destination='uc.ctlplane.somedomain',
|
||||||
append_tag=parsed_args.append_tag,
|
append_tag=parsed_args.append_tag,
|
||||||
modify_role=None,
|
modify_role=None,
|
||||||
modify_vars=None,
|
modify_vars=None,
|
||||||
@ -370,7 +370,7 @@ class TestContainerImagePush(TestPluginV1):
|
|||||||
mock_task.assert_called_once_with(
|
mock_task.assert_called_once_with(
|
||||||
image_name='namespace/foo:tag',
|
image_name='namespace/foo:tag',
|
||||||
pull_source='docker.io',
|
pull_source='docker.io',
|
||||||
push_destination=parsed_args.registry_url,
|
push_destination='127.0.0.1:8787',
|
||||||
append_tag=parsed_args.append_tag,
|
append_tag=parsed_args.append_tag,
|
||||||
modify_role=None,
|
modify_role=None,
|
||||||
modify_vars=None,
|
modify_vars=None,
|
||||||
|
@ -558,7 +558,7 @@ class TripleOContainerImagePush(command.Command):
|
|||||||
"--registry-url",
|
"--registry-url",
|
||||||
dest="registry_url",
|
dest="registry_url",
|
||||||
metavar='<registry url>',
|
metavar='<registry url>',
|
||||||
default=image_uploader.get_undercloud_registry(),
|
default=None,
|
||||||
help=_("URL of the destination registry in the form "
|
help=_("URL of the destination registry in the form "
|
||||||
"<fqdn>:<port>.")
|
"<fqdn>:<port>.")
|
||||||
)
|
)
|
||||||
@ -669,9 +669,13 @@ class TripleOContainerImagePush(command.Command):
|
|||||||
parsed_args.source_username,
|
parsed_args.source_username,
|
||||||
parsed_args.source_password)
|
parsed_args.source_password)
|
||||||
|
|
||||||
registry_url = parsed_args.registry_url
|
registry_url_arg = parsed_args.registry_url
|
||||||
if not registry_url.startswith('docker://'):
|
if registry_url_arg is None:
|
||||||
registry_url = 'docker://%s' % registry_url
|
registry_url_arg = image_uploader.get_undercloud_registry()
|
||||||
|
if not registry_url_arg.startswith('docker://'):
|
||||||
|
registry_url = 'docker://%s' % registry_url_arg
|
||||||
|
else:
|
||||||
|
registry_url = registry_url_arg
|
||||||
reg_url = parse.urlparse(registry_url)
|
reg_url = parse.urlparse(registry_url)
|
||||||
|
|
||||||
uploader.authenticate(reg_url,
|
uploader.authenticate(reg_url,
|
||||||
@ -681,7 +685,7 @@ class TripleOContainerImagePush(command.Command):
|
|||||||
task = image_uploader.UploadTask(
|
task = image_uploader.UploadTask(
|
||||||
image_name=image_name,
|
image_name=image_name,
|
||||||
pull_source=image_source,
|
pull_source=image_source,
|
||||||
push_destination=parsed_args.registry_url,
|
push_destination=registry_url_arg,
|
||||||
append_tag=parsed_args.append_tag,
|
append_tag=parsed_args.append_tag,
|
||||||
modify_role=None,
|
modify_role=None,
|
||||||
modify_vars=None,
|
modify_vars=None,
|
||||||
@ -709,7 +713,7 @@ class TripleOContainerImageDelete(command.Command):
|
|||||||
"--registry-url",
|
"--registry-url",
|
||||||
dest="registry_url",
|
dest="registry_url",
|
||||||
metavar='<registry url>',
|
metavar='<registry url>',
|
||||||
default=image_uploader.get_undercloud_registry(),
|
default=None,
|
||||||
help=_("URL of registry images are to be listed from in the "
|
help=_("URL of registry images are to be listed from in the "
|
||||||
"form <fqdn>:<port>.")
|
"form <fqdn>:<port>.")
|
||||||
)
|
)
|
||||||
@ -752,7 +756,10 @@ class TripleOContainerImageDelete(command.Command):
|
|||||||
lock = processlock.ProcessLock()
|
lock = processlock.ProcessLock()
|
||||||
manager = image_uploader.ImageUploadManager(lock=lock)
|
manager = image_uploader.ImageUploadManager(lock=lock)
|
||||||
uploader = manager.uploader('python')
|
uploader = manager.uploader('python')
|
||||||
url = uploader._image_to_url(parsed_args.registry_url)
|
registry_url_arg = parsed_args.registry_url
|
||||||
|
if registry_url_arg is None:
|
||||||
|
registry_url_arg = image_uploader.get_undercloud_registry()
|
||||||
|
url = uploader._image_to_url(registry_url_arg)
|
||||||
session = uploader.authenticate(url, parsed_args.username,
|
session = uploader.authenticate(url, parsed_args.username,
|
||||||
parsed_args.password)
|
parsed_args.password)
|
||||||
|
|
||||||
@ -776,7 +783,7 @@ class TripleOContainerImageList(command.Lister):
|
|||||||
"--registry-url",
|
"--registry-url",
|
||||||
dest="registry_url",
|
dest="registry_url",
|
||||||
metavar='<registry url>',
|
metavar='<registry url>',
|
||||||
default=image_uploader.get_undercloud_registry(),
|
default=None,
|
||||||
help=_("URL of registry images are to be listed from in the "
|
help=_("URL of registry images are to be listed from in the "
|
||||||
"form <fqdn>:<port>.")
|
"form <fqdn>:<port>.")
|
||||||
)
|
)
|
||||||
@ -800,7 +807,10 @@ class TripleOContainerImageList(command.Lister):
|
|||||||
lock = processlock.ProcessLock()
|
lock = processlock.ProcessLock()
|
||||||
manager = image_uploader.ImageUploadManager(lock=lock)
|
manager = image_uploader.ImageUploadManager(lock=lock)
|
||||||
uploader = manager.uploader('python')
|
uploader = manager.uploader('python')
|
||||||
url = uploader._image_to_url(parsed_args.registry_url)
|
registry_url_arg = parsed_args.registry_url
|
||||||
|
if registry_url_arg is None:
|
||||||
|
registry_url_arg = image_uploader.get_undercloud_registry()
|
||||||
|
url = uploader._image_to_url(registry_url_arg)
|
||||||
session = uploader.authenticate(url, parsed_args.username,
|
session = uploader.authenticate(url, parsed_args.username,
|
||||||
parsed_args.password)
|
parsed_args.password)
|
||||||
results = uploader.list(url.geturl(), session=session)
|
results = uploader.list(url.geturl(), session=session)
|
||||||
|
Loading…
Reference in New Issue
Block a user