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

Test uploaded images with a non-admin user #5

Open
wants to merge 2 commits into
base: feature/cah
Choose a base branch
from

Conversation

tobfisch
Copy link
Owner

No description provided.

@tobfisch tobfisch self-assigned this Jul 12, 2021
src/manage.py Outdated
Comment on lines 84 to 85
port_range_min = port_range[0]
port_range_max = port_range[-1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use tuple unpacking here (port_range_min, port_range_max = port_range). This variant behaves better if the length of the list deviates.

src/manage.py Outdated
def create_security_group(conn, security_group_name, port_range, protocol):
security_group = conn.create_security_group(name=security_group_name,
description="sg for login into a test instance")
if type(port_range) == list:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Don't use type(x) == A (except in the most special cases when working with metaclasses and the likes). Use isinstance(x, A) – this ensures that subclasses are accepted as well.

  • I think restricting it to lists is too strict, tuples should be allowed too. The best check would probably be something like isinstance(port_range, collections.abc.Sequence).

  • A third (perhaps the best) option would be to remove the functionality of passing in a port range, since it is not used anyway.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the functionality for now, as it is not used at the time.

@tobfisch tobfisch force-pushed the feature/test_with_nonadmin_user branch from e5c0075 to 0f5a6d2 Compare July 14, 2021 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants