mirror of
https://github.com/ceph/ceph
synced 2025-01-01 00:22:25 +00:00
Merge pull request #45420 from mgfritch/cephadm-infer-image-pull
cephadm: infer the default container image during pull Reviewed-by: Adam King <adking@redhat.com> Reviewed-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
commit
9671f179be
@ -4228,7 +4228,7 @@ def command_version(ctx):
|
||||
##################################
|
||||
|
||||
|
||||
@infer_image
|
||||
@default_image
|
||||
def command_pull(ctx):
|
||||
# type: (CephadmContext) -> int
|
||||
|
||||
@ -8040,7 +8040,7 @@ def _get_parser():
|
||||
parser_version.set_defaults(func=command_version)
|
||||
|
||||
parser_pull = subparsers.add_parser(
|
||||
'pull', help='pull latest image version')
|
||||
'pull', help='pull the default container image')
|
||||
parser_pull.set_defaults(func=command_pull)
|
||||
parser_pull.add_argument(
|
||||
'--insecure',
|
||||
@ -8097,7 +8097,7 @@ def _get_parser():
|
||||
parser_adopt.add_argument(
|
||||
'--skip-pull',
|
||||
action='store_true',
|
||||
help='do not pull the latest image before adopting')
|
||||
help='do not pull the default image before adopting')
|
||||
parser_adopt.add_argument(
|
||||
'--force-start',
|
||||
action='store_true',
|
||||
@ -8386,7 +8386,7 @@ def _get_parser():
|
||||
parser_bootstrap.add_argument(
|
||||
'--skip-pull',
|
||||
action='store_true',
|
||||
help='do not pull the latest image before bootstrapping')
|
||||
help='do not pull the default image before bootstrapping')
|
||||
parser_bootstrap.add_argument(
|
||||
'--skip-firewalld',
|
||||
action='store_true',
|
||||
|
@ -1680,6 +1680,29 @@ class TestPull:
|
||||
cd.command_pull(ctx)
|
||||
assert err in str(e.value)
|
||||
|
||||
@mock.patch('cephadm.logger')
|
||||
@mock.patch('cephadm.get_image_info_from_inspect', return_value={})
|
||||
@mock.patch('cephadm.get_last_local_ceph_image', return_value='last_local_ceph_image')
|
||||
def test_image(self, get_last_local_ceph_image, get_image_info_from_inspect, logger):
|
||||
cmd = ['pull']
|
||||
with with_cephadm_ctx(cmd) as ctx:
|
||||
retval = cd.command_pull(ctx)
|
||||
assert retval == 0
|
||||
assert ctx.image == cd.DEFAULT_IMAGE
|
||||
|
||||
with mock.patch.dict(os.environ, {"CEPHADM_IMAGE": 'cephadm_image_environ'}):
|
||||
cmd = ['pull']
|
||||
with with_cephadm_ctx(cmd) as ctx:
|
||||
retval = cd.command_pull(ctx)
|
||||
assert retval == 0
|
||||
assert ctx.image == 'cephadm_image_environ'
|
||||
|
||||
cmd = ['--image', 'cephadm_image_param', 'pull']
|
||||
with with_cephadm_ctx(cmd) as ctx:
|
||||
retval = cd.command_pull(ctx)
|
||||
assert retval == 0
|
||||
assert ctx.image == 'cephadm_image_param'
|
||||
|
||||
|
||||
class TestApplySpec:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user