diff options
author | Matt Clay <matt@mystile.com> | 2018-01-10 21:03:25 +0100 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2018-01-10 23:08:11 +0100 |
commit | 797664d9cb681a66b3c2e17405d23b9c8723321c (patch) | |
tree | 16533e8024c9c9dde42da9d7f6b61444a3e71f24 /contrib | |
parent | Change cow path selection variable from COWPATH to COW_PATH (#34063) (diff) | |
download | ansible-797664d9cb681a66b3c2e17405d23b9c8723321c.tar.xz ansible-797664d9cb681a66b3c2e17405d23b9c8723321c.zip |
Python 2.6 `str.format()` compatibility fixes.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/inventory/proxmox.py | 12 | ||||
-rwxr-xr-x | contrib/inventory/stacki.py | 2 | ||||
-rwxr-xr-x | contrib/vault/vault-keyring.py | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/contrib/inventory/proxmox.py b/contrib/inventory/proxmox.py index fd675ef4aa..afa7032ad2 100755 --- a/contrib/inventory/proxmox.py +++ b/contrib/inventory/proxmox.py @@ -97,7 +97,7 @@ class ProxmoxAPI(object): raise Exception('Missing mandatory parameter --password (or PROXMOX_PASSWORD).') def auth(self): - request_path = '{}api2/json/access/ticket'.format(self.options.url) + request_path = '{0}api2/json/access/ticket'.format(self.options.url) request_params = urlencode({ 'username': self.options.username, @@ -112,9 +112,9 @@ class ProxmoxAPI(object): } def get(self, url, data=None): - request_path = '{}{}'.format(self.options.url, url) + request_path = '{0}{1}'.format(self.options.url, url) - headers = {'Cookie': 'PVEAuthCookie={}'.format(self.credentials['ticket'])} + headers = {'Cookie': 'PVEAuthCookie={0}'.format(self.credentials['ticket'])} request = open_url(request_path, data=data, headers=headers) response = json.load(request) @@ -124,10 +124,10 @@ class ProxmoxAPI(object): return ProxmoxNodeList(self.get('api2/json/nodes')) def vms_by_type(self, node, type): - return ProxmoxVMList(self.get('api2/json/nodes/{}/{}'.format(node, type))) + return ProxmoxVMList(self.get('api2/json/nodes/{0}/{1}'.format(node, type))) def vm_description_by_type(self, node, vm, type): - return self.get('api2/json/nodes/{}/{}/{}/config'.format(node, type, vm)) + return self.get('api2/json/nodes/{0}/{1}/{2}/config'.format(node, type, vm)) def node_qemu(self, node): return self.vms_by_type(node, 'qemu') @@ -145,7 +145,7 @@ class ProxmoxAPI(object): return ProxmoxPoolList(self.get('api2/json/pools')) def pool(self, poolid): - return ProxmoxPool(self.get('api2/json/pools/{}'.format(poolid))) + return ProxmoxPool(self.get('api2/json/pools/{0}'.format(poolid))) def main_list(options): diff --git a/contrib/inventory/stacki.py b/contrib/inventory/stacki.py index a61f6b8fee..824ecaf5e7 100755 --- a/contrib/inventory/stacki.py +++ b/contrib/inventory/stacki.py @@ -173,7 +173,7 @@ def main(): config = yaml.safe_load(stream) break if not config: - sys.stderr.write("No config file found at {}\n".format(config_files)) + sys.stderr.write("No config file found at {0}\n".format(config_files)) sys.exit(1) client, auth_creds = stack_auth(config['stacki']['auth']) header = stack_build_header(auth_creds) diff --git a/contrib/vault/vault-keyring.py b/contrib/vault/vault-keyring.py index 461f2137d5..69a1e902ec 100755 --- a/contrib/vault/vault-keyring.py +++ b/contrib/vault/vault-keyring.py @@ -91,8 +91,8 @@ def main(): sys.stderr.write('Passwords do not match\n') sys.exit(1) else: - sys.stdout.write('{}\n'.format(keyring.get_password(keyname, - username))) + sys.stdout.write('{0}\n'.format(keyring.get_password(keyname, + username))) sys.exit(0) |