make 'cache_image' singular
This commit is contained in:
parent
c821fd7129
commit
87bc982725
teeth_agent
@ -126,7 +126,7 @@ def _run_image():
|
||||
raise errors.SystemRebootError(exit_code)
|
||||
|
||||
|
||||
class CacheImagesCommand(base.AsyncCommandResult):
|
||||
class CacheImageCommand(base.AsyncCommandResult):
|
||||
def execute(self):
|
||||
# TODO(russellhaering): Actually cache images
|
||||
pass
|
||||
@ -155,7 +155,7 @@ class RunImageCommand(base.AsyncCommandResult):
|
||||
class StandbyMode(base.BaseAgentMode):
|
||||
def __init__(self):
|
||||
super(StandbyMode, self).__init__('STANDBY')
|
||||
self.command_map['cache_images'] = self.cache_images
|
||||
self.command_map['cache_image'] = self.cache_image
|
||||
self.command_map['prepare_image'] = self.prepare_image
|
||||
self.command_map['run_image'] = self.run_image
|
||||
|
||||
@ -174,15 +174,9 @@ class StandbyMode(base.BaseAgentMode):
|
||||
'Image \'hashes\' must be a dictionary with at least one '
|
||||
'element.')
|
||||
|
||||
def cache_images(self, command_name, image_infos):
|
||||
if type(image_infos) != list:
|
||||
raise errors.InvalidCommandParamsError(
|
||||
'\'image_infos\' parameter must be a list.')
|
||||
|
||||
for image_info in image_infos:
|
||||
self._validate_image_info(image_info)
|
||||
|
||||
return CacheImagesCommand(command_name, image_infos).start()
|
||||
def cache_image(self, command_name, image_info):
|
||||
self._validate_image_info(image_info)
|
||||
return CacheImageCommand(command_name, image_info).start()
|
||||
|
||||
def prepare_image(self, command_name, **command_params):
|
||||
self._validate_image_info(command_params['image_info'])
|
||||
|
@ -83,15 +83,15 @@ class TestStandbyMode(unittest.TestCase):
|
||||
self.agent_mode._validate_image_info,
|
||||
invalid_info)
|
||||
|
||||
def test_cache_images_success(self):
|
||||
result = self.agent_mode.cache_images('cache_images',
|
||||
[self._build_fake_image_info()])
|
||||
def test_cache_image_success(self):
|
||||
result = self.agent_mode.cache_image('cache_image',
|
||||
self._build_fake_image_info())
|
||||
result.join()
|
||||
|
||||
def test_cache_images_invalid_image_list(self):
|
||||
def test_cache_image_invalid_image_list(self):
|
||||
self.assertRaises(errors.InvalidCommandParamsError,
|
||||
self.agent_mode.cache_images,
|
||||
'cache_images',
|
||||
self.agent_mode.cache_image,
|
||||
'cache_image',
|
||||
{'foo': 'bar'})
|
||||
|
||||
def test_image_location(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user