##################################
-@infer_image
+@default_image
def command_pull(ctx):
# type: (CephadmContext) -> int
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',
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',
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',
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: