From b82f1b080cb8d3520b61a496c95580ed10b527ef Mon Sep 17 00:00:00 2001 From: Bryan Strassner Date: Tue, 18 Jul 2017 17:05:05 -0500 Subject: [PATCH] Update unimplemented function with message Updated sample yaml to end with ... Updated references to yaml in the code for input file for load parts to instead be in_file since the input may not be yaml someday. --- drydock_provisioner/cli/part/actions.py | 13 ++++++------- drydock_provisioner/cli/part/commands.py | 4 ++-- examples/designparts_v1.0.yaml | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drydock_provisioner/cli/part/actions.py b/drydock_provisioner/cli/part/actions.py index 1a189e19..c1910818 100644 --- a/drydock_provisioner/cli/part/actions.py +++ b/drydock_provisioner/cli/part/actions.py @@ -38,24 +38,23 @@ class PartList(PartBase): # pylint: disable=too-few-public-methods def invoke(self): #TODO: change the api call - #return self.api_client.get_design_ids() - pass + return 'This function does not yet have an implementation to support the request' class PartCreate(PartBase): # pylint: disable=too-few-public-methods """ Action to create parts of a design """ - def __init__(self, api_client, design_id, yaml): + def __init__(self, api_client, design_id, in_file): """ :param DrydockClient api_client: The api client used for invocation. :param string design_id: The UUID of the design for which to create a part - :param yaml: The file containing the specification of the part + :param in_file: The file containing the specification of the part """ super().__init__(api_client, design_id) - self.yaml = yaml - self.logger.debug('PartCreate action initialized with yaml=%s', yaml[:100]) + self.in_file = in_file + self.logger.debug('PartCreate action init. Input file (trunc to 100 chars)=%s', in_file[:100]) def invoke(self): - return self.api_client.load_parts(self.design_id, self.yaml) + return self.api_client.load_parts(self.design_id, self.in_file) class PartShow(PartBase): # pylint: disable=too-few-public-methods """ Action to show a part of a design. diff --git a/drydock_provisioner/cli/part/commands.py b/drydock_provisioner/cli/part/commands.py index 078c9ea2..5846d3ff 100644 --- a/drydock_provisioner/cli/part/commands.py +++ b/drydock_provisioner/cli/part/commands.py @@ -46,10 +46,10 @@ def part_create(ctx, file=None): with open(file, 'r') as file_input: file_contents = file_input.read() - # here is where some yaml validation could be done + # here is where some potential validation could be done on the input file click.echo(PartCreate(ctx.obj['CLIENT'], design_id=ctx.obj['DESIGN_ID'], - yaml=file_contents).invoke()) + in_file=file_contents).invoke()) @part.command(name='list') @click.pass_context diff --git a/examples/designparts_v1.0.yaml b/examples/designparts_v1.0.yaml index 9953e68b..f174b73b 100644 --- a/examples/designparts_v1.0.yaml +++ b/examples/designparts_v1.0.yaml @@ -346,4 +346,4 @@ spec: address: 'dhcp' - network: 'mgmt' address: '172.16.1.83' ---- \ No newline at end of file +... \ No newline at end of file