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

VMware: fix to create vm using a customization spec with an ip address #61329

Open
wants to merge 3 commits into
base: devel
from

Conversation

@AndrewCi
Copy link

commented Aug 26, 2019

SUMMARY

In vSphere you can configure a customization spec to accept user input upon VM creation. One of the most common configuration is to allow a user to specify an IP address upon VM creation using a customization spec. The orignal vmware_guest module did not account for this functionality. My fix allows for one NIC to be used as an input with a customization spec.

Fixes issue number #55560

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request
COMPONENT NAME

vmware_guest
vmware_guest_customization_facts

ADDITIONAL INFORMATION

@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

@AndrewCi, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

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

lib/ansible/modules/cloud/vmware/vmware_guest.py:1560:40: bad-whitespace Exactly one space required around assignment                     spec_adapter_counter+=1                                         ^^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:179:33: bad-whitespace Exactly one space required around assignment                     computer_name=None
                                  ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:181:33: bad-whitespace Exactly one space required around assignment                     computer_name=current_spec.spec.identity.userData.computerName
                                  ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:182: bad-whitespace Exactly one space required after comma                     guiUnattended={'autoLogon': guiunattended_.autoLogon, 'autoLogonCount': guiunattended_.autoLogonCount, 'password': {'plainText': guiunattended_.password.plainText,'value': guiunattended_.password.value}, 'timeZone': guiunattended_.timeZone},
                                                                                                                                                                                       ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:59: bad-whitespace Exactly one space required after comma                     userData={'computerName': computer_name,'fullName': userdata_.fullName,'orgName': userdata_.orgName,'productId': userdata_.productId},
                                                            ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:90: bad-whitespace Exactly one space required after comma                     userData={'computerName': computer_name,'fullName': userdata_.fullName,'orgName': userdata_.orgName,'productId': userdata_.productId},
                                                                                           ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:119: bad-whitespace Exactly one space required after comma                     userData={'computerName': computer_name,'fullName': userdata_.fullName,'orgName': userdata_.orgName,'productId': userdata_.productId},
                                                                                                                        ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:221:0: trailing-whitespace Trailing whitespace
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:243:0: missing-final-newline Final newline missing

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:7:1: SyntaxError:

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

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:0:0: use "\n" for line endings instead of "\r\n"

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

lib/ansible/modules/cloud/vmware/vmware_guest.py:1554:161: E501 line too long (164 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest.py:1560:41: E225 missing whitespace around operator
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:179:34: E225 missing whitespace around operator
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:181:34: E225 missing whitespace around operator
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:161: E501 line too long (261 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:183: E231 missing whitespace after ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:196:161: E501 line too long (230 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:60: E231 missing whitespace after ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:91: E231 missing whitespace after ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:198:120: E231 missing whitespace after ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:221:1: W293 blank line contains whitespace
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:243:11: W292 no newline at end of file

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

lib/ansible/modules/cloud/vmware/vmware_guest.py:0:0: module should not be executable
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:0:0: module should not be executable

click here for bot help

@goneri

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Hi Andrew, thanks for the PR.

Your patch seems to include a lot of unrelated changes (e.g VMware renamed back to VMWare in the module documentation), could you please clean this up?
See: https://github.com/ansible/ansible/pull/61329/files

Also, you change lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py privilege from 100644 to 100755. This is not necessary and as a result.

@ansibot ansibot removed the needs_triage label Aug 26, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

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

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:182: bad-whitespace Exactly one space required after comma                     guiUnattended={'autoLogon': guiunattended_.autoLogon, 'autoLogonCount': guiunattended_.autoLogonCount, 'password': {'plainText': guiunattended_.password.plainText,'value': guiunattended_.password.value} , 'timeZone': guiunattended_.timeZone},
                                                                                                                                                                                       ^
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:223: bad-whitespace No space allowed before comma                     guiUnattended={'autoLogon': guiunattended_.autoLogon, 'autoLogonCount': guiunattended_.autoLogonCount, 'password': {'plainText': guiunattended_.password.plainText,'value': guiunattended_.password.value} , 'timeZone': guiunattended_.timeZone},
                                                                                                                                                                                                                                ^

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:7:1: SyntaxError:

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

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:0:0: use "\n" for line endings instead of "\r\n"

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

lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:161: E501 line too long (262 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:183: E231 missing whitespace after ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:195:223: E203 whitespace before ','
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:196:161: E501 line too long (230 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:223:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/cloud/vmware/vmware_guest_customization_facts.py:239:1: E305 expected 2 blank lines after class or function definition, found 1

click here for bot help

@Akasurde

This comment has been minimized.

Copy link
Member

commented Sep 4, 2019

@AndrewCi Could you please rebase this branch ? Thanks.

needs_info

@ansibot ansibot added the needs_info label Sep 4, 2019

@Akasurde Akasurde changed the title fix to create vm using a customization spec with an ip address as an … VMware: fix to create vm using a customization spec with an ip address Sep 4, 2019

@Akasurde
Copy link
Member

left a comment

@AndrewCi Thanks for the PR. Could you please add a test for this change ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.