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_cfg_backup hostname fix #38721

Merged
merged 1 commit into from
Apr 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/ansible/modules/cloud/vmware/vmware_cfg_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
options:
esxi_hostname:
description:
- Name of ESXi server.
- Name of ESXi server. This is required only if authentication against a vCenter is done.
required: False
dest:
description:
Expand All @@ -51,17 +51,17 @@
'''

EXAMPLES = '''
# save the ESXi configuration locally
# save the ESXi configuration locally by authenticating directly against the ESXi host
- name: ESXI backup test
local_action:
module: vmware_cfg_backup
hostname: esxi_host
hostname: esxi_hostname
username: user
password: pass
state: saved
dest: /tmp/

# save the ESXi configuration locally for specific ESXi
# save the ESXi configuration locally by authenticating against the vCenter and selecting the ESXi host
- name: ESXI backup test
local_action:
module: vmware_cfg_backup
Expand Down Expand Up @@ -133,7 +133,7 @@ def load_configuration(self):
self.module.fail_json(msg="Source file {} does not exist".format(self.src))

url = self.host.configManager.firmwareSystem.QueryFirmwareConfigUploadURL()
url = url.replace('*', self.hostname)
url = url.replace('*', self.host.name)
# find manually the url if there is a redirect because urllib2 -per RFC- doesn't do automatic redirects for PUT requests
try:
request = open_url(url=url, method='HEAD', validate_certs=self.validate_certs)
Expand Down Expand Up @@ -169,7 +169,7 @@ def reset_configuration(self):

def save_configuration(self):
url = self.host.configManager.firmwareSystem.BackupFirmwareConfiguration()
url = url.replace('*', self.hostname)
url = url.replace('*', self.host.name)
if os.path.isdir(self.dest):
filename = url.rsplit('/', 1)[1]
self.dest = os.path.join(self.dest, filename)
Expand Down