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

adding possibility to specify resource group for referred virtual net… #36768

Merged
merged 7 commits into from Mar 22, 2018

Conversation

zikalino
Copy link
Contributor

…work

SUMMARY

Fixes #36624

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

azure_rm_networkinterface

ANSIBLE VERSION

2.4

ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2018

@ansibot ansibot added azure bugfix_pull_request cloud committer_review In order to be merged, this PR must follow the certified review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. owner_pr This PR is made by the module's maintainer. support:certified This issue/PR relates to certified code. labels Feb 27, 2018
@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2018

The test ansible-test sanity --test pylint [explain] failed with 2 errors:

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:376:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:397:0: trailing-whitespace Trailing whitespace

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:57:77: W291 trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:376:61: W291 trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:397:51: W291 trailing whitespace

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:0:0: E309 version_added for new option (virtual_network_resource_group) should be 2.6. Currently 0.0

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed committer_review In order to be merged, this PR must follow the certified review workflow. owner_pr This PR is made by the module's maintainer. ci_verified Changes made in this PR are causing tests to fail. labels Feb 27, 2018
@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2018

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:58:27: W291 trailing whitespace

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. committer_review In order to be merged, this PR must follow the certified review workflow. owner_pr This PR is made by the module's maintainer. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 27, 2018
@@ -425,7 +432,10 @@ def exec_module(self, **kwargs):
# parse the virtual network resource group and name
virtual_network_dict = parse_resource_id(self.virtual_network_name)
virtual_network_name = virtual_network_dict.get('name')
virtual_network_resource_group = virtual_network_dict.get('resource_group', self.resource_group)
Copy link
Contributor

Choose a reason for hiding this comment

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

The origin logic is

dict = parse_virtual_network_id()
virtual_network_resource_group = dict[resource_group] || self.resource_group

And now it is changed to

dict = parse_virtual_network_id()
virtual_network_resource_group = dict[resource_group] || self.virtual_network_resource_group || self.resource_group

I wonder why this extra logic is needed? Parsing id shares the same behavior like Azure-CLI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dict[resource_group] will work if user specifies entire path/id of virtual_network, but if they want to specify virtual_network from another resource group, specifying virtual_network_resource_group will be simplified way to do this.
This pattern is also implemented in azure_rm_virtualmachine.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is okay, here I would like to make the precedence more clearly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the documentation should be clearer around the precedence, i.e. virtual_network_resource_group overrides resource_group and so on.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Feb 28, 2018
@zikalino
Copy link
Contributor Author

ready_for_review

Copy link
Contributor

@jborean93 jborean93 left a comment

Choose a reason for hiding this comment

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

Just a minor nitpick around documentation and making the precedence clearer. I would also like to see a test to cover this feature to ensure no regressions occur in the future.

@@ -425,7 +432,10 @@ def exec_module(self, **kwargs):
# parse the virtual network resource group and name
virtual_network_dict = parse_resource_id(self.virtual_network_name)
virtual_network_name = virtual_network_dict.get('name')
virtual_network_resource_group = virtual_network_dict.get('resource_group', self.resource_group)
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the documentation should be clearer around the precedence, i.e. virtual_network_resource_group overrides resource_group and so on.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 7, 2018
@ansibot ansibot added the committer_review In order to be merged, this PR must follow the certified review workflow. label Mar 13, 2018
@jborean93 jborean93 self-requested a review March 15, 2018 00:13
@kyliel
Copy link
Contributor

kyliel commented Mar 15, 2018

@jborean93 , could you please review this change and see whether it is ok to move forward for PR merge? It also passed the test of the submitter @ingokofler. Thank you.

@jborean93
Copy link
Contributor

@zikalino sorry it seems like it has some branch conflicts, are you able to fix them up and I'll get onto the review straight away.

@zikalino
Copy link
Contributor Author

@jborean93 -- resolved

@ansibot
Copy link
Contributor

ansibot commented Mar 21, 2018

@zikalino this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed committer_review In order to be merged, this PR must follow the certified review workflow. labels Mar 21, 2018
@zikalino
Copy link
Contributor Author

oh no... GitHub created merge commit :-(

@zikalino zikalino force-pushed the virtual-network-resource-group branch from aa412d9 to f45def1 Compare March 21, 2018 07:05
@zikalino
Copy link
Contributor Author

ok, now should be rebased

@ansibot ansibot added committer_review In order to be merged, this PR must follow the certified review workflow. and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Mar 21, 2018
@jborean93
Copy link
Contributor

rebuild_merge

@zikalino
Copy link
Contributor Author

@jborean93 seems like this one is not merged automatically either....

@jborean93 jborean93 merged commit fef5f01 into ansible:devel Mar 22, 2018
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
azure bug This issue/PR relates to a bug. cloud committer_review In order to be merged, this PR must follow the certified review workflow. module This issue/PR relates to a module. support:certified This issue/PR relates to certified code. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase Azure network interface provisioning flexibility
5 participants