Skip to content

Commit

Permalink
vsphere_copy: fix the E309 error (ansible#56537)
Browse files Browse the repository at this point in the history
Resolve the two following errors:

ERROR: lib/ansible/modules/cloud/vmware/vsphere_copy.py:0:0: E309 version_added for new option (host) should be '2.9'. Currently None
ERROR: lib/ansible/modules/cloud/vmware/vsphere_copy.py:0:0: E309 version_added for new option (login) should be '2.9'. Currently None
  • Loading branch information
goneri authored and mattclay committed May 16, 2019
1 parent 867e357 commit 32620b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
26 changes: 8 additions & 18 deletions lib/ansible/modules/cloud/vmware/vsphere_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,12 @@
options:
hostname:
version_added: "2.9"
aliases: ['host']
port:
version_added: "2.9"
username:
version_added: "2.9"
host:
description:
- Use C(hostname) instead like the other VMware modules.
- The vCenter or ESXi server on which the datastore is available.
- This option is deprecated and will eventually be removed in 2.12.
aliases: ['hostname']
login:
description:
- Use C(username) instead like the other VMware modules.
- The login name to authenticate on the vCenter or ESXi server.
- This option is deprecated and will eventually be removed in 2.12.
aliases: ['username']
aliases: ['login']
src:
description:
- The file to push to vCenter.
Expand Down Expand Up @@ -143,8 +133,8 @@ def vmware_path(datastore, datacenter, path):
def main():
argument_spec = vmware_argument_spec()
argument_spec.update(dict(
host=dict(required=False, removedin_version='2.12'),
login=dict(required=False, removedin_version='2.12'),
hostname=dict(required=False, aliases=['host']),
username=dict(required=False, aliases=['login']),
src=dict(required=True, aliases=['name']),
datacenter=dict(required=False),
datastore=dict(required=True),
Expand All @@ -158,13 +148,13 @@ def main():
supports_check_mode=False,
)

if module.params['host'] is not None:
if module.params.get('host'):
module.deprecate("The 'host' option is being replaced by 'hostname'", version='2.12')
if module.params['login'] is not None:
if module.params.get('login'):
module.deprecate("The 'login' option is being replaced by 'username'", version='2.12')

hostname = module.params['hostname'] or module.params['host']
username = module.params['username'] or module.params['login']
hostname = module.params['hostname']
username = module.params['username']
password = module.params.get('password')
src = module.params.get('src')
datacenter = module.params.get('datacenter')
Expand Down
1 change: 0 additions & 1 deletion test/sanity/validate-modules/ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ lib/ansible/modules/cloud/vmware/vca_vapp.py E322
lib/ansible/modules/cloud/vmware/vca_vapp.py E324
lib/ansible/modules/cloud/vmware/vmware_guest.py E322
lib/ansible/modules/cloud/vmware/vsphere_copy.py E322
lib/ansible/modules/cloud/vmware/vsphere_copy.py E309
lib/ansible/modules/clustering/consul.py E322
lib/ansible/modules/clustering/consul_session.py E322
lib/ansible/modules/clustering/etcd3.py E326
Expand Down

0 comments on commit 32620b7

Please sign in to comment.