Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deadline): fix type assumption in configure_identity_registration_settings.py error handling #612

Merged

Conversation

jusiskin
Copy link
Contributor

@jusiskin jusiskin commented Oct 18, 2021

Problem

In #604, we added error-handling when the Deadline version supplied to the RenderQueue did not include the required Deadline commands to manage Deadline identity registration settings.

This error handling introduced a regression since in the happy path, the JSON serialization returns a python list and not a dict. When a compatible Deadline version is supplied, the following error was emitted in the /renderfarm/ConfigureRepository CloudWatch log group:

Traceback (most recent call last):
  File "/home/ec2-user/configure_identity_registration_settings.py", line 618, in <module>
    __main__(*sys.argv[1:])
  File "/home/ec2-user/configure_identity_registration_settings.py", line 613, in __main__
    apply_registration_settings(config)
  File "/home/ec2-user/configure_identity_registration_settings.py", line 594, in apply_registration_settings
    prior_rfdk_settings = get_rfdk_registration_settings(dl_secrets)
  File "/home/ec2-user/configure_identity_registration_settings.py", line 388, in get_rfdk_registration_settings
    for registration_setting in dl_secrets.run_json('GetLoadBalancerIdentityRegistrationSettings')
  File "/home/ec2-user/configure_identity_registration_settings.py", line 303, in run_json
    if 'ok' in result.keys():
AttributeError: 'list' object has no attribute 'keys'

Solution

A type-check was added to first check if the resulting object is a dict before checking its keys.

Testing

Deployed the All-In-AWS-Infrastructure-Basic TypeScript example app with both code paths:

  • A supported Deadline version (includes Deadline secrets management identity registration settings commands)
  • An unsupported Deadline version (does not include Deadline secrets management identity registration settings commands)

Happy Case

In the happy case, the deployment succeeds and identity registration settings are created successfully.

Unsupported Deadline Client Case

In the case where the Deadline version does not support the correct commands, the python script catches the error and fails the deployment. In the CloudWatch log group, the following is shown:

Traceback (most recent call last):
  File "/home/ec2-user/configure_identity_registration_settings.py", line 618, in <module>
    __main__(*sys.argv[1:])
  File "/home/ec2-user/configure_identity_registration_settings.py", line 613, in __main__
    apply_registration_settings(config)
  File "/home/ec2-user/configure_identity_registration_settings.py", line 594, in apply_registration_settings
    prior_rfdk_settings = get_rfdk_registration_settings(dl_secrets)
  File "/home/ec2-user/configure_identity_registration_settings.py", line 388, in get_rfdk_registration_settings
    for registration_setting in dl_secrets.run_json('GetLoadBalancerIdentityRegistrationSettings')
  File "/home/ec2-user/configure_identity_registration_settings.py", line 305, in run_json
    raise ValueError('DeadlineCommandError: \n%s' % (result))
ValueError: DeadlineCommandError:
{'ok': False, 'result': 'Error: [SecretsManagement] Command is not supported. (GetLoadBalancerIdentityRegistrationSettings)'}

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@jusiskin jusiskin added bug This issue is a bug. contribution/core This is a PR that came from AWS. labels Oct 18, 2021
@jusiskin jusiskin marked this pull request as ready for review October 18, 2021 18:05
@horsmand horsmand merged commit 7420f3c into aws:mainline Oct 18, 2021
@jusiskin jusiskin deleted the fix_identity_registration_error_handling branch October 18, 2021 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants