aws-cloudformation / cloudformation-cli-python-plugin

The CloudFormation Provider Development Toolkit Python Plugin allows you to autogenerate Python code based on an input schema.
Apache License 2.0
108 stars 47 forks source link

Libraries conflict with cli_python_lib #81

Closed iann0036 closed 4 years ago

iann0036 commented 4 years ago

Probably not fixable but raising anyway...

In my handlers I used import uuid in order to do myuniqueid = str(uuid.uuid4()).

This resulted in the following error during runtime:

Traceback (most recent call last):
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 218, in __call__
    event, progress, context, platform_sess
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 106, in schedule_reinvocation
    handler_request=handler_request,
  File "/var/task/cloudformation_cli_python_lib/scheduler.py", line 31, in reschedule_after_minutes
    self.client.put_rule(Name=rule_name, ScheduleExpression=cron, State="ENABLED")
  File "/var/task/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/task/botocore/client.py", line 626, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutRule operation: Parameter ScheduleExpression is not valid.

The problem here is that scheduler.py does from uuid import uuid4 so my import is then overwriting and destroying that, which breaks the rule name for the scheduler.

ammokhov commented 4 years ago

Probably not fixable but raising anyway...

In my handlers I used import uuid in order to do myuniqueid = str(uuid.uuid4()).

This resulted in the following error during runtime:

Traceback (most recent call last):
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 218, in __call__
    event, progress, context, platform_sess
  File "/var/task/cloudformation_cli_python_lib/resource.py", line 106, in schedule_reinvocation
    handler_request=handler_request,
  File "/var/task/cloudformation_cli_python_lib/scheduler.py", line 31, in reschedule_after_minutes
    self.client.put_rule(Name=rule_name, ScheduleExpression=cron, State="ENABLED")
  File "/var/task/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/task/botocore/client.py", line 626, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutRule operation: Parameter ScheduleExpression is not valid.

The problem here is that scheduler.py does from uuid import uuid4 so my import is then overwriting and destroying that, which breaks the rule name for the scheduler.

closing it since scheduler has been deprecated by #101