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

Fixes some NIC problems: create without nsg, support loadbalancer #38643

Merged
merged 32 commits into from
May 24, 2018

Conversation

yuwzho
Copy link
Contributor

@yuwzho yuwzho commented Apr 12, 2018

SUMMARY

Fixes #37917
Fixes #37734

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

azure_rm_networkinterface

ANSIBLE VERSION
2.5.0
ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

@ansibot ansibot added azure cloud core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:certified This issue/PR relates to certified code. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests. labels Apr 12, 2018
@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:449:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:487:0: trailing-whitespace Trailing whitespace

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:169:27: W291 trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:283:54: W291 trailing whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:325:114: E502 the backslash is redundant between brackets
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:326:50: E131 continuation line unaligned for hanging indent
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:449:1: W293 blank line contains whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:487:1: W293 blank line contains whitespace
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:547:139: E502 the backslash is redundant between brackets
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:548:130: E502 the backslash is redundant between brackets
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:549:62: E131 continuation line unaligned for hanging indent
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:645:48: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:645:50: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:645:98: E502 the backslash is redundant between brackets
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:646:112: E502 the backslash is redundant between brackets

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:0:0: E325 argument_spec for "has_security_group" defines type="bool" but documentation does not
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:626:0: E403 Type comparison using type() found. Use isinstance() instead

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 core_review In order to be merged, this PR must follow the core review workflow. labels Apr 12, 2018
@jborean93 jborean93 self-requested a review April 12, 2018 04:15
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Apr 12, 2018
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Apr 12, 2018
@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:326:51: E127 continuation line over-indented for visual indent
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:549:63: E127 continuation line over-indented for visual indent
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:645:48: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:645:50: E251 unexpected spaces around keyword / parameter equals

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:0:0: E325 argument_spec for "has_security_group" defines type="bool" but documentation does not
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:626:0: E403 Type comparison using type() found. Use isinstance() instead

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Apr 12, 2018

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

lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:647:52: E128 continuation line under-indented for visual indent
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py:648:52: E127 continuation line over-indented for visual indent

click here for bot help

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Apr 12, 2018
@yuwzho
Copy link
Contributor Author

yuwzho commented Apr 16, 2018

Try this PR's change by installing ansible role via git

ansible-galaxy install git+https://github.com/Azure/azure_preview_modules.git,nic

Try the PR by install devel branch pip install git+https://github.com/ansible/ansible.git@devel

@spmp
Copy link
Contributor

spmp commented Apr 20, 2018

How long before we can expect this PR to be merged please?

@yuwzho yuwzho changed the title Fixes some NIC problems: ignore nsg name, create without nsg, support loadbalancer Fixes some NIC problems: create without nsg, support loadbalancer Apr 25, 2018
@ansibot
Copy link
Contributor

ansibot commented Apr 25, 2018

@yuwzho this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot removed core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 25, 2018
@yuwzho yuwzho closed this May 8, 2018
@yuwzho yuwzho reopened this May 8, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 8, 2018
@spmp
Copy link
Contributor

spmp commented May 10, 2018

What is the ETA of the merge please?

@@ -52,25 +52,22 @@
- Valid azure location. Defaults to location of the resource group.
default: resource_group location
required: false
virtual_network_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.

will it cause existing user using this parameter break by delete? how about keep as alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this would have been new added in 2.6, current user is using devel version, I think we can have this 'breaking change' in devel version

Copy link
Contributor

Choose a reason for hiding this comment

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

is it necessary to introduce the break? I would suggest to keep virtual_network_resource_group. If remove this argument, user will not able to create a NIC with vnet in another resource group.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an agreement we reached in a sync up meeting. Refer resource in other resource group support 3 methods:

  • accept resource name, and the resource is in the same resource group
  • accept a resource id
  • accept a sub dict, which contains resource group and name

Here I remove this option to support the 3 methods. Since this option's version_added is 2.6. That means no user is using this option because this hasn't been released.

Copy link
Contributor

Choose a reason for hiding this comment

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

The aliases section means both virtual_network or virtual_network_name can be used when specifying this option. The name change is to bring it more in line with other modules, plus now it can take a dict with more than just the name

primary:
description:
- Whether the ip configuration is the primary one in the list.
type: bool
default: 'no'
version_added: 2.5
security_group_name:
create_with_security_group:
Copy link
Contributor

Choose a reason for hiding this comment

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

about this paramter, if no security_group specified, then a deault one should be created. it seems redundant to have a parameter to control the behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, but we cannot break current behavior: no nsg specified, create a default one

Copy link
Contributor

Choose a reason for hiding this comment

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

does that mean there's scenario to create a nic without nsg? interesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, support user create a NIC without NSG. default behavior is create a default NSG and attach to NIC

@@ -349,6 +374,7 @@ def nic_to_dict(nic):
private_ip_allocation_method=dict(type='str', choices=['Dynamic', 'Static'], default='Dynamic'),
public_ip_address_name=dict(type='str', aliases=['public_ip_address', 'public_ip_name']),
public_ip_allocation_method=dict(type='str', choices=['Dynamic', 'Static'], default='Dynamic'),
load_balancer_backend_address_pools=dict(type='list'),
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, isn't this a config in load balancer, why add in azure_network_interface module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in loadbalancer SDK, it simply ignore this param. And this API is exposed in NIC.

Copy link

Choose a reason for hiding this comment

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

I suppose that before the receiving NIC has been created it doesn't make sense to add it to a load balancer. Reduces risk of faulty config atleast.

@yuwzho
Copy link
Contributor Author

yuwzho commented May 11, 2018

ready_for_review

1 similar comment
@yuwzho
Copy link
Contributor Author

yuwzho commented May 15, 2018

ready_for_review

@kyliel
Copy link
Contributor

kyliel commented May 21, 2018

@yungez and @zikalino , since this is bug fix, could you please review it first? Thanks.

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels May 21, 2018
@@ -52,25 +52,22 @@
- Valid azure location. Defaults to location of the resource group.
default: resource_group location
required: false
virtual_network_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.

is it necessary to introduce the break? I would suggest to keep virtual_network_resource_group. If remove this argument, user will not able to create a NIC with vnet in another resource group.

security_group: testnic001
security_group:
name: testnic002
resource_group: "{{ resource_group_secondary }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

update one to test id?

primary:
description:
- Whether the ip configuration is the primary one in the list.
type: bool
default: 'no'
version_added: 2.5
security_group_name:
create_with_security_group:
Copy link
Contributor

Choose a reason for hiding this comment

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

does that mean there's scenario to create a nic without nsg? interesting

@ansibot ansibot removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels May 24, 2018
@@ -52,25 +52,22 @@
- Valid azure location. Defaults to location of the resource group.
default: resource_group location
required: false
virtual_network_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 aliases section means both virtual_network or virtual_network_name can be used when specifying this option. The name change is to bring it more in line with other modules, plus now it can take a dict with more than just the name

@zwindler
Copy link
Contributor

zwindler commented Jun 1, 2018

Many thanks for these features!

gothicx pushed a commit to gothicx/ansible that referenced this pull request Jun 9, 2018
…sible#38643)

* add loadbalancer

* dict check nullable

* add default vallue when get list

* create backend addr pool

* fix the set

* fix to dict

* fix ideponement

* use param security group name when create

* nic can has no nsg

* add test

* fix

* fix

* fix

* add document

* add configuration

* fix

* fix

* remove all resources

* fix

* fix test

* add version added

* fix lint

* fix lint

* Fixes some NIC bugs (ansible#39213)

* add loadbalancer

* dict check nullable

* add default vallue when get list

* create backend addr pool

* fix the set

* fix to dict

* fix ideponement

* use param security group name when create

* nic can has no nsg

* add test

* fix

* fix

* fix

* fix idemponet

* add document

* fix test

* add configuration

* fix

* fix

* remove all resources

* fix

* fix test

* add version added

* fix lint

* fix lint

* fix lint

* remove new feature and only submit bugfix

* remove useless test

* fix

* fix indent

* Update azure_rm_networkinterface.py

* fix comment

* support 3 types to specific name and resource group

* avoid test racing

* fix test

* add sample

* add resource id test
jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
…sible#38643)

* add loadbalancer

* dict check nullable

* add default vallue when get list

* create backend addr pool

* fix the set

* fix to dict

* fix ideponement

* use param security group name when create

* nic can has no nsg

* add test

* fix

* fix

* fix

* add document

* add configuration

* fix

* fix

* remove all resources

* fix

* fix test

* add version added

* fix lint

* fix lint

* Fixes some NIC bugs (ansible#39213)

* add loadbalancer

* dict check nullable

* add default vallue when get list

* create backend addr pool

* fix the set

* fix to dict

* fix ideponement

* use param security group name when create

* nic can has no nsg

* add test

* fix

* fix

* fix

* fix idemponet

* add document

* fix test

* add configuration

* fix

* fix

* remove all resources

* fix

* fix test

* add version added

* fix lint

* fix lint

* fix lint

* remove new feature and only submit bugfix

* remove useless test

* fix

* fix indent

* Update azure_rm_networkinterface.py

* fix comment

* support 3 types to specific name and resource group

* avoid test racing

* fix test

* add sample

* add resource id test
@ansible ansible locked and limited conversation to collaborators May 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 azure cloud core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. support:certified This issue/PR relates to certified code. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
10 participants