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
Added ability to specify plan information for images that require it. #65335
Conversation
@seanw122, just so you are aware we have a dedicated Working Group for azure. |
lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
Outdated
Show resolved
Hide resolved
lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
Outdated
Show resolved
Hide resolved
lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
Outdated
Show resolved
Hide resolved
# Before creating VM accept terms of plan if `accept_terms` is True | ||
if self.accept_terms is True: | ||
if not self.plan or not all([self.plan.get('name'), self.plan.get('product'), self.plan.get('publisher')]): | ||
self.fail("parameter error: plan must be specified and include name, product, and publisher") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use required_if
to make sure that plan
must be specified if accept_terms
is True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be the other way around. If a plan is specified then accept_terms must be True. I left it in for now until I learn the syntax for required_if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your logic from the code above is: if accept_terms
is True
, plan
must be specified. (That can also be modelled by required_if
.) If you want the logic the other way around, you have to change your code (and you can't use required_if
AFAIK).
changelogs/fragments/65335-add-plan-to-azure-vmscaleset-module.yaml
Outdated
Show resolved
Hide resolved
review_need |
@seanw122 this PR contains the following merge commits: Please rebase your branch to remove these commits. |
… plan since suboptions were added.
….yaml Co-Authored-By: Felix Fontein <felix@fontein.de>
The test
The test
|
The test
|
In fairness, this is a feature change and not a bug. I don't know how to remove bug tag. |
@seanw122 you can simply edit the PR message and change |
Hmm. Well it added |
Thanks @felixfontein ! |
@gavinfish Can you review this and I think this should also be contributed to the collection as well. |
ready_for_review |
@seanw122 I'll invite one of the committer to review your PR, and handle it as soon as possible. Thanks for contributing to ansible azure module. |
@haiyuazhang I removed the property and related code for accepting terms. |
SUMMARY
Added ability to specify billing plan information for images that require it. Images like CIS hardened images on Azure marketplace require plan field to be populated.
Fixes #65268
ISSUE TYPE
COMPONENT NAME
azure_rm_virtualmachinescaleset
ADDITIONAL INFORMATION
Tests were done locally that:
The module azure_rm_virtualmachinescaleset handles plan information. Based on how plan and accept_terms was used I copied:
and
added an example in the examples section.