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.
This commit is contained in:
Bryan Strassner 2017-07-18 17:05:05 -05:00 committed by Scott Hussey
parent 683d783ebb
commit b82f1b080c
3 changed files with 9 additions and 10 deletions

View File

@ -38,24 +38,23 @@ class PartList(PartBase): # pylint: disable=too-few-public-methods
def invoke(self): def invoke(self):
#TODO: change the api call #TODO: change the api call
#return self.api_client.get_design_ids() return 'This function does not yet have an implementation to support the request'
pass
class PartCreate(PartBase): # pylint: disable=too-few-public-methods class PartCreate(PartBase): # pylint: disable=too-few-public-methods
""" Action to create parts of a design """ 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 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 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) super().__init__(api_client, design_id)
self.yaml = yaml self.in_file = in_file
self.logger.debug('PartCreate action initialized with yaml=%s', yaml[:100]) self.logger.debug('PartCreate action init. Input file (trunc to 100 chars)=%s', in_file[:100])
def invoke(self): 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 class PartShow(PartBase): # pylint: disable=too-few-public-methods
""" Action to show a part of a design. """ Action to show a part of a design.

View File

@ -46,10 +46,10 @@ def part_create(ctx, file=None):
with open(file, 'r') as file_input: with open(file, 'r') as file_input:
file_contents = file_input.read() 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'], click.echo(PartCreate(ctx.obj['CLIENT'],
design_id=ctx.obj['DESIGN_ID'], design_id=ctx.obj['DESIGN_ID'],
yaml=file_contents).invoke()) in_file=file_contents).invoke())
@part.command(name='list') @part.command(name='list')
@click.pass_context @click.pass_context

View File

@ -346,4 +346,4 @@ spec:
address: 'dhcp' address: 'dhcp'
- network: 'mgmt' - network: 'mgmt'
address: '172.16.1.83' address: '172.16.1.83'
--- ...