From bb9572ca861ff35ce85a34087be892e25a268391 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Tue, 3 May 2016 15:51:12 +0100 Subject: [PATCH] ansible-validate-modules part 4: Enable check on ansible-modules-core (#3526) * Call ansible-validate-modules * Correct quotes + add newline --- .travis.yml | 5 ++ cloud/amazon/route53.py | 36 +++++++------- cloud/azure/azure_rm_networkinterface.py | 4 +- .../azure/azure_rm_networkinterface_facts.py | 2 +- cloud/azure/azure_rm_publicipaddress.py | 4 +- cloud/azure/azure_rm_publicipaddress_facts.py | 2 +- cloud/azure/azure_rm_securitygroup.py | 34 +++++++------- cloud/azure/azure_rm_securitygroup_facts.py | 14 +++--- cloud/azure/azure_rm_storageaccount_facts.py | 2 +- cloud/azure/azure_rm_virtualmachine.py | 4 +- cloud/azure/azure_rm_virtualnetwork.py | 2 +- cloud/azure/azure_rm_virtualnetwork_facts.py | 2 +- cloud/docker/docker_container.py | 47 ++++++++++--------- cloud/docker/docker_image_facts.py | 6 +-- cloud/openstack/os_network.py | 1 + cloud/openstack/os_subnet.py | 1 + network/openswitch/ops_facts.py | 2 - network/openswitch/ops_template.py | 5 +- windows/win_reboot.py | 21 +++++++++ 19 files changed, 110 insertions(+), 84 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91d1b9585d7..7feebd19b1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,14 @@ addons: packages: - python2.4 - python2.6 +install: + - pip install git+https://github.com/ansible/ansible.git@devel#egg=ansible + - pip install git+https://github.com/sivel/ansible-testing.git#egg=ansible_testing script: - python2.4 -m compileall -fq -x 'cloud/' . - python2.4 -m compileall -fq cloud/amazon/_ec2_ami_search.py cloud/amazon/ec2_facts.py - python2.6 -m compileall -fq . - python2.7 -m compileall -fq . + - ansible-validate-modules --exclude 'utilities/' . + #- ansible-validate-modules --exclude 'cloud/amazon/ec2_lc\.py|cloud/amazon/ec2_scaling_policy\.py|cloud/amazon/ec2_scaling_policy\.py|cloud/amazon/ec2_asg\.py|cloud/azure/azure\.py|packaging/os/rhn_register\.py|network/openswitch/ops_template\.py|system/hostname\.py|utilities/' . #- ./test-docs.sh core diff --git a/cloud/amazon/route53.py b/cloud/amazon/route53.py index d45c0f17902..427c1ab3c26 100644 --- a/cloud/amazon/route53.py +++ b/cloud/amazon/route53.py @@ -326,16 +326,16 @@ def commit(changes, retry_interval, wait, wait_timeout): time.sleep(float(retry_interval)) if wait: - timeout_time = time.time() + wait_timeout - connection = changes.connection - change = result['ChangeResourceRecordSetsResponse']['ChangeInfo'] - status = Status(connection, change) - while status.status != 'INSYNC' and time.time() < timeout_time: - time.sleep(WAIT_RETRY_SLEEP) - status.update() - if time.time() >= timeout_time: - raise TimeoutError() - return result + timeout_time = time.time() + wait_timeout + connection = changes.connection + change = result['ChangeResourceRecordSetsResponse']['ChangeInfo'] + status = Status(connection, change) + while status.status != 'INSYNC' and time.time() < timeout_time: + time.sleep(WAIT_RETRY_SLEEP) + status.update() + if time.time() >= timeout_time: + raise TimeoutError() + return result # Shamelessly copied over from https://git.io/vgmDG IGNORE_CODE = 'Throttling' @@ -427,19 +427,19 @@ def main(): if not value_in: module.fail_json(msg = "parameter 'value' required for create/delete") elif alias_in: - if len(value_list) != 1: - module.fail_json(msg = "parameter 'value' must contain a single dns name for alias create/delete") - elif not alias_hosted_zone_id_in: - module.fail_json(msg = "parameter 'alias_hosted_zone_id' required for alias create/delete") - elif ( weight_in!=None or region_in!=None or failover_in!=None ) and identifier_in==None: - module.fail_json(msg= "If you specify failover, region or weight you must also specify identifier") + if len(value_list) != 1: + module.fail_json(msg = "parameter 'value' must contain a single dns name for alias create/delete") + elif not alias_hosted_zone_id_in: + module.fail_json(msg = "parameter 'alias_hosted_zone_id' required for alias create/delete") + elif ( weight_in!=None or region_in!=None or failover_in!=None ) and identifier_in==None: + module.fail_json(msg= "If you specify failover, region or weight you must also specify identifier") if command_in == 'create': if ( weight_in!=None or region_in!=None or failover_in!=None ) and identifier_in==None: module.fail_json(msg= "If you specify failover, region or weight you must also specify identifier") elif ( weight_in==None and region_in==None and failover_in==None ) and identifier_in!=None: module.fail_json(msg= "You have specified identifier which makes sense only if you specify one of: weight, region or failover.") - + if vpc_id_in and not private_zone_in: @@ -484,7 +484,7 @@ def main(): if identifier_in is not None: identifier_in = str(identifier_in) - + if rset.type == type_in and decoded_name.lower() == record_in.lower() and rset.identifier == identifier_in: found_record = True record['zone'] = zone_in diff --git a/cloud/azure/azure_rm_networkinterface.py b/cloud/azure/azure_rm_networkinterface.py index 78b2af5f32c..72f7bc512e1 100644 --- a/cloud/azure/azure_rm_networkinterface.py +++ b/cloud/azure/azure_rm_networkinterface.py @@ -199,7 +199,7 @@ state: "internal_fqdn": null }, "enable_ip_forwarding": false, - "etag": "W/\"be115a43-2148-4545-a324-f33ad444c926\"", + "etag": 'W/"be115a43-2148-4545-a324-f33ad444c926"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkInterfaces/nic003", "ip_configuration": { "name": "default", @@ -435,7 +435,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase): if self.check_mode: return self.results - + if changed: if self.state == 'present': if not nic: diff --git a/cloud/azure/azure_rm_networkinterface_facts.py b/cloud/azure/azure_rm_networkinterface_facts.py index 62859e5b0e1..50c1d2b68b7 100644 --- a/cloud/azure/azure_rm_networkinterface_facts.py +++ b/cloud/azure/azure_rm_networkinterface_facts.py @@ -92,7 +92,7 @@ objects: "internal_fqdn": null }, "enable_ip_forwarding": false, - "etag": "W/\"59726bfc-08c4-44ed-b900-f6a559876a9d\"", + "etag": 'W/"59726bfc-08c4-44ed-b900-f6a559876a9d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkInterfaces/nic003", "ip_configuration": { "name": "default", diff --git a/cloud/azure/azure_rm_publicipaddress.py b/cloud/azure/azure_rm_publicipaddress.py index 15fa9e41fb9..736c3ec52b9 100644 --- a/cloud/azure/azure_rm_publicipaddress.py +++ b/cloud/azure/azure_rm_publicipaddress.py @@ -101,9 +101,9 @@ state: description: Facts about the current state of the object. returned: always type: dict - sample:{ + sample: { "dns_settings": {}, - "etag": "W/\"a5e56955-12df-445a-bda4-dc129d22c12f\"", + "etag": '"/"a5e56955-12df-445a-bda4-dc129d22c12f"', "idle_timeout_in_minutes": 4, "ip_address": "52.160.103.93", "location": "westus", diff --git a/cloud/azure/azure_rm_publicipaddress_facts.py b/cloud/azure/azure_rm_publicipaddress_facts.py index 099b5f0eabc..e168d8f2470 100644 --- a/cloud/azure/azure_rm_publicipaddress_facts.py +++ b/cloud/azure/azure_rm_publicipaddress_facts.py @@ -78,7 +78,7 @@ objects: returned: always type: list sample: [{ - "etag": "W/\"a31a6d7d-cb18-40a5-b16d-9f4a36c1b18a\"", + "etag": 'W/"a31a6d7d-cb18-40a5-b16d-9f4a36c1b18a"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/publicIPAddresses/pip2001", "location": "eastus2", "name": "pip2001", diff --git a/cloud/azure/azure_rm_securitygroup.py b/cloud/azure/azure_rm_securitygroup.py index 2992debb81a..93d037450fd 100644 --- a/cloud/azure/azure_rm_securitygroup.py +++ b/cloud/azure/azure_rm_securitygroup.py @@ -140,9 +140,9 @@ EXAMPLES = ''' - name: DenySSH protocol: TCP destination_port_range: 22 - access: Deny + access: Deny priority: 100 - direction: Inbound + direction: Inbound - name: 'AllowSSH' protocol: TCP source_address_prefix: '174.109.158.0/24' @@ -161,14 +161,14 @@ EXAMPLES = ''' destination_port_range: 22-23 access: Deny priority: 100 - direction: Inbound + direction: Inbound - name: AllowSSHFromHome protocol: TCP source_address_prefix: '174.109.158.0/24' destination_port_range: 22-23 access: Allow priority: 102 - direction: Inbound + direction: Inbound tags: testing: testing delete: on-exit @@ -176,7 +176,7 @@ EXAMPLES = ''' # Delete security group - azure_rm_securitygroup: resource_group: mygroup - name: mysecgroup + name: mysecgroup state: absent ''' @@ -193,7 +193,7 @@ state: "destination_address_prefix": "VirtualNetwork", "destination_port_range": "*", "direction": "Inbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/AllowVnetInBound", "name": "AllowVnetInBound", "priority": 65000, @@ -208,7 +208,7 @@ state: "destination_address_prefix": "*", "destination_port_range": "*", "direction": "Inbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/AllowAzureLoadBalancerInBound", "name": "AllowAzureLoadBalancerInBound", "priority": 65001, @@ -223,7 +223,7 @@ state: "destination_address_prefix": "*", "destination_port_range": "*", "direction": "Inbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/DenyAllInBound", "name": "DenyAllInBound", "priority": 65500, @@ -238,7 +238,7 @@ state: "destination_address_prefix": "VirtualNetwork", "destination_port_range": "*", "direction": "Outbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/AllowVnetOutBound", "name": "AllowVnetOutBound", "priority": 65000, @@ -253,7 +253,7 @@ state: "destination_address_prefix": "Internet", "destination_port_range": "*", "direction": "Outbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/AllowInternetOutBound", "name": "AllowInternetOutBound", "priority": 65001, @@ -268,7 +268,7 @@ state: "destination_address_prefix": "*", "destination_port_range": "*", "direction": "Outbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/defaultSecurityRules/DenyAllOutBound", "name": "DenyAllOutBound", "priority": 65500, @@ -289,7 +289,7 @@ state: "destination_address_prefix": "*", "destination_port_range": "22", "direction": "Inbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/securityRules/DenySSH", "name": "DenySSH", "priority": 100, @@ -304,7 +304,7 @@ state: "destination_address_prefix": "*", "destination_port_range": "22", "direction": "Inbound", - "etag": "W/\"edf48d56-b315-40ca-a85d-dbcb47f2da7d\"", + "etag": 'W/"edf48d56-b315-40ca-a85d-dbcb47f2da7d"', "id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/mysecgroup/securityRules/AllowSSH", "name": "AllowSSH", "priority": 101, @@ -354,7 +354,7 @@ def validate_rule(rule, rule_type=None): raise Exception("Rule name value is required.") if not NAME_PATTERN.match(rule.get('name')): raise Exception("Rule name must contain only word characters plus '.','-','_'") - + priority = rule.get('priority', None) if not priority: raise Exception("Rule priority is required.") @@ -445,7 +445,7 @@ def create_rule_instance(rule): destination_port_range=rule.get('destination_port_range', None), priority=rule.get('priority', None), provisioning_state=rule.get('provisioning_state', None), - name=rule.get('name', None), + name=rule.get('name', None), etag=rule.get('etag', None) ) @@ -480,7 +480,7 @@ def create_network_security_group_dict(nsg): name=nsg.name, type=nsg.type, location=nsg.location, - tags=nsg.tags, + tags=nsg.tags, ) results['rules'] = [] if nsg.security_rules: @@ -539,7 +539,7 @@ class AzureRMSecurityGroup(AzureRMModuleBase): supports_check_mode=True) def exec_module(self, **kwargs): - + for key in self.module_arg_spec.keys() + ['tags']: setattr(self, key, kwargs[key]) diff --git a/cloud/azure/azure_rm_securitygroup_facts.py b/cloud/azure/azure_rm_securitygroup_facts.py index ecf6c535f1f..3a79a04c0e3 100644 --- a/cloud/azure/azure_rm_securitygroup_facts.py +++ b/cloud/azure/azure_rm_securitygroup_facts.py @@ -78,14 +78,14 @@ objects: returned: always type: list sample: [{ - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001", "location": "eastus2", "name": "secgroup001", "properties": { "defaultSecurityRules": [ { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetInBound", "name": "AllowVnetInBound", "properties": { @@ -102,7 +102,7 @@ objects: } }, { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowAzureLoadBalancerInBound", "name": "AllowAzureLoadBalancerInBound", "properties": { @@ -119,7 +119,7 @@ objects: } }, { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllInBound", "name": "DenyAllInBound", "properties": { @@ -136,7 +136,7 @@ objects: } }, { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetOutBound", "name": "AllowVnetOutBound", "properties": { @@ -153,7 +153,7 @@ objects: } }, { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowInternetOutBound", "name": "AllowInternetOutBound", "properties": { @@ -170,7 +170,7 @@ objects: } }, { - "etag": "W/\"d036f4d7-d977-429a-a8c6-879bc2523399\"", + "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllOutBound", "name": "DenyAllOutBound", "properties": { diff --git a/cloud/azure/azure_rm_storageaccount_facts.py b/cloud/azure/azure_rm_storageaccount_facts.py index 20c044951fa..462eca67e76 100644 --- a/cloud/azure/azure_rm_storageaccount_facts.py +++ b/cloud/azure/azure_rm_storageaccount_facts.py @@ -1,4 +1,4 @@ -##!/usr/bin/python +#!/usr/bin/python # # Copyright (c) 2016 Matt Davis, # Chris Houseknecht, diff --git a/cloud/azure/azure_rm_virtualmachine.py b/cloud/azure/azure_rm_virtualmachine.py index 8faa45d5f15..1e5a91122c5 100644 --- a/cloud/azure/azure_rm_virtualmachine.py +++ b/cloud/azure/azure_rm_virtualmachine.py @@ -352,7 +352,7 @@ state: "enableIPForwarding": false, "ipConfigurations": [ { - "etag": "W/\"041c8c2a-d5dd-4cd7-8465-9125cfbe2cf8\"", + "etag": 'W/"041c8c2a-d5dd-4cd7-8465-9125cfbe2cf8"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/networkInterfaces/testvm10_NIC01/ipConfigurations/default", "name": "default", "properties": { @@ -450,7 +450,7 @@ def extract_names_from_blob_uri(blob_uri): return extracted_names -class AzureRMVirtualMachine(AzureRMModuleBase): +class AzureRMVirtualMachine(AzureRMModuleBase): def __init__(self): diff --git a/cloud/azure/azure_rm_virtualnetwork.py b/cloud/azure/azure_rm_virtualnetwork.py index 574e3c257c8..d53fad139ab 100644 --- a/cloud/azure/azure_rm_virtualnetwork.py +++ b/cloud/azure/azure_rm_virtualnetwork.py @@ -123,7 +123,7 @@ state: "127.0.0.1", "127.0.0.3" ], - "etag": "W/\"0712e87c-f02f-4bb3-8b9e-2da0390a3886\"", + "etag": 'W/"0712e87c-f02f-4bb3-8b9e-2da0390a3886"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/virtualNetworks/my_test_network", "location": "eastus", "name": "my_test_network", diff --git a/cloud/azure/azure_rm_virtualnetwork_facts.py b/cloud/azure/azure_rm_virtualnetwork_facts.py index 491c0586a22..0ef99d0ab8c 100644 --- a/cloud/azure/azure_rm_virtualnetwork_facts.py +++ b/cloud/azure/azure_rm_virtualnetwork_facts.py @@ -82,7 +82,7 @@ objects: returned: always type: list sample: [{ - "etag": "W/\"532ba1be-ae71-40f2-9232-3b1d9cf5e37e\"", + "etag": 'W/"532ba1be-ae71-40f2-9232-3b1d9cf5e37e"', "id": "/subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/virtualNetworks/vnet2001", "location": "eastus2", "name": "vnet2001", diff --git a/cloud/docker/docker_container.py b/cloud/docker/docker_container.py index ed039d6e41e..078b60288c1 100644 --- a/cloud/docker/docker_container.py +++ b/cloud/docker/docker_container.py @@ -46,11 +46,11 @@ options: required: false cpu_period: description: - - Limit CPU CFS (Completely Fair Scheduler) period + - Limit CPU CFS (Completely Fair Scheduler) period default: 0 cpu_quota: description: - - Limit CPU CFS (Completely Fair Scheduler) quota + - Limit CPU CFS (Completely Fair Scheduler) quota default: 0 cpuset_cpus: description: @@ -69,7 +69,7 @@ options: required: false detach: description: - - Enable detached mode to leave the container running in background. + - Enable detached mode to leave the container running in background. If disabled, fail unless the process exits cleanly. default: true devices: @@ -100,7 +100,7 @@ options: required: false etc_hosts: description: - - Dict of host-to-IP mappings, where each host name is key in the dictionary. Hostname will be added to the + - Dict of host-to-IP mappings, where each host name is key in the dictionary. Hostname will be added to the container's /etc/hosts file. default: null required: false @@ -120,7 +120,7 @@ options: default: false groups: description: - - List of additional group names and/or IDs that the container process will run as. + - List of additional group names and/or IDs that the container process will run as. default: null required: false hostname: @@ -133,7 +133,7 @@ options: - When state is present or started the module compares the configuration of an existing container to requested configuration. The evaluation includes the image version. If the image vesion in the registry does not match the container, the container will be - rebuilt. To stop this behavior set ignore_image to true. + rebuilt. To stop this behavior set ignore_image to true. default: false image: description: @@ -147,7 +147,7 @@ options: default: false ipc_mode: description: - - Set the IPC mode for the container. Can be one of + - Set the IPC mode for the container. Can be one of 'container:' to reuse another container's IPC namespace or 'host' to use the host's IPC namespace within the container. default: null @@ -155,7 +155,7 @@ options: keep_volumes: description: - Retain volumes associated with a removed container. - default: true + default: true kill_signal: description: - Override default signal used to kill a running container. @@ -190,7 +190,7 @@ options: defult: json-file log_options: description: - - Dictionary of options specific to the chosen log_driver. See https://docs.docker.com/engine/admin/logging/overview/ + - Dictionary of options specific to the chosen log_driver. See https://docs.docker.com/engine/admin/logging/overview/ for details. required: false default: null @@ -281,7 +281,7 @@ options: default: false registry: description: - - Registry URL from which to pull images. If not specified, images will be pulled from + - Registry URL from which to pull images. If not specified, images will be pulled from the default registry found in the local docker config.json file. default: null required: false @@ -295,14 +295,14 @@ options: choices: - on-failure - always - default: on-failure + default: on-failure restart_retries: description: - Use with restart policy to control maximum number of restart attempts. - default: 0 + default: 0 shm_size: description: - - Size of `/dev/shm`. The format is ``. `number` must be greater than `0`. + - Size of `/dev/shm`. The format is ``. `number` must be greater than `0`. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). - Ommitting the unit defaults to bytes. If you omit the size entirely, the system uses `64m`. default: null @@ -319,15 +319,15 @@ options: - '"present" - Asserts the existence of a container matching the name and any provided configuration parameters. If no container matches the name, a container will be created. If a container matches the name but the provided configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed and re-created - with the requested config. Image version will be taken into account when comparing configuration. To ignore image + with the requested config. Image version will be taken into account when comparing configuration. To ignore image version use the ignore_image option. Use the recreate option to force the re-creation of the matching container. Use force_kill to kill the container rather than stopping it. Use keep_volumes to retain volumes associated with a removed container.' - '"started" - Asserts there is a running container matching the name and any provided configuration. If no container matches the name, a container will be created and started. If a container matching the name is found but the configuration does not match, the container will be updated, if it can be. If it cannot be updated, it will be removed - and a new container will be created with the requested configuration and started. Image version will be taken into - account when comparing configuration. To ignore image version use the ignore_image option. Use recreate to always + and a new container will be created with the requested configuration and started. Image version will be taken into + account when comparing configuration. To ignore image version use the ignore_image option. Use recreate to always re-create a matching container, even if it is running. Use restart to force a matching container to be stopped and restarted. Use force_kill to kill a container rather than stopping it. Use keep_volumes to retain volumes associated with a removed container.' @@ -343,7 +343,7 @@ options: stop_signal: description: - Override default signal used to stop the container. - default: null + default: null required: false stop_timeout: description: @@ -378,7 +378,7 @@ options: - List of volumes to mount within the container. - "Use docker CLI-style syntax: C(/host:/container[:mode])" - You can specify a read mode for the mount with either C(ro) or C(rw). - - SELinux hosts can additionally use C(z) or C(Z) to use a shared or + - SELinux hosts can additionally use C(z) or C(Z) to use a shared or private label for the volume. default: null required: false @@ -389,7 +389,7 @@ options: required: false volumes_from: description: - - List of container names or Ids to get volumes from. + - List of container names or Ids to get volumes from. default: null required: false @@ -436,7 +436,7 @@ EXAMPLES = ''' docker_container: name: myapplication image: someuser/appimage - state: started + state: started restart: yes links: - "myredis:aliasedredis" @@ -471,10 +471,10 @@ EXAMPLES = ''' name: ohno state: absent -- name: Syslogging output +- name: Syslogging output docker_container: name: myservice - state: started + state: started log_driver: syslog log_opt: syslog-address: tcp://my-syslog-server:514 @@ -528,6 +528,7 @@ container: "/tmp/lnmp/nginx-sites/logs/": {} }, ... + } } ''' @@ -910,7 +911,7 @@ class TaskParameters(DockerBaseClass): class Container(DockerBaseClass): - + def __init__(self, container, parameters): super(Container, self).__init__() self.raw = container diff --git a/cloud/docker/docker_image_facts.py b/cloud/docker/docker_image_facts.py index 0f33a3452c1..5b25601d619 100644 --- a/cloud/docker/docker_image_facts.py +++ b/cloud/docker/docker_image_facts.py @@ -68,7 +68,7 @@ images: description: Facts for the selected images. returned: always type: dict - sample:[ + sample: [ { "Architecture": "amd64", "Author": "", @@ -111,7 +111,7 @@ images: "Cmd": [ "/bin/sh", "-c", - "#(nop) CMD [\"/etc/docker/registry/config.yml\"]" + '#(nop) CMD ["/etc/docker/registry/config.yml"]' ], "Domainname": "", "Entrypoint": [ @@ -241,4 +241,4 @@ def main(): from ansible.module_utils.basic import * if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/cloud/openstack/os_network.py b/cloud/openstack/os_network.py index da0be212a01..9a0c2516310 100644 --- a/cloud/openstack/os_network.py +++ b/cloud/openstack/os_network.py @@ -87,6 +87,7 @@ options: - Project name or ID containing the network (name admin-only) required: false default: None + version_added: "2.1" requirements: ["shade"] ''' diff --git a/cloud/openstack/os_subnet.py b/cloud/openstack/os_subnet.py index c75e8059f0b..333cb139c61 100644 --- a/cloud/openstack/os_subnet.py +++ b/cloud/openstack/os_subnet.py @@ -110,6 +110,7 @@ options: - Project name or ID containing the subnet (name admin-only) required: false default: None + version_added: "2.1" requirements: - "python >= 2.6" - "shade" diff --git a/network/openswitch/ops_facts.py b/network/openswitch/ops_facts.py index 4c5e354986a..d88f9aff3e5 100644 --- a/network/openswitch/ops_facts.py +++ b/network/openswitch/ops_facts.py @@ -168,5 +168,3 @@ from ansible.module_utils.openswitch import * if __name__ == '__main__': main() - - diff --git a/network/openswitch/ops_template.py b/network/openswitch/ops_template.py index 0f07baee156..da25395139e 100644 --- a/network/openswitch/ops_template.py +++ b/network/openswitch/ops_template.py @@ -239,8 +239,7 @@ from ansible.module_utils.urls import * from ansible.module_utils.netcfg import * from ansible.module_utils.shell import * from ansible.module_utils.openswitch import * + if __name__ == '__main__': - main() - - + main() diff --git a/windows/win_reboot.py b/windows/win_reboot.py index 1a87dd008b3..eeb39a9279d 100644 --- a/windows/win_reboot.py +++ b/windows/win_reboot.py @@ -1,3 +1,24 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +# this is a windows documentation stub. actual code lives in the .ps1 +# file of the same name + DOCUMENTATION=''' --- module: win_reboot