diff --git a/build/openapi-generator/model.mustache b/build/openapi-generator/model.mustache index d778c21e..f1ba86d8 100644 --- a/build/openapi-generator/model.mustache +++ b/build/openapi-generator/model.mustache @@ -1,202 +1,58 @@ -# coding: utf-8 +{{> partial_header }} -{{>partial_header}} - -import pprint import re # noqa: F401 - +import sys # noqa: F401 import six -from {{packageName}}.configuration import Configuration - - +from {{packageName}}.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) {{#models}} {{#model}} -class {{classname}}(object): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """{{#allowableValues}} - - """ - allowed enum values - """ -{{#enumVars}} - {{name}} = {{{value}}}{{^-last}} -{{/-last}} -{{/enumVars}}{{/allowableValues}} - -{{#allowableValues}} - allowable_values = [{{#enumVars}}{{name}}{{^-last}}, {{/-last}}{{/enumVars}}] # noqa: E501 - -{{/allowableValues}} - """ - Attributes: - openapi_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - openapi_types = { -{{#vars}} - '{{name}}': '{{{dataType}}}'{{#hasMore}},{{/hasMore}} -{{/vars}} - } - - attribute_map = { -{{#vars}} - '{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}} -{{/vars}} - } -{{#discriminator}} +{{#imports}} +{{#-first}} - discriminator_value_class_map = { -{{#children}} - '{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},{{/-last}} -{{/children}} - } -{{/discriminator}} - - def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}, local_vars_configuration=None): # noqa: E501 - """{{classname}} - a model defined in OpenAPI""" # noqa: E501 - if local_vars_configuration is None: - local_vars_configuration = Configuration() - self.local_vars_configuration = local_vars_configuration -{{#vars}}{{#-first}} -{{/-first}} - self._{{name}} = None -{{/vars}} - self.discriminator = {{#discriminator}}'{{{discriminatorName}}}'{{/discriminator}}{{^discriminator}}None{{/discriminator}} -{{#vars}}{{#-first}} +def lazy_import(): {{/-first}} -{{#required}} - self.{{name}} = {{name}} -{{/required}} -{{^required}} -{{#isNullable}} - self.{{name}} = {{name}} -{{/isNullable}} -{{^isNullable}} - if {{name}} is not None: - self.{{name}} = {{name}} -{{/isNullable}} -{{/required}} -{{/vars}} - -{{#vars}} - @property - def {{name}}(self): - """Gets the {{name}} of this {{classname}}. # noqa: E501 - -{{#description}} - {{{description}}} # noqa: E501 -{{/description}} - - :return: The {{name}} of this {{classname}}. # noqa: E501 - :rtype: {{dataType}} - """ - return self._{{name}} + {{{.}}} +{{/imports}} - @{{name}}.setter - def {{name}}(self, {{name}}): - """Sets the {{name}} of this {{classname}}. -{{#description}} - {{{description}}} # noqa: E501 -{{/description}} - - :param {{name}}: The {{name}} of this {{classname}}. # noqa: E501 - :type {{name}}: {{dataType}} - """ -{{^isNullable}} -{{#required}} - if self.local_vars_configuration.client_side_validation and {{name}} is None: # noqa: E501 - raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501 -{{/required}} -{{/isNullable}} +{{^interfaces}} +{{#isArray}} +{{> model_templates/model_simple }} +{{/isArray}} {{#isEnum}} -{{#isContainer}} - allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 -{{#isListContainer}} - if (self.local_vars_configuration.client_side_validation and - not set({{{name}}}).issubset(set(allowed_values))): # noqa: E501 - raise ValueError( - "Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set({{{name}}}) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) -{{/isListContainer}} -{{#isMapContainer}} - if (self.local_vars_configuration.client_side_validation and - not set({{{name}}}.keys()).issubset(set(allowed_values))): # noqa: E501 - raise ValueError( - "Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set({{{name}}}.keys()) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) -{{/isMapContainer}} -{{/isContainer}} -{{^isContainer}} - allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 - if self.local_vars_configuration.client_side_validation and {{{name}}} not in allowed_values: # noqa: E501 - raise ValueError( - "Invalid value for `{{{name}}}` ({0}), must be one of {1}" # noqa: E501 - .format({{{name}}}, allowed_values) - ) -{{/isContainer}} +{{> model_templates/model_simple }} {{/isEnum}} +{{#isAlias}} +{{> model_templates/model_simple }} +{{/isAlias}} +{{^isArray}} {{^isEnum}} -{{#hasValidation}} -{{#maxLength}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and len({{name}}) > {{maxLength}}): - raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501 -{{/maxLength}} -{{#minLength}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and len({{name}}) < {{minLength}}): - raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501 -{{/minLength}} -{{#maximum}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}): # noqa: E501 - raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501 -{{/maximum}} -{{#minimum}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}): # noqa: E501 - raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501 -{{/minimum}} -{{#pattern}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and not re.search(r'{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}})): # noqa: E501 - raise ValueError(r"Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501 -{{/pattern}} -{{#maxItems}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and len({{name}}) > {{maxItems}}): - raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501 -{{/maxItems}} -{{#minItems}} - if (self.local_vars_configuration.client_side_validation and - {{name}} is not None and len({{name}}) < {{minItems}}): - raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501 -{{/minItems}} -{{/hasValidation}} +{{^isAlias}} +{{> model_templates/model_normal }} +{{/isAlias}} {{/isEnum}} +{{/isArray}} +{{/interfaces}} +{{#interfaces}} +{{#-last}} +{{> model_templates/model_composed }} +{{/-last}} +{{/interfaces}} - self._{{name}} = {{name}} - -{{/vars}} -{{#discriminator}} - def get_real_child_model(self, data): - """Returns the real base class specified by the discriminator""" - discriminator_key = self.attribute_map[self.discriminator] - discriminator_value = data[discriminator_key] - return self.discriminator_value_class_map.get(discriminator_value) - -{{/discriminator}} def to_dict(self): """Returns the model properties as a dict""" result = {} @@ -241,4 +97,4 @@ class {{classname}}(object): return self.to_dict() != other.to_dict() {{/model}} -{{/models}} +{{/models}} \ No newline at end of file diff --git a/stackl/cli/commands/apply.py b/stackl/cli/commands/apply.py index 40114934..937fc2cb 100644 --- a/stackl/cli/commands/apply.py +++ b/stackl/cli/commands/apply.py @@ -5,6 +5,8 @@ import click import stackl_client import yaml +from urllib3.exceptions import NewConnectionError, MaxRetryError +from stackl_client.exceptions import ApiException, ApiValueError from commands.autocomplete import show_progress_bar from context import StacklContext from mergedeep import merge @@ -24,14 +26,25 @@ @click.argument('instance-name', required=False) def apply(directory, config_file, params, tags, secrets, service_params, service_secrets, replicas, services, instance_name, show_progress): - stackl_context = StacklContext() - if instance_name is None: - upload_files(directory, stackl_context) - else: - apply_stack_instance(config_file, params, tags, secrets, - service_params, service_secrets, replicas, - services, stackl_context, instance_name, - show_progress) + try: + stackl_context = StacklContext() + if instance_name is None: + upload_files(directory, stackl_context) + else: + apply_stack_instance(config_file, params, tags, secrets, + service_params, service_secrets, replicas, + services, stackl_context, instance_name, + show_progress) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) def apply_stack_instance(config_file, params, tags, secrets, service_params, @@ -62,7 +75,7 @@ def apply_stack_instance(config_file, params, tags, secrets, service_params, services = config_doc['services'] if "stages" in config_doc: stages = config_doc['stages'] - invocation = stackl_client.StackInstanceInvocation( + invocation = stackl_client.models.StackInstanceInvocation( stack_instance_name=instance_name, stack_infrastructure_template=config_doc[ "stack_infrastructure_template"], @@ -78,9 +91,22 @@ def apply_stack_instance(config_file, params, tags, secrets, service_params, try: stackl_context.stack_instances_api.get_stack_instance(instance_name) res = stackl_context.stack_instances_api.put_stack_instance(invocation) - except stackl_client.exceptions.ApiException: - res = stackl_context.stack_instances_api.post_stack_instance( - invocation) + except stackl_client.exceptions.NotFoundException as e: + try: + res = stackl_context.stack_instances_api.post_stack_instance(invocation) + except ApiException as e: + click.echo(e) + exit(1) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) click.echo(res) @@ -114,11 +140,18 @@ def upload_file(stackl_doc, stackl_context, path): click.echo( f"Succesfully applied {stackl_doc['name']} with type {stackl_doc['type']}" ) - except stackl_client.exceptions.ApiException as e: + except ApiException as e: click.echo( f"Failed to apply {stackl_doc['name']} with type {stackl_doc['type']}: {e.body}" ) exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) def upload_files(directory, stackl_context): diff --git a/stackl/cli/commands/connect.py b/stackl/cli/commands/connect.py index 700bbf6c..f33375a5 100644 --- a/stackl/cli/commands/connect.py +++ b/stackl/cli/commands/connect.py @@ -8,13 +8,14 @@ @click.command() @click.argument('host', required=True) def connect(host): - homedir = str(Path.home()) - if len(homedir) == 0: - homedir = os.getcwd() - if not os.path.exists(homedir + os.sep + '.stackl'): - os.makedirs(homedir + os.sep + '.stackl') - with open(get_config_path(), 'w+') as stackl_config: - stackl_config.write(host) - - - + try: + homedir = str(Path.home()) + if len(homedir) == 0: + homedir = os.getcwd() + if not os.path.exists(homedir + os.sep + '.stackl'): + os.makedirs(homedir + os.sep + '.stackl') + with open(get_config_path(), 'w+') as stackl_config: + stackl_config.write(host) + except PermissionError as e: + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/create.py b/stackl/cli/commands/create.py index b22316fa..9d4e21cd 100644 --- a/stackl/cli/commands/create.py +++ b/stackl/cli/commands/create.py @@ -5,6 +5,8 @@ import stackl_client from commands.autocomplete import show_progress_bar from context import pass_stackl_context, StacklContext +from urllib3.exceptions import NewConnectionError, MaxRetryError +from stackl_client.exceptions import ApiException, ApiValueError @click.group() @@ -25,20 +27,31 @@ def create(ctx): def instance(stackl_context: StacklContext, stack_infrastructure_template, stack_application_template, params, tags, replicas, show_progress, instance_name): - final_params = {} - for item in params: - final_params = {**final_params, **json.loads(item)} - invocation = stackl_client.StackInstanceInvocation( - stack_instance_name=instance_name, - stack_infrastructure_template=stack_infrastructure_template, - stack_application_template=stack_application_template, - replicas=json.loads(replicas), - params=final_params, - tags=json.loads(tags)) - res = stackl_context.stack_instances_api.post_stack_instance(invocation) - click.echo(res) - if show_progress: - show_progress_bar(stackl_context, instance_name) + try: + final_params = {} + for item in params: + final_params = {**final_params, **json.loads(item)} + invocation = stackl_client.models.StackInstanceInvocation( + stack_instance_name=instance_name, + stack_infrastructure_template=stack_infrastructure_template, + stack_application_template=stack_application_template, + replicas=json.loads(replicas), + params=final_params, + tags=json.loads(tags)) + res = stackl_context.stack_instances_api.post_stack_instance(invocation) + click.echo(res) + if show_progress: + show_progress_bar(stackl_context, instance_name) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @@ -58,7 +71,7 @@ def snapshot(stackl_context: StacklContext, type, name): @pass_stackl_context def policy(stackl_context: StacklContext, policy_file, policy_name, inputs): inputs = [i.strip() for i in inputs.split(',')] - policy = stackl_client.Policy(name=policy_name, + policy = stackl_client.models.PolicyTemplate(name=policy_name, type="policy", category="configs", description="policy through cli", diff --git a/stackl/cli/commands/delete.py b/stackl/cli/commands/delete.py index 8980acf2..92d8911d 100644 --- a/stackl/cli/commands/delete.py +++ b/stackl/cli/commands/delete.py @@ -1,6 +1,8 @@ import click from context import pass_stackl_context, StacklContext +from urllib3.exceptions import NewConnectionError, MaxRetryError +from stackl_client.exceptions import ApiException, ApiValueError @click.group() @@ -14,68 +16,155 @@ def delete(ctx): @click.option('--force', default=False, is_flag=True) @pass_stackl_context def instance(stackl_context: StacklContext, instance_name, force): - res = stackl_context.stack_instances_api.delete_stack_instance( - instance_name, force=force) - click.echo(res) + try: + res = stackl_context.stack_instances_api.delete_stack_instance( + instance_name, force=force) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('snapshot-name') @pass_stackl_context def snapshot(stackl_context: StacklContext, snapshot_name): - res = stackl_context.snapshot_api.delete_snapshot(snapshot_name) - click.echo(res) + try: + res = stackl_context.snapshot_api.delete_snapshot(snapshot_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('environment-name') @pass_stackl_context def environment(stackl_context: StacklContext, environment_name): - res = stackl_context.infrastructure_base_api.delete_infrastructure_base( - "environment", environment_name) - click.echo(res) - + try: + res = stackl_context.infrastructure_base_api.delete_infrastructure_base( + "environment", environment_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('location-name') @pass_stackl_context def location(stackl_context: StacklContext, location_name): - res = stackl_context.infrastructure_base_api.delete_infrastructure_base( - "location", location_name) - click.echo(res) + try: + res = stackl_context.infrastructure_base_api.delete_infrastructure_base( + "location", location_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('zone-name') @pass_stackl_context def zone(stackl_context: StacklContext, zone_name): - res = stackl_context.infrastructure_base_api.delete_infrastructure_base( - "zone", zone_name) - click.echo(res) + try: + res = stackl_context.infrastructure_base_api.delete_infrastructure_base( + "zone", zone_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('sat-name') @pass_stackl_context def sat(stackl_context: StacklContext, sat_name): - res = stackl_context.sat_api.delete_stack_application_template(sat_name) - click.echo(res) + try: + res = stackl_context.sat_api.delete_stack_application_template(sat_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('sit-name') @pass_stackl_context def sit(stackl_context: StacklContext, sit_name): - res = stackl_context.sit_api.delete_stack_infrastructure_template(sit_name) - click.echo(res) + try: + res = stackl_context.sit_api.delete_stack_infrastructure_template(sit_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('service-name') @pass_stackl_context def service(stackl_context: StacklContext, service_name): - res = stackl_context.services_api.delete_service(service_name) - click.echo(res) + try: + res = stackl_context.services_api.delete_service(service_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @@ -83,15 +172,37 @@ def service(stackl_context: StacklContext, service_name): @pass_stackl_context def functional_requirement(stackl_context: StacklContext, functional_requirement_name): - res = stackl_context.functional_requirements_api.delete_functional_requirement( - functional_requirement_name) - click.echo(res) + try: + res = stackl_context.functional_requirements_api.delete_functional_requirement( + functional_requirement_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @delete.command() @click.argument('policy-template-name') @pass_stackl_context def policy_template(stackl_context: StacklContext, policy_template_name): - res = stackl_context.policy_templates_api.delete_policy_template( - policy_template_name) - click.echo(res) + try: + res = stackl_context.policy_templates_api.delete_policy_template( + policy_template_name) + click.echo(res) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/edit.py b/stackl/cli/commands/edit.py index 72eb2e19..1890a205 100644 --- a/stackl/cli/commands/edit.py +++ b/stackl/cli/commands/edit.py @@ -3,6 +3,8 @@ from commands.autocomplete import get_zones, get_locations, get_environments, get_services, get_functional_requirements, \ get_policy_templates, get_sits, get_sats +from urllib3.exceptions import NewConnectionError, MaxRetryError +from stackl_client.exceptions import ApiException, ApiValueError from context import pass_stackl_context, StacklContext try: @@ -21,118 +23,206 @@ def edit(ctx): @click.argument('name', autocompletion=get_zones) @pass_stackl_context def zone(stackl_context: StacklContext, name): - zone = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( - "zone", name) - new_zone = click.edit(yaml.dump(zone.to_dict(), Dumper=Dumper)) - if new_zone is not None: - new_zone = yaml.load(new_zone, Loader=yaml.FullLoader) - stackl_context.infrastructure_base_api.put_infrastructure_base( - new_zone) - click.echo("Zone updated") - else: - click.echo("No changes, document not modified") + try: + zone = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( + "zone", name) + new_zone = click.edit(yaml.dump(zone.to_dict(), Dumper=Dumper)) + if new_zone is not None: + new_zone = yaml.load(new_zone, Loader=yaml.FullLoader) + stackl_context.infrastructure_base_api.put_infrastructure_base( + new_zone) + click.echo("Zone updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_locations) @pass_stackl_context def location(stackl_context: StacklContext, name): - location = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( - "location", name) - new_location = click.edit(yaml.dump(location.to_dict(), Dumper=Dumper)) - if new_location is not None: - new_location = yaml.load(new_location, Loader=yaml.FullLoader) - stackl_context.infrastructure_base_api.put_infrastructure_base( - new_location) - click.echo("Location updated") - else: - click.echo("No changes, document not modified") + try: + location = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( + "location", name) + new_location = click.edit(yaml.dump(location.to_dict(), Dumper=Dumper)) + if new_location is not None: + new_location = yaml.load(new_location, Loader=yaml.FullLoader) + stackl_context.infrastructure_base_api.put_infrastructure_base( + new_location) + click.echo("Location updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_environments) @pass_stackl_context def environment(stackl_context: StacklContext, name): - environment = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( - "environment", name) - new_environment = click.edit( - yaml.dump(environment.to_dict(), Dumper=Dumper)) - if new_environment is not None: - new_environment = yaml.load(new_environment, Loader=yaml.FullLoader) - stackl_context.infrastructure_base_api.put_infrastructure_base( - new_environment) - click.echo("Environment updated") - else: - click.echo("No changes, document not modified") + try: + environment = stackl_context.infrastructure_base_api.get_infrastructure_base_by_type_and_name( + "environment", name) + new_environment = click.edit( + yaml.dump(environment.to_dict(), Dumper=Dumper)) + if new_environment is not None: + new_environment = yaml.load(new_environment, Loader=yaml.FullLoader) + stackl_context.infrastructure_base_api.put_infrastructure_base( + new_environment) + click.echo("Environment updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_services) @pass_stackl_context def service(stackl_context: StacklContext, name): - service = stackl_context.services_api.get_service_by_name(name) - new_service = click.edit(yaml.dump(service.to_dict(), Dumper=Dumper)) - if new_service is not None: - new_service = yaml.load(new_service, Loader=yaml.FullLoader) - stackl_context.services_api.put_service(new_service) - click.echo("Service updated") - else: - click.echo("No changes, document not modified") + try: + service = stackl_context.services_api.get_service_by_name(name) + new_service = click.edit(yaml.dump(service.to_dict(), Dumper=Dumper)) + if new_service is not None: + new_service = yaml.load(new_service, Loader=yaml.FullLoader) + stackl_context.services_api.put_service(new_service) + click.echo("Service updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_functional_requirements) @pass_stackl_context def functional_requirement(stackl_context: StacklContext, name): - functional_requirement = stackl_context.functional_requirements_api.get_functional_requirement_by_name(name) - new_functional_requirement = click.edit(yaml.dump(functional_requirement.to_dict(), Dumper=Dumper)) - if new_functional_requirement is not None: - new_functional_requirement = yaml.load(new_functional_requirement, Loader=yaml.FullLoader) - stackl_context.functional_requirements_api.put_functional_requirement(new_functional_requirement) - click.echo("Functional Requirement updated") - else: - click.echo("No changes, document not modified") + try: + functional_requirement = stackl_context.functional_requirements_api.get_functional_requirement_by_name(name) + new_functional_requirement = click.edit(yaml.dump(functional_requirement.to_dict(), Dumper=Dumper)) + if new_functional_requirement is not None: + new_functional_requirement = yaml.load(new_functional_requirement, Loader=yaml.FullLoader) + stackl_context.functional_requirements_api.put_functional_requirement(new_functional_requirement) + click.echo("Functional Requirement updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_policy_templates) @pass_stackl_context def policy_template(stackl_context: StacklContext, name): - policy_template = stackl_context.policy_templates_api.get_policy_template_by_name(name) - new_policy_template = click.edit(yaml.dump(policy_template.to_dict(), Dumper=Dumper)) - if new_policy_template is not None: - new_policy_template = yaml.load(new_policy_template, Loader=yaml.FullLoader) - stackl_context.policy_templates_api.put_policy_template(new_policy_template) - click.echo("Policy template updated") - else: - click.echo("No changes, document not modified") + try: + policy_template = stackl_context.policy_templates_api.get_policy_template_by_name(name) + new_policy_template = click.edit(yaml.dump(policy_template.to_dict(), Dumper=Dumper)) + if new_policy_template is not None: + new_policy_template = yaml.load(new_policy_template, Loader=yaml.FullLoader) + stackl_context.policy_templates_api.put_policy_template(new_policy_template) + click.echo("Policy template updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_sits) @pass_stackl_context def sit(stackl_context: StacklContext, name): - sit = stackl_context.sit_api.get_stack_infrastructure_template_by_name( - name) - new_sit = click.edit(yaml.dump(sit.to_dict(), Dumper=Dumper)) - if new_sit is not None: - new_sit = yaml.load(new_sit, Loader=yaml.FullLoader) - stackl_context.infrastructure_base_api.put_infrastructure_base(new_sit) - click.echo("SIT updated") - else: - click.echo("No changes, document not modified") + try: + sit = stackl_context.sit_api.get_stack_infrastructure_template_by_name( + name) + new_sit = click.edit(yaml.dump(sit.to_dict(), Dumper=Dumper)) + if new_sit is not None: + new_sit = yaml.load(new_sit, Loader=yaml.FullLoader) + stackl_context.infrastructure_base_api.put_infrastructure_base(new_sit) + click.echo("SIT updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @edit.command() @click.argument('name', autocompletion=get_sats) @pass_stackl_context def sat(stackl_context: StacklContext, name): - sat = stackl_context.sat_api.get_stack_infrastructure_template_by_name( - name) - new_sat = click.edit(yaml.dump(sat.to_dict(), Dumper=Dumper)) - if new_sat is not None: - new_sat = yaml.load(new_sat, Loader=yaml.FullLoader) - stackl_context.infrastructure_base_api.put_infrastructure_base(new_sat) - click.echo("SAT updated") - else: - click.echo("No changes, document not modified") + try: + sat = stackl_context.sat_api.get_stack_infrastructure_template_by_name( + name) + new_sat = click.edit(yaml.dump(sat.to_dict(), Dumper=Dumper)) + if new_sat is not None: + new_sat = yaml.load(new_sat, Loader=yaml.FullLoader) + stackl_context.infrastructure_base_api.put_infrastructure_base(new_sat) + click.echo("SAT updated") + else: + click.echo("No changes, document not modified") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/get.py b/stackl/cli/commands/get.py index b8ae2c7e..a5fe9c94 100644 --- a/stackl/cli/commands/get.py +++ b/stackl/cli/commands/get.py @@ -1,10 +1,12 @@ import json +from urllib3.exceptions import NewConnectionError, MaxRetryError import click import yaml from commands.autocomplete import get_stack_instances, get_environments, get_locations, get_zones, get_sats, get_sits, \ get_services, get_functional_requirements, get_policy_templates -from stackl_client import StackInfrastructureTemplate, ApiException +from stackl_client.models import StackInfrastructureTemplate +from stackl_client.exceptions import ApiException, ApiValueError from tabulate import tabulate try: @@ -83,7 +85,14 @@ def instance(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) - + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @click.option('-o', '--output') @@ -101,6 +110,14 @@ def environment(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -119,6 +136,14 @@ def location(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -137,6 +162,14 @@ def zone(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -153,6 +186,14 @@ def sat(stackl_context: StacklContext, output, name): click.echo(parse(sat, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -169,6 +210,14 @@ def sit(stackl_context: StacklContext, output, name): click.echo(parse(sit, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -184,6 +233,14 @@ def service(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -201,6 +258,14 @@ def functional_requirement(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -217,6 +282,14 @@ def policy_template(stackl_context: StacklContext, output, name): click.echo(parse(env, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -230,6 +303,14 @@ def snapshots(stackl_context: StacklContext, type, name, output): click.echo(parse(snapshots, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @get.command() @@ -242,3 +323,11 @@ def snapshot(stackl_context: StacklContext, name, output): click.echo(parse(snapshot, output)) except ApiException as e: click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/info.py b/stackl/cli/commands/info.py index a4f38ca7..a2b9099b 100644 --- a/stackl/cli/commands/info.py +++ b/stackl/cli/commands/info.py @@ -1,11 +1,16 @@ import click -import stackl_client +import stackl_client.apis as stackl_apis from context import StacklContext - +from urllib3.exceptions import NewConnectionError, MaxRetryError @click.command() def info(): - stackl_context = StacklContext() - about_api = stackl_client.AboutApi(api_client=stackl_context.api_client) - click.echo(about_api.get_hostname()) + try: + stackl_context = StacklContext() + about_api = stackl_apis.AboutApi(api_client=stackl_context.api_client) + click.echo(about_api.get_hostname()) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/restore.py b/stackl/cli/commands/restore.py index e06df165..f88fa721 100644 --- a/stackl/cli/commands/restore.py +++ b/stackl/cli/commands/restore.py @@ -1,11 +1,17 @@ import click from context import StacklContext +from urllib3.exceptions import NewConnectionError, MaxRetryError @click.command() @click.argument('snapshot_name', required=True) def restore(snapshot_name): - stackl_context = StacklContext - result = stackl_context.snapshot_api.restore_snapshot(snapshot_name) - click.echo(result) + try: + stackl_context = StacklContext + result = stackl_context.snapshot_api.restore_snapshot(snapshot_name) + click.echo(result) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/commands/update.py b/stackl/cli/commands/update.py index 738dd1cb..7ce5228c 100644 --- a/stackl/cli/commands/update.py +++ b/stackl/cli/commands/update.py @@ -4,6 +4,8 @@ import stackl_client from commands.autocomplete import show_progress_bar from context import pass_stackl_context, StacklContext +from urllib3.exceptions import NewConnectionError, MaxRetryError +from stackl_client.exceptions import ApiException, ApiValueError @click.group() @@ -22,20 +24,31 @@ def update(ctx): @pass_stackl_context def instance(stackl_context: StacklContext, params, secrets, replicas, show_progress, disable_invocation, instance_name): - final_params = {} - for item in params: - final_params = {**final_params, **json.loads(item)} - invocation = stackl_client.StackInstanceUpdate( - stack_instance_name=instance_name, - params=final_params, - secrets=json.loads(secrets), - replicas=json.loads(replicas)) - if disable_invocation: - invocation.disable_invocation = True - res = stackl_context.stack_instances_api.put_stack_instance(invocation) - click.echo(res) - if show_progress: - show_progress_bar(stackl_context, instance_name) + try: + final_params = {} + for item in params: + final_params = {**final_params, **json.loads(item)} + invocation = stackl_client.models.StackInstanceUpdate( + stack_instance_name=instance_name, + params=final_params, + secrets=json.loads(secrets), + replicas=json.loads(replicas)) + if disable_invocation: + invocation.disable_invocation = True + res = stackl_context.stack_instances_api.put_stack_instance(invocation) + click.echo(res) + if show_progress: + show_progress_bar(stackl_context, instance_name) + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) @update.command() @@ -45,7 +58,18 @@ def instance(stackl_context: StacklContext, params, secrets, replicas, show_prog @click.argument('instance-name') @pass_stackl_context def outputs(stackl_context: StacklContext, params, infrastructure_target, service, instance_name): - outputs_update = stackl_client.OutputsUpdate(outputs=json.loads(params), infrastructure_target=infrastructure_target, - service=service, stack_instance=instance_name) - stackl_context.outputs_api.add_outputs(outputs_update) - click.echo("Updated outputs") + try: + outputs_update = stackl_client.models.OutputsUpdate(outputs=json.loads(params), infrastructure_target=infrastructure_target, + service=service, stack_instance=instance_name) + stackl_context.outputs_api.add_outputs(outputs_update) + click.echo("Updated outputs") + except ApiException as e: + click.echo(e.body) + exit(1) + except ApiValueError as e: + click.echo(e.body) + exit(1) + except (NewConnectionError, MaxRetryError) as e: + click.echo("Unable to connect to Stackl host") + click.echo(e) + exit(1) diff --git a/stackl/cli/context.py b/stackl/cli/context.py index dbcbfd65..82bb54a9 100644 --- a/stackl/cli/context.py +++ b/stackl/cli/context.py @@ -2,9 +2,9 @@ from pathlib import Path import click +import stackl_client.apis as stackl_apis import stackl_client - class StacklContext(object): def __init__(self): try: @@ -13,23 +13,23 @@ def __init__(self): configuration = stackl_client.Configuration() configuration.host = host self.api_client = stackl_client.ApiClient(configuration=configuration) - self.infrastructure_base_api = stackl_client.InfrastructureBaseApi( + self.infrastructure_base_api = stackl_apis.InfrastructureBaseApi( api_client=self.api_client) - self.functional_requirements_api = stackl_client.FunctionalRequirementsApi( + self.functional_requirements_api = stackl_apis.FunctionalRequirementsApi( api_client=self.api_client) - self.services_api = stackl_client.ServicesApi( + self.services_api = stackl_apis.ServicesApi( api_client=self.api_client) - self.sat_api = stackl_client.StackApplicationTemplatesApi( + self.sat_api = stackl_apis.StackApplicationTemplatesApi( api_client=self.api_client) - self.sit_api = stackl_client.StackInfrastructureTemplatesApi( + self.sit_api = stackl_apis.StackInfrastructureTemplatesApi( api_client=self.api_client) - self.stack_instances_api = stackl_client.StackInstancesApi( + self.stack_instances_api = stackl_apis.StackInstancesApi( api_client=self.api_client) - self.policy_templates_api = stackl_client.PolicyTemplatesApi( + self.policy_templates_api = stackl_apis.PolicyTemplatesApi( api_client=self.api_client) - self.snapshot_api = stackl_client.SnapshotsApi( + self.snapshot_api = stackl_apis.SnapshotsApi( api_client=self.api_client) - self.outputs_api = stackl_client.OutputsApi(api_client=self.api_client) + self.outputs_api = stackl_apis.OutputsApi(api_client=self.api_client) except FileNotFoundError: click.echo( "Config file not found, run `stackl connect` first") diff --git a/stackl/cli/setup.py b/stackl/cli/setup.py index c2913d03..950d9a8b 100644 --- a/stackl/cli/setup.py +++ b/stackl/cli/setup.py @@ -8,7 +8,7 @@ py_modules=['stackl', 'commands', 'context'], packages=find_packages(), install_requires=[ - f'stackl-client==0.3.4dev', 'pyYAML==5.3', 'Click==7.0', + f'stackl-client==0.3.4dev', 'pyYAML==5.4.1', 'Click==7.0', 'mergedeep==1.3.0', 'tabulate==0.8.6', 'glom==19.10.0' ], entry_points=''' diff --git a/stackl/core/core/agent_broker/agent_task_broker.py b/stackl/core/core/agent_broker/agent_task_broker.py index c3f32d26..05b584af 100644 --- a/stackl/core/core/agent_broker/agent_task_broker.py +++ b/stackl/core/core/agent_broker/agent_task_broker.py @@ -63,7 +63,7 @@ async def create_service(action, redis, stack_instance, to_be_deleted, if fr_doc.invocation[cloud_provider].playbook_path is not None: invoc['playbook_path'] = fr_doc.invocation[ cloud_provider].playbook_path - if fr_doc.invocation[cloud_provider].serial is not None: + if fr_doc.invocation[cloud_provider].serial: invoc['serial'] = fr_doc.invocation[cloud_provider].serial invoc['service'] = service_name invoc["hosts"] = service.hosts diff --git a/stackl/core/core/models/api/stack_instance.py b/stackl/core/core/models/api/stack_instance.py index 84276206..141d4f9d 100644 --- a/stackl/core/core/models/api/stack_instance.py +++ b/stackl/core/core/models/api/stack_instance.py @@ -21,7 +21,7 @@ class StackInstanceInvocation(BaseModel): secrets: Dict[str, Any] = {} replicas: Dict[str, int] = {} services: List[StackApplicationTemplateService] = [] - stages: List[StackStage] = None + stages: List[StackStage] = [] class StackInstanceUpdate(BaseModel): @@ -37,4 +37,4 @@ class StackInstanceUpdate(BaseModel): replicas: Dict[str, int] = {} disable_invocation: bool = False services: List[StackApplicationTemplateService] = [] - stages: List[StackStage] = None + stages: List[StackStage] = [] diff --git a/stackl/core/core/models/configs/functional_requirement_model.py b/stackl/core/core/models/configs/functional_requirement_model.py index 4ba85c1a..3d7bd0b5 100644 --- a/stackl/core/core/models/configs/functional_requirement_model.py +++ b/stackl/core/core/models/configs/functional_requirement_model.py @@ -1,7 +1,7 @@ """ Module containing functional requirement classes """ -from typing import Dict +from typing import Dict, Optional from pydantic import BaseModel # pylint: disable=E0611 #error in pylint @@ -10,12 +10,12 @@ class Invocation(BaseModel): """the invocation of a functional requirement""" - description: str = None + description: str = "" tool: str image: str - before_command: str = None - playbook_path: str = None - serial: int = None + before_command: Optional[str] = "" + playbook_path: str = "" + serial: int = 10 class FunctionalRequirement(BaseDocument): diff --git a/stackl/core/core/models/configs/stack_application_template_model.py b/stackl/core/core/models/configs/stack_application_template_model.py index 3c720748..37de0142 100644 --- a/stackl/core/core/models/configs/stack_application_template_model.py +++ b/stackl/core/core/models/configs/stack_application_template_model.py @@ -30,5 +30,5 @@ class StackApplicationTemplate(BaseModel): description: str = "" type = "stack_application_template" services: List[StackApplicationTemplateService] - policies: Dict[str, List[Any]] = None - stages: List[StackStage] = None + policies: Dict[str, List[Any]] = {} + stages: List[StackStage] = [] diff --git a/stackl/core/core/models/items/service_model.py b/stackl/core/core/models/items/service_model.py index cfb250a1..01215d0c 100644 --- a/stackl/core/core/models/items/service_model.py +++ b/stackl/core/core/models/items/service_model.py @@ -14,5 +14,5 @@ class Service(BaseDocument): type = "service" name: str functional_requirements: List[str] - resource_requirements: Dict[str, Any] = None - service_policies: List[Any] = None + resource_requirements: Dict[str, Any] = {} + service_policies: List[Dict[str, Any]] = [] diff --git a/stackl/core/core/models/items/stack_instance_model.py b/stackl/core/core/models/items/stack_instance_model.py index f86cb137..3348cfa4 100644 --- a/stackl/core/core/models/items/stack_instance_model.py +++ b/stackl/core/core/models/items/stack_instance_model.py @@ -35,4 +35,4 @@ class StackInstance(BaseModel): stack_application_template: str category = "items" status: List[StackInstanceStatus] = None - stages: List[StackStage] = None + stages: List[StackStage] = [] diff --git a/stackl/core/core/models/items/stack_instance_service_model.py b/stackl/core/core/models/items/stack_instance_service_model.py index a2cbf2b2..260bd635 100644 --- a/stackl/core/core/models/items/stack_instance_service_model.py +++ b/stackl/core/core/models/items/stack_instance_service_model.py @@ -2,7 +2,7 @@ StackInstanceService model """ import re -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional from pydantic import BaseModel from redis import Redis @@ -19,19 +19,19 @@ class StackInstanceService(BaseModel): """ StackInstanceService model """ - infrastructure_target: str = None - provisioning_parameters: Dict[str, Any] = None + infrastructure_target: str = "" + provisioning_parameters: Dict[str, Any] = {} cloud_provider: str = "generic" - secrets: Dict[str, Any] = None - hosts: List[str] = None - resources: Dict[str, str] = None - service: str = None + secrets: Dict[str, Any] = {} + hosts: Optional[List[str]] = [] + resources: Dict[str, str] = {} + service: str = "" agent: str = "" opa_outputs: Dict[str, Any] = {} outputs: Dict[str, Any] = {} - packages: List[str] = None - tags: Dict[str, str] = None - service: str = None + packages: List[str] = [] + tags: Dict[str, str] = {} + service: str = "" def template_hosts(self, stackl_hostname, instances, infra_target_counter): """Templates the host field in a stack instance""" diff --git a/stackl/core/core/routers/stack_instances_router.py b/stackl/core/core/routers/stack_instances_router.py index b42b9b79..66d38338 100644 --- a/stackl/core/core/routers/stack_instances_router.py +++ b/stackl/core/core/routers/stack_instances_router.py @@ -67,7 +67,7 @@ async def post_stack_instance( (stack_instance, return_result) = stack_manager.process_stack_request( stack_instance_invocation, "create") if stack_instance is None: - return HTTPException(422, return_result) + raise HTTPException(422, return_result) document_manager.write_stack_instance(stack_instance) # Perform invocations @@ -91,7 +91,7 @@ async def put_stack_instance( (stack_instance, return_result) = stack_manager.process_stack_request( stack_instance_update, "update") if stack_instance is None: - return HTTPException(422, return_result) + raise HTTPException(422, return_result) # Perform invocations if not stack_instance_update.disable_invocation: @@ -121,7 +121,7 @@ def delete_stack_instance( if stack_instance is None: return { "result": - f"Stack instance {name} can't be delete because it does not exist" + f"Stack instance {name} can't be deleted because it does not exist" } else: background_tasks.add_task(create_job_for_agent, diff --git a/stackl/core/poetry.lock b/stackl/core/poetry.lock index 72f9fee5..f933bdbf 100644 --- a/stackl/core/poetry.lock +++ b/stackl/core/poetry.lock @@ -1,210 +1,222 @@ [[package]] -name = "aioredis" -version = "1.3.1" -description = "asyncio (PEP 3156) Redis support" category = "main" +description = "asyncio (PEP 3156) Redis support" +name = "aioredis" optional = false python-versions = "*" +version = "1.3.1" [package.dependencies] -hiredis = "*" async-timeout = "*" +hiredis = "*" [[package]] -name = "arq" -version = "0.19.1" -description = "Job queues in python with asyncio and redis" category = "main" +description = "Job queues in python with asyncio and redis" +name = "arq" optional = false python-versions = ">=3.6" +version = "0.19.1" [package.dependencies] -typing-extensions = {version = ">=3.7", markers = "python_version < \"3.8\""} aioredis = ">=1.1.0" +async-timeout = ">=3.0.0" click = ">=6.7" pydantic = ">=1" -async-timeout = ">=3.0.0" + +[package.dependencies.typing-extensions] +python = "<3.8" +version = ">=3.7" [package.extras] watch = ["watchgod (>=0.4)"] [[package]] -name = "astroid" -version = "2.4.2" -description = "An abstract syntax tree for Python with inference support." category = "dev" +description = "An abstract syntax tree for Python with inference support." +name = "astroid" optional = false python-versions = ">=3.5" +version = "2.4.2" [package.dependencies] lazy-object-proxy = ">=1.4.0,<1.5.0" -typed-ast = {version = ">=1.4.0,<1.5", markers = "implementation_name == \"cpython\" and python_version < \"3.8\""} six = ">=1.12,<2.0" wrapt = ">=1.11,<2.0" +[package.dependencies.typed-ast] +python = "<3.8" +version = ">=1.4.0,<1.5" + [[package]] -name = "async-timeout" -version = "3.0.1" -description = "Timeout context manager for asyncio programs" category = "main" +description = "Timeout context manager for asyncio programs" +name = "async-timeout" optional = false python-versions = ">=3.5.3" +version = "3.0.1" [[package]] -name = "atomicwrites" -version = "1.4.0" -description = "Atomic file writes." category = "dev" +description = "Atomic file writes." +marker = "sys_platform == \"win32\"" +name = "atomicwrites" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.4.0" [[package]] -name = "attr" -version = "0.3.1" -description = "Simple decorator to set attributes of target function or class in a DRY way." category = "main" +description = "Simple decorator to set attributes of target function or class in a DRY way." +name = "attr" optional = false python-versions = "*" +version = "0.3.1" [[package]] -name = "attrs" -version = "19.3.0" -description = "Classes Without Boilerplate" category = "main" +description = "Classes Without Boilerplate" +name = "attrs" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "19.3.0" [package.extras] -docs = ["sphinx", "zope.interface"] -tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"] dev = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "pre-commit"] +docs = ["sphinx", "zope.interface"] +tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] [[package]] -name = "certifi" -version = "2020.12.5" -description = "Python package for providing Mozilla's CA Bundle." category = "main" +description = "Python package for providing Mozilla's CA Bundle." +name = "certifi" optional = false python-versions = "*" +version = "2020.12.5" [[package]] -name = "chardet" -version = "4.0.0" -description = "Universal encoding detector for Python 2 and 3" category = "main" +description = "Universal encoding detector for Python 2 and 3" +name = "chardet" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "4.0.0" [[package]] -name = "click" -version = "7.1.2" -description = "Composable command line interface toolkit" category = "main" +description = "Composable command line interface toolkit" +name = "click" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "7.1.2" [[package]] -name = "colorama" -version = "0.4.4" -description = "Cross-platform colored terminal text." category = "main" +description = "Cross-platform colored terminal text." +marker = "sys_platform == \"win32\"" +name = "colorama" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.4.4" [[package]] -name = "elastic-apm" -version = "5.10.0" -description = "The official Python module for Elastic APM" category = "main" +description = "The official Python module for Elastic APM" +name = "elastic-apm" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7" +version = "5.10.0" [package.dependencies] certifi = "*" urllib3 = "*" [package.extras] +aiohttp = ["aiohttp"] flask = ["blinker"] -tornado = ["tornado"] opentracing = ["opentracing (>=2.0.0)"] -aiohttp = ["aiohttp"] starlette = ["starlette"] +tornado = ["tornado"] [[package]] -name = "fastapi" -version = "0.55.1" -description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" category = "main" +description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" +name = "fastapi" optional = false python-versions = ">=3.6" +version = "0.63.0" [package.dependencies] -pydantic = ">=0.32.2,<2.0.0" -starlette = "0.13.2" +pydantic = ">=1.0.0,<2.0.0" +starlette = "0.13.6" [package.extras] -test = ["pytest (>=4.0.0)", "pytest-cov", "mypy", "black", "isort", "requests", "email-validator", "sqlalchemy", "peewee", "databases", "orjson", "async-exit-stack", "async-generator", "python-multipart", "aiofiles", "flask"] -doc = ["mkdocs", "mkdocs-material", "markdown-include", "typer", "typer-cli", "pyyaml"] -all = ["requests", "aiofiles", "jinja2", "python-multipart", "itsdangerous", "pyyaml", "graphene", "ujson", "orjson", "email-validator", "uvicorn", "async-exit-stack", "async-generator"] -dev = ["pyjwt", "passlib", "autoflake", "flake8", "uvicorn", "graphene"] +all = ["requests (>=2.24.0,<3.0.0)", "aiofiles (>=0.5.0,<0.6.0)", "jinja2 (>=2.11.2,<3.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "itsdangerous (>=1.1.0,<2.0.0)", "pyyaml (>=5.3.1,<6.0.0)", "graphene (>=2.1.8,<3.0.0)", "ujson (>=3.0.0,<4.0.0)", "orjson (>=3.2.1,<4.0.0)", "email_validator (>=1.1.1,<2.0.0)", "uvicorn (>=0.12.0,<0.14.0)", "async_exit_stack (>=1.0.1,<2.0.0)", "async_generator (>=1.10,<2.0.0)"] +dev = ["python-jose (>=3.1.0,<4.0.0)", "passlib (>=1.7.2,<2.0.0)", "autoflake (>=1.3.1,<2.0.0)", "flake8 (>=3.8.3,<4.0.0)", "uvicorn (>=0.12.0,<0.14.0)", "graphene (>=2.1.8,<3.0.0)"] +doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=6.1.4,<7.0.0)", "markdown-include (>=0.5.1,<0.6.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.2.0)", "typer-cli (>=0.0.9,<0.0.10)", "pyyaml (>=5.3.1,<6.0.0)"] +test = ["pytest (5.4.3)", "pytest-cov (2.10.0)", "pytest-asyncio (>=0.14.0,<0.15.0)", "mypy (0.790)", "flake8 (>=3.8.3,<4.0.0)", "black (20.8b1)", "isort (>=5.0.6,<6.0.0)", "requests (>=2.24.0,<3.0.0)", "httpx (>=0.14.0,<0.15.0)", "email_validator (>=1.1.1,<2.0.0)", "sqlalchemy (>=1.3.18,<2.0.0)", "peewee (>=3.13.3,<4.0.0)", "databases (>=0.3.2,<0.4.0)", "orjson (>=3.2.1,<4.0.0)", "async_exit_stack (>=1.0.1,<2.0.0)", "async_generator (>=1.10,<2.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "aiofiles (>=0.5.0,<0.6.0)", "flask (>=1.1.2,<2.0.0)"] [[package]] -name = "gunicorn" -version = "20.0.4" -description = "WSGI HTTP Server for UNIX" category = "main" +description = "WSGI HTTP Server for UNIX" +name = "gunicorn" optional = false python-versions = ">=3.4" +version = "20.0.4" + +[package.dependencies] +setuptools = ">=3.0" [package.extras] -tornado = ["tornado (>=0.2)"] +eventlet = ["eventlet (>=0.9.7)"] gevent = ["gevent (>=0.13)"] setproctitle = ["setproctitle"] -eventlet = ["eventlet (>=0.9.7)"] +tornado = ["tornado (>=0.2)"] [[package]] -name = "h11" -version = "0.9.0" -description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" category = "main" +description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +name = "h11" optional = false python-versions = "*" +version = "0.9.0" [[package]] -name = "hiredis" -version = "1.1.0" -description = "Python wrapper for hiredis" category = "main" +description = "Python wrapper for hiredis" +name = "hiredis" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.1.0" [[package]] -name = "httptools" -version = "0.1.1" -description = "A collection of framework independent HTTP protocol utils." category = "main" +description = "A collection of framework independent HTTP protocol utils." +marker = "sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"" +name = "httptools" optional = false python-versions = "*" +version = "0.1.1" [package.extras] -test = ["Cython (==0.29.14)"] +test = ["Cython (0.29.14)"] [[package]] -name = "idna" -version = "2.10" -description = "Internationalized Domain Names in Applications (IDNA)" category = "main" +description = "Internationalized Domain Names in Applications (IDNA)" +name = "idna" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.10" [[package]] -name = "importlib-metadata" -version = "1.7.0" -description = "Read metadata from Python packages" category = "main" +description = "Read metadata from Python packages" +name = "importlib-metadata" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +version = "1.7.0" [package.dependencies] zipp = ">=0.5" @@ -214,12 +226,12 @@ docs = ["sphinx", "rst.linker"] testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] [[package]] -name = "isort" -version = "5.7.0" -description = "A Python utility / library to sort Python imports." category = "dev" +description = "A Python utility / library to sort Python imports." +name = "isort" optional = false python-versions = ">=3.6,<4.0" +version = "5.7.0" [package.extras] colors = ["colorama (>=0.4.3,<0.5.0)"] @@ -227,321 +239,331 @@ pipfile_deprecated_finder = ["pipreqs", "requirementslib"] requirements_deprecated_finder = ["pipreqs", "pip-api"] [[package]] -name = "lazy-object-proxy" -version = "1.4.3" -description = "A fast and thorough lazy object proxy." category = "dev" +description = "A fast and thorough lazy object proxy." +name = "lazy-object-proxy" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.4.3" [[package]] -name = "loguru" -version = "0.5.3" -description = "Python logging made (stupidly) simple" category = "main" +description = "Python logging made (stupidly) simple" +name = "loguru" optional = false python-versions = ">=3.5" +version = "0.5.3" [package.dependencies] -win32-setctime = {version = ">=1.0.0", markers = "sys_platform == \"win32\""} -colorama = {version = ">=0.3.4", markers = "sys_platform == \"win32\""} +colorama = ">=0.3.4" +win32-setctime = ">=1.0.0" [package.extras] dev = ["codecov (>=2.0.15)", "colorama (>=0.3.4)", "flake8 (>=3.7.7)", "tox (>=3.9.0)", "tox-travis (>=0.12)", "pytest (>=4.6.2)", "pytest-cov (>=2.7.1)", "Sphinx (>=2.2.1)", "sphinx-autobuild (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "black (>=19.10b0)", "isort (>=5.1.1)"] [[package]] -name = "mccabe" -version = "0.6.1" -description = "McCabe checker, plugin for flake8" category = "dev" +description = "McCabe checker, plugin for flake8" +name = "mccabe" optional = false python-versions = "*" +version = "0.6.1" [[package]] -name = "more-itertools" -version = "8.6.0" -description = "More routines for operating on iterables, beyond itertools" category = "dev" +description = "More routines for operating on iterables, beyond itertools" +name = "more-itertools" optional = false python-versions = ">=3.5" +version = "8.6.0" [[package]] -name = "packaging" -version = "20.8" -description = "Core utilities for Python packages" category = "dev" +description = "Core utilities for Python packages" +name = "packaging" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "20.8" [package.dependencies] pyparsing = ">=2.0.2" [[package]] -name = "pluggy" -version = "0.13.1" -description = "plugin and hook calling mechanisms for python" category = "dev" +description = "plugin and hook calling mechanisms for python" +name = "pluggy" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.13.1" [package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +[package.dependencies.importlib-metadata] +python = "<3.8" +version = ">=0.12" [package.extras] dev = ["pre-commit", "tox"] [[package]] -name = "psutil" -version = "5.8.0" -description = "Cross-platform lib for process and system monitoring in Python." category = "main" +description = "Cross-platform lib for process and system monitoring in Python." +name = "psutil" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "5.8.0" [package.extras] test = ["ipaddress", "mock", "unittest2", "enum34", "pywin32", "wmi"] [[package]] -name = "py" -version = "1.10.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" category = "dev" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +name = "py" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "1.10.0" [[package]] -name = "pydantic" -version = "1.7.3" -description = "Data validation and settings management using python 3.6 type hinting" category = "main" +description = "Data validation and settings management using python 3.6 type hinting" +name = "pydantic" optional = false -python-versions = ">=3.6" +python-versions = ">=3.6.1" +version = "1.8.1" + +[package.dependencies] +typing-extensions = ">=3.7.4.3" [package.extras] dotenv = ["python-dotenv (>=0.10.4)"] -typing_extensions = ["typing-extensions (>=3.7.2)"] email = ["email-validator (>=1.0.3)"] [[package]] -name = "pylint" -version = "2.6.0" -description = "python code static checker" category = "dev" +description = "python code static checker" +name = "pylint" optional = false python-versions = ">=3.5.*" +version = "2.6.0" [package.dependencies] astroid = ">=2.4.0,<=2.5" +colorama = "*" +isort = ">=4.2.5,<6" mccabe = ">=0.6,<0.7" -colorama = {version = "*", markers = "sys_platform == \"win32\""} toml = ">=0.7.1" -isort = ">=4.2.5,<6" [[package]] -name = "pyparsing" -version = "2.4.7" -description = "Python parsing module" category = "main" +description = "Python parsing module" +name = "pyparsing" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "2.4.7" [[package]] -name = "pytest" -version = "5.4.3" -description = "pytest: simple powerful testing with Python" category = "dev" +description = "pytest: simple powerful testing with Python" +name = "pytest" optional = false python-versions = ">=3.5" +version = "5.4.3" [package.dependencies] +atomicwrites = ">=1.0" +attrs = ">=17.4.0" +colorama = "*" more-itertools = ">=4.0.0" -py = ">=1.5.0" -wcwidth = "*" packaging = "*" -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -colorama = {version = "*", markers = "sys_platform == \"win32\""} -attrs = ">=17.4.0" pluggy = ">=0.12,<1.0" -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} +py = ">=1.5.0" +wcwidth = "*" + +[package.dependencies.importlib-metadata] +python = "<3.8" +version = ">=0.12" [package.extras] -checkqa-mypy = ["mypy (==v0.761)"] +checkqa-mypy = ["mypy (v0.761)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] -name = "redis" -version = "3.5.3" -description = "Python client for Redis key-value store" category = "main" +description = "Python client for Redis key-value store" +name = "redis" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "3.5.3" [package.extras] hiredis = ["hiredis (>=0.1.3)"] [[package]] -name = "redislite" -version = "5.0.165407" -description = "Redis built into a python package" category = "main" +description = "Redis built into a python package" +name = "redislite" optional = false python-versions = ">=2.7.11" +version = "5.0.165407" [package.dependencies] psutil = "*" redis = "*" +setuptools = ">38.0" [[package]] -name = "requests" -version = "2.25.1" -description = "Python HTTP for Humans." category = "main" +description = "Python HTTP for Humans." +name = "requests" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "2.25.1" [package.dependencies] -idna = ">=2.5,<3" certifi = ">=2017.4.17" chardet = ">=3.0.2,<5" +idna = ">=2.5,<3" urllib3 = ">=1.21.1,<1.27" [package.extras] security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] -socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] +socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] [[package]] -name = "six" -version = "1.15.0" -description = "Python 2 and 3 compatibility utilities" category = "main" +description = "Python 2 and 3 compatibility utilities" +name = "six" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +version = "1.15.0" [[package]] -name = "starlette" -version = "0.13.2" -description = "The little ASGI library that shines." category = "main" +description = "The little ASGI library that shines." +name = "starlette" optional = false python-versions = ">=3.6" +version = "0.13.6" [package.extras] full = ["aiofiles", "graphene", "itsdangerous", "jinja2", "python-multipart", "pyyaml", "requests", "ujson"] [[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" category = "dev" +description = "Python Library for Tom's Obvious, Minimal Language" +name = "toml" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +version = "0.10.2" [[package]] -name = "typed-ast" -version = "1.4.2" -description = "a fork of Python 2 and 3 ast modules with type comment support" category = "dev" +description = "a fork of Python 2 and 3 ast modules with type comment support" +marker = "implementation_name == \"cpython\" and python_version < \"3.8\"" +name = "typed-ast" optional = false python-versions = "*" +version = "1.4.2" [[package]] -name = "typing-extensions" -version = "3.7.4.3" -description = "Backported and Experimental Type Hints for Python 3.5+" category = "main" +description = "Backported and Experimental Type Hints for Python 3.5+" +name = "typing-extensions" optional = false python-versions = "*" +version = "3.7.4.3" [[package]] -name = "urllib3" -version = "1.26.2" -description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" +description = "HTTP library with thread-safe connection pooling, file post, and more." +name = "urllib3" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" +version = "1.26.2" [package.extras] brotli = ["brotlipy (>=0.6.0)"] secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] [[package]] -name = "uvicorn" -version = "0.11.8" -description = "The lightning-fast ASGI server." category = "main" +description = "The lightning-fast ASGI server." +name = "uvicorn" optional = false python-versions = "*" +version = "0.11.8" [package.dependencies] -httptools = {version = ">=0.1.0,<0.2.0", markers = "sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\""} -h11 = ">=0.8,<0.10" click = ">=7.0.0,<8.0.0" +h11 = ">=0.8,<0.10" +httptools = ">=0.1.0,<0.2.0" +uvloop = ">=0.14.0" websockets = ">=8.0.0,<9.0.0" -uvloop = {version = ">=0.14.0", markers = "sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\""} [package.extras] watchgodreload = ["watchgod (>=0.6,<0.7)"] [[package]] -name = "uvloop" -version = "0.14.0" -description = "Fast implementation of asyncio event loop on top of libuv" category = "main" +description = "Fast implementation of asyncio event loop on top of libuv" +marker = "sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"" +name = "uvloop" optional = false python-versions = "*" +version = "0.14.0" [[package]] -name = "wcwidth" -version = "0.2.5" -description = "Measures the displayed width of unicode strings in a terminal" category = "dev" +description = "Measures the displayed width of unicode strings in a terminal" +name = "wcwidth" optional = false python-versions = "*" +version = "0.2.5" [[package]] -name = "websockets" -version = "8.1" -description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" category = "main" +description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" +name = "websockets" optional = false python-versions = ">=3.6.1" +version = "8.1" [[package]] -name = "win32-setctime" -version = "1.0.3" -description = "A small Python utility to set file creation time on Windows" category = "main" +description = "A small Python utility to set file creation time on Windows" +marker = "sys_platform == \"win32\"" +name = "win32-setctime" optional = false python-versions = ">=3.5" +version = "1.0.3" [package.extras] dev = ["pytest (>=4.6.2)", "black (>=19.3b0)"] [[package]] -name = "wrapt" -version = "1.12.1" -description = "Module for decorators, wrappers and monkey patching." category = "dev" +description = "Module for decorators, wrappers and monkey patching." +name = "wrapt" optional = false python-versions = "*" +version = "1.12.1" [[package]] -name = "zipp" -version = "3.4.0" -description = "Backport of pathlib-compatible object wrapper for zip files" category = "main" +description = "Backport of pathlib-compatible object wrapper for zip files" +name = "zipp" optional = false python-versions = ">=3.6" +version = "3.4.0" [package.extras] docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +testing = ["pytest (>=3.5,<3.7.3 || >3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] -lock-version = "1.1" +content-hash = "6274591b4abefbd49ec3d59cfba7d5ad0e0f42918e7e92c204f04835f1025a92" python-versions = "^3.7" -content-hash = "04412f413c55f33ae8efbd59c734c752b54a14c2a652a7323ac017d069a9c362" [metadata.files] aioredis = [ @@ -620,8 +642,8 @@ elastic-apm = [ {file = "elastic_apm-5.10.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:11a1402123c9bd5aee012498ed770be836273e7e7b551ee570142793b370505e"}, ] fastapi = [ - {file = "fastapi-0.55.1-py3-none-any.whl", hash = "sha256:b1a96ea772f10cd0235eb09d6e282b1f5e6135dad5121ed80d6beb8fa932e075"}, - {file = "fastapi-0.55.1.tar.gz", hash = "sha256:912bc1a1b187146fd74dd45e17ea10aede3d962c921142c412458e911c50dc4c"}, + {file = "fastapi-0.63.0-py3-none-any.whl", hash = "sha256:98d8ea9591d8512fdadf255d2a8fa56515cdd8624dca4af369da73727409508e"}, + {file = "fastapi-0.63.0.tar.gz", hash = "sha256:63c4592f5ef3edf30afa9a44fa7c6b7ccb20e0d3f68cd9eba07b44d552058dcb"}, ] gunicorn = [ {file = "gunicorn-20.0.4-py2.py3-none-any.whl", hash = "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"}, @@ -783,28 +805,28 @@ py = [ {file = "py-1.10.0.tar.gz", hash = "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3"}, ] pydantic = [ - {file = "pydantic-1.7.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:c59ea046aea25be14dc22d69c97bee629e6d48d2b2ecb724d7fe8806bf5f61cd"}, - {file = "pydantic-1.7.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a4143c8d0c456a093387b96e0f5ee941a950992904d88bc816b4f0e72c9a0009"}, - {file = "pydantic-1.7.3-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:d8df4b9090b595511906fa48deda47af04e7d092318bfb291f4d45dfb6bb2127"}, - {file = "pydantic-1.7.3-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:514b473d264671a5c672dfb28bdfe1bf1afd390f6b206aa2ec9fed7fc592c48e"}, - {file = "pydantic-1.7.3-cp36-cp36m-win_amd64.whl", hash = "sha256:dba5c1f0a3aeea5083e75db9660935da90216f8a81b6d68e67f54e135ed5eb23"}, - {file = "pydantic-1.7.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:59e45f3b694b05a69032a0d603c32d453a23f0de80844fb14d55ab0c6c78ff2f"}, - {file = "pydantic-1.7.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:5b24e8a572e4b4c18f614004dda8c9f2c07328cb5b6e314d6e1bbd536cb1a6c1"}, - {file = "pydantic-1.7.3-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:b2b054d095b6431cdda2f852a6d2f0fdec77686b305c57961b4c5dd6d863bf3c"}, - {file = "pydantic-1.7.3-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:025bf13ce27990acc059d0c5be46f416fc9b293f45363b3d19855165fee1874f"}, - {file = "pydantic-1.7.3-cp37-cp37m-win_amd64.whl", hash = "sha256:6e3874aa7e8babd37b40c4504e3a94cc2023696ced5a0500949f3347664ff8e2"}, - {file = "pydantic-1.7.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:e682f6442ebe4e50cb5e1cfde7dda6766fb586631c3e5569f6aa1951fd1a76ef"}, - {file = "pydantic-1.7.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:185e18134bec5ef43351149fe34fda4758e53d05bb8ea4d5928f0720997b79ef"}, - {file = "pydantic-1.7.3-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:f5b06f5099e163295b8ff5b1b71132ecf5866cc6e7f586d78d7d3fd6e8084608"}, - {file = "pydantic-1.7.3-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:24ca47365be2a5a3cc3f4a26dcc755bcdc9f0036f55dcedbd55663662ba145ec"}, - {file = "pydantic-1.7.3-cp38-cp38-win_amd64.whl", hash = "sha256:d1fe3f0df8ac0f3a9792666c69a7cd70530f329036426d06b4f899c025aca74e"}, - {file = "pydantic-1.7.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f6864844b039805add62ebe8a8c676286340ba0c6d043ae5dea24114b82a319e"}, - {file = "pydantic-1.7.3-cp39-cp39-manylinux1_i686.whl", hash = "sha256:ecb54491f98544c12c66ff3d15e701612fc388161fd455242447083350904730"}, - {file = "pydantic-1.7.3-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:ffd180ebd5dd2a9ac0da4e8b995c9c99e7c74c31f985ba090ee01d681b1c4b95"}, - {file = "pydantic-1.7.3-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8d72e814c7821125b16f1553124d12faba88e85405b0864328899aceaad7282b"}, - {file = "pydantic-1.7.3-cp39-cp39-win_amd64.whl", hash = "sha256:475f2fa134cf272d6631072554f845d0630907fce053926ff634cc6bc45bf1af"}, - {file = "pydantic-1.7.3-py3-none-any.whl", hash = "sha256:38be427ea01a78206bcaf9a56f835784afcba9e5b88fbdce33bbbfbcd7841229"}, - {file = "pydantic-1.7.3.tar.gz", hash = "sha256:213125b7e9e64713d16d988d10997dabc6a1f73f3991e1ff8e35ebb1409c7dc9"}, + {file = "pydantic-1.8.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:0c40162796fc8d0aa744875b60e4dc36834db9f2a25dbf9ba9664b1915a23850"}, + {file = "pydantic-1.8.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:fff29fe54ec419338c522b908154a2efabeee4f483e48990f87e189661f31ce3"}, + {file = "pydantic-1.8.1-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:fbfb608febde1afd4743c6822c19060a8dbdd3eb30f98e36061ba4973308059e"}, + {file = "pydantic-1.8.1-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:eb8ccf12295113ce0de38f80b25f736d62f0a8d87c6b88aca645f168f9c78771"}, + {file = "pydantic-1.8.1-cp36-cp36m-win_amd64.whl", hash = "sha256:20d42f1be7c7acc352b3d09b0cf505a9fab9deb93125061b376fbe1f06a5459f"}, + {file = "pydantic-1.8.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dde4ca368e82791de97c2ec019681ffb437728090c0ff0c3852708cf923e0c7d"}, + {file = "pydantic-1.8.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:3bbd023c981cbe26e6e21c8d2ce78485f85c2e77f7bab5ec15b7d2a1f491918f"}, + {file = "pydantic-1.8.1-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:830ef1a148012b640186bf4d9789a206c56071ff38f2460a32ae67ca21880eb8"}, + {file = "pydantic-1.8.1-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:fb77f7a7e111db1832ae3f8f44203691e15b1fa7e5a1cb9691d4e2659aee41c4"}, + {file = "pydantic-1.8.1-cp37-cp37m-win_amd64.whl", hash = "sha256:3bcb9d7e1f9849a6bdbd027aabb3a06414abd6068cb3b21c49427956cce5038a"}, + {file = "pydantic-1.8.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2287ebff0018eec3cc69b1d09d4b7cebf277726fa1bd96b45806283c1d808683"}, + {file = "pydantic-1.8.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:4bbc47cf7925c86a345d03b07086696ed916c7663cb76aa409edaa54546e53e2"}, + {file = "pydantic-1.8.1-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:6388ef4ef1435364c8cc9a8192238aed030595e873d8462447ccef2e17387125"}, + {file = "pydantic-1.8.1-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:dd4888b300769ecec194ca8f2699415f5f7760365ddbe243d4fd6581485fa5f0"}, + {file = "pydantic-1.8.1-cp38-cp38-win_amd64.whl", hash = "sha256:8fbb677e4e89c8ab3d450df7b1d9caed23f254072e8597c33279460eeae59b99"}, + {file = "pydantic-1.8.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2f2736d9a996b976cfdfe52455ad27462308c9d3d0ae21a2aa8b4cd1a78f47b9"}, + {file = "pydantic-1.8.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:3114d74329873af0a0e8004627f5389f3bb27f956b965ddd3e355fe984a1789c"}, + {file = "pydantic-1.8.1-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:258576f2d997ee4573469633592e8b99aa13bda182fcc28e875f866016c8e07e"}, + {file = "pydantic-1.8.1-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:c17a0b35c854049e67c68b48d55e026c84f35593c66d69b278b8b49e2484346f"}, + {file = "pydantic-1.8.1-cp39-cp39-win_amd64.whl", hash = "sha256:e8bc082afef97c5fd3903d05c6f7bb3a6af9fc18631b4cc9fedeb4720efb0c58"}, + {file = "pydantic-1.8.1-py3-none-any.whl", hash = "sha256:e3f8790c47ac42549dc8b045a67b0ca371c7f66e73040d0197ce6172b385e520"}, + {file = "pydantic-1.8.1.tar.gz", hash = "sha256:26cf3cb2e68ec6c0cfcb6293e69fb3450c5fd1ace87f46b64f678b0d29eac4c3"}, ] pylint = [ {file = "pylint-2.6.0-py3-none-any.whl", hash = "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f"}, @@ -852,8 +874,8 @@ six = [ {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, ] starlette = [ - {file = "starlette-0.13.2-py3-none-any.whl", hash = "sha256:6169ee78ded501095d1dda7b141a1dc9f9934d37ad23196e180150ace2c6449b"}, - {file = "starlette-0.13.2.tar.gz", hash = "sha256:a9bb130fa7aa736eda8a814b6ceb85ccf7a209ed53843d0d61e246b380afa10f"}, + {file = "starlette-0.13.6-py3-none-any.whl", hash = "sha256:bd2ffe5e37fb75d014728511f8e68ebf2c80b0fa3d04ca1479f4dc752ae31ac9"}, + {file = "starlette-0.13.6.tar.gz", hash = "sha256:ebe8ee08d9be96a3c9f31b2cb2a24dbdf845247b745664bd8a3f9bd0c977fdbc"}, ] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, diff --git a/stackl/core/pyproject.toml b/stackl/core/pyproject.toml index f68db857..c4b57f58 100644 --- a/stackl/core/pyproject.toml +++ b/stackl/core/pyproject.toml @@ -12,7 +12,7 @@ attr = "^0.3.1" attrs = "^19.3.0" six = "^1.15.0" pyparsing = "^2.4.7" -fastapi = "^0.55.1" +fastapi = "0.63.0" gunicorn = "^20.0.4" uvicorn = "^0.11.5" loguru = "^0.5.1"