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

support only setting some parameters on first create #168

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

awick
Copy link
Contributor

@awick awick commented Apr 11, 2024

Description

Support cluster-create only having some arguments set. Previously if any of the arguments weren't set, the defaults were used for everything. This makes it so the defaults are only used for what isn't set.

Testing

Tried with different parameters used and make sure the defaults weren't used for those provided.

License

I confirm that this contribution is made under an Apache 2.0 license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@awick awick merged commit c23499d into main Apr 12, 2024
5 checks passed
@awick awick deleted the create-only-some-params branch April 12, 2024 13:53
Comment on lines +19 to +32
if (expectedTraffic is None):
expectedTraffic = MINIMUM_TRAFFIC

if (spiDays is None):
spiDays = DEFAULT_SPI_DAYS

if (historyDays is None):
historyDays = DEFAULT_HISTORY_DAYS

if (replicas is None):
replicas = DEFAULT_REPLICAS

if (pcapDays is None):
pcapDays = DEFAULT_S3_STORAGE_DAYS
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommend not changing the values of the arguments themselves; Python is pass-by-reference so this should change the value of the variable in the outside scope that you're invoking the constructor from. A better way would be to just set the self.* members based on the conditional instead. That will prevent "surprises" from the caller's perspective.

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.

3 participants