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:
parent
683d783ebb
commit
b82f1b080c
@ -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.
|
||||
|
@ -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
|
||||
|
@ -346,4 +346,4 @@ spec:
|
||||
address: 'dhcp'
|
||||
- network: 'mgmt'
|
||||
address: '172.16.1.83'
|
||||
---
|
||||
...
|
Loading…
x
Reference in New Issue
Block a user