* PEP 8 E121 cleanup.
* PEP 8 E126 cleanup.
* PEP 8 E122 cleanup.
... | ... |
@@ -446,7 +446,7 @@ class AzureInventory(object): |
446 | 446 |
def _parse_cli_args(self): |
447 | 447 |
# Parse command line arguments |
448 | 448 |
parser = argparse.ArgumentParser( |
449 |
- description='Produce an Ansible Inventory file for an Azure subscription') |
|
449 |
+ description='Produce an Ansible Inventory file for an Azure subscription') |
|
450 | 450 |
parser.add_argument('--list', action='store_true', default=True, |
451 | 451 |
help='List instances (default: True)') |
452 | 452 |
parser.add_argument('--debug', action='store_true', default=False, |
... | ... |
@@ -199,8 +199,8 @@ class CloudStackInventory(object): |
199 | 199 |
group_name = group['name'] |
200 | 200 |
if group_name and not group_name in data: |
201 | 201 |
data[group_name] = { |
202 |
- 'hosts': [] |
|
203 |
- } |
|
202 |
+ 'hosts': [] |
|
203 |
+ } |
|
204 | 204 |
|
205 | 205 |
hosts = self.cs.listVirtualMachines(projectid=project_id, domainid=domain_id) |
206 | 206 |
if not hosts: |
... | ... |
@@ -252,10 +252,10 @@ class ConsulInventory(object): |
252 | 252 |
ok = 'passing' == check['Status'] |
253 | 253 |
if ok: |
254 | 254 |
suffix = self.config.get_availability_suffix( |
255 |
- 'available_suffix', '_available') |
|
255 |
+ 'available_suffix', '_available') |
|
256 | 256 |
else: |
257 | 257 |
suffix = self.config.get_availability_suffix( |
258 |
- 'unavailable_suffix', '_unavailable') |
|
258 |
+ 'unavailable_suffix', '_unavailable') |
|
259 | 259 |
self.add_node_to_map(self.nodes_by_availability, |
260 | 260 |
service_name + suffix, node['Node']) |
261 | 261 |
|
... | ... |
@@ -353,12 +353,12 @@ or environment variables (DO_API_TOKEN)\n''') |
353 | 353 |
def build_inventory(self): |
354 | 354 |
'''Build Ansible inventory of droplets''' |
355 | 355 |
self.inventory = { |
356 |
- 'all': { |
|
357 |
- 'hosts': [], |
|
358 |
- 'vars': self.group_variables |
|
359 |
- }, |
|
360 |
- '_meta': {'hostvars': {}} |
|
361 |
- } |
|
356 |
+ 'all': { |
|
357 |
+ 'hosts': [], |
|
358 |
+ 'vars': self.group_variables |
|
359 |
+ }, |
|
360 |
+ '_meta': {'hostvars': {}} |
|
361 |
+ } |
|
362 | 362 |
|
363 | 363 |
# add all droplets by id and name |
364 | 364 |
for droplet in self.data['droplets']: |
... | ... |
@@ -379,22 +379,22 @@ or environment variables (DO_API_TOKEN)\n''') |
379 | 379 |
|
380 | 380 |
# groups that are always present |
381 | 381 |
for group in [ |
382 |
- 'region_' + droplet['region']['slug'], |
|
383 |
- 'image_' + str(droplet['image']['id']), |
|
384 |
- 'size_' + droplet['size']['slug'], |
|
385 |
- 'distro_' + self.to_safe(droplet['image']['distribution']), |
|
386 |
- 'status_' + droplet['status'], |
|
382 |
+ 'region_' + droplet['region']['slug'], |
|
383 |
+ 'image_' + str(droplet['image']['id']), |
|
384 |
+ 'size_' + droplet['size']['slug'], |
|
385 |
+ 'distro_' + self.to_safe(droplet['image']['distribution']), |
|
386 |
+ 'status_' + droplet['status'], |
|
387 | 387 |
|
388 |
- ]: |
|
388 |
+ ]: |
|
389 | 389 |
if group not in self.inventory: |
390 | 390 |
self.inventory[group] = { 'hosts': [ ], 'vars': {} } |
391 | 391 |
self.inventory[group]['hosts'].append(dest) |
392 | 392 |
|
393 | 393 |
# groups that are not always present |
394 | 394 |
for group in [ |
395 |
- droplet['image']['slug'], |
|
396 |
- droplet['image']['name'] |
|
397 |
- ]: |
|
395 |
+ droplet['image']['slug'], |
|
396 |
+ droplet['image']['name'] |
|
397 |
+ ]: |
|
398 | 398 |
if group: |
399 | 399 |
image = 'image_' + self.to_safe(group) |
400 | 400 |
if image not in self.inventory: |
... | ... |
@@ -676,7 +676,7 @@ class DockerInventory(object): |
676 | 676 |
# use hosts from config file |
677 | 677 |
for host in hosts_list: |
678 | 678 |
docker_host = host.get('host') or def_host or self._args.docker_host or \ |
679 |
- self._env_args.docker_host or DEFAULT_DOCKER_HOST |
|
679 |
+ self._env_args.docker_host or DEFAULT_DOCKER_HOST |
|
680 | 680 |
api_version = host.get('version') or def_version or self._args.api_version or \ |
681 | 681 |
self._env_args.api_version or DEFAULT_DOCKER_API_VERSION |
682 | 682 |
tls_hostname = host.get('tls_hostname') or def_tls_hostname or self._args.tls_hostname or \ |
... | ... |
@@ -816,7 +816,7 @@ class DockerInventory(object): |
816 | 816 |
default_config = basename + '.yml' |
817 | 817 |
|
818 | 818 |
parser = argparse.ArgumentParser( |
819 |
- description='Return Ansible inventory for one or more Docker hosts.') |
|
819 |
+ description='Return Ansible inventory for one or more Docker hosts.') |
|
820 | 820 |
parser.add_argument('--list', action='store_true', default=True, |
821 | 821 |
help='List all containers (default: True)') |
822 | 822 |
parser.add_argument('--debug', action='store_true', default=False, |
... | ... |
@@ -323,7 +323,7 @@ class GceInventory(object): |
323 | 323 |
''' Command line argument processing ''' |
324 | 324 |
|
325 | 325 |
parser = argparse.ArgumentParser( |
326 |
- description='Produce an Ansible Inventory file based on GCE') |
|
326 |
+ description='Produce an Ansible Inventory file based on GCE') |
|
327 | 327 |
parser.add_argument('--list', action='store_true', default=True, |
328 | 328 |
help='List instances (default: True)') |
329 | 329 |
parser.add_argument('--host', action='store', |
... | ... |
@@ -109,7 +109,7 @@ def print_host(host): |
109 | 109 |
|
110 | 110 |
def get_args(args_list): |
111 | 111 |
parser = argparse.ArgumentParser( |
112 |
- description='ansible inventory script parsing .ssh/config') |
|
112 |
+ description='ansible inventory script parsing .ssh/config') |
|
113 | 113 |
mutex_group = parser.add_mutually_exclusive_group(required=True) |
114 | 114 |
help_list = 'list all hosts from .ssh/config inventory' |
115 | 115 |
mutex_group.add_argument('--list', action='store_true', help=help_list) |
... | ... |
@@ -230,17 +230,17 @@ htmlhelp_basename = 'Ansibledoc' |
230 | 230 |
# -- Options for LaTeX output --------------------------------------------- |
231 | 231 |
|
232 | 232 |
latex_elements = { |
233 |
-# The paper size ('letterpaper' or 'a4paper'). |
|
234 |
-#'papersize': 'letterpaper', |
|
233 |
+ # The paper size ('letterpaper' or 'a4paper'). |
|
234 |
+ #'papersize': 'letterpaper', |
|
235 | 235 |
|
236 |
-# The font size ('10pt', '11pt' or '12pt'). |
|
237 |
-#'pointsize': '10pt', |
|
236 |
+ # The font size ('10pt', '11pt' or '12pt'). |
|
237 |
+ #'pointsize': '10pt', |
|
238 | 238 |
|
239 |
-# Additional stuff for the LaTeX preamble. |
|
240 |
-#'preamble': '', |
|
239 |
+ # Additional stuff for the LaTeX preamble. |
|
240 |
+ #'preamble': '', |
|
241 | 241 |
|
242 |
-# Latex figure (float) alignment |
|
243 |
-#'figure_align': 'htbp', |
|
242 |
+ # Latex figure (float) alignment |
|
243 |
+ #'figure_align': 'htbp', |
|
244 | 244 |
} |
245 | 245 |
|
246 | 246 |
# Grouping the document tree into LaTeX files. List of tuples |
... | ... |
@@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc' |
203 | 203 |
# (source start file, target name, title, author, document class |
204 | 204 |
# [howto/manual]). |
205 | 205 |
latex_documents = [ |
206 |
- ('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'), |
|
206 |
+ ('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'), |
|
207 | 207 |
] |
208 | 208 |
|
209 | 209 |
# The name of an image file (relative to this directory) to place at the top of |
... | ... |
@@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc' |
203 | 203 |
# (source start file, target name, title, author, document class |
204 | 204 |
# [howto/manual]). |
205 | 205 |
latex_documents = [ |
206 |
- ('index', 'ansible.tex', 'Ansible 1.2 Documentation', |
|
206 |
+ ('index', 'ansible.tex', 'Ansible 1.2 Documentation', |
|
207 | 207 |
AUTHOR, 'manual'), |
208 | 208 |
] |
209 | 209 |
|
... | ... |
@@ -238,21 +238,21 @@ htmlhelp_basename = 'dev_guidedoc' |
238 | 238 |
# -- Options for LaTeX output --------------------------------------------- |
239 | 239 |
|
240 | 240 |
latex_elements = { |
241 |
- # The paper size ('letterpaper' or 'a4paper'). |
|
242 |
- # |
|
243 |
- # 'papersize': 'letterpaper', |
|
241 |
+ # The paper size ('letterpaper' or 'a4paper'). |
|
242 |
+ # |
|
243 |
+ # 'papersize': 'letterpaper', |
|
244 | 244 |
|
245 |
- # The font size ('10pt', '11pt' or '12pt'). |
|
246 |
- # |
|
247 |
- # 'pointsize': '10pt', |
|
245 |
+ # The font size ('10pt', '11pt' or '12pt'). |
|
246 |
+ # |
|
247 |
+ # 'pointsize': '10pt', |
|
248 | 248 |
|
249 |
- # Additional stuff for the LaTeX preamble. |
|
250 |
- # |
|
251 |
- # 'preamble': '', |
|
249 |
+ # Additional stuff for the LaTeX preamble. |
|
250 |
+ # |
|
251 |
+ # 'preamble': '', |
|
252 | 252 |
|
253 |
- # Latex figure (float) alignment |
|
254 |
- # |
|
255 |
- # 'figure_align': 'htbp', |
|
253 |
+ # Latex figure (float) alignment |
|
254 |
+ # |
|
255 |
+ # 'figure_align': 'htbp', |
|
256 | 256 |
} |
257 | 257 |
|
258 | 258 |
# Grouping the document tree into LaTeX files. List of tuples |
... | ... |
@@ -48,11 +48,11 @@ def main(): |
48 | 48 |
|
49 | 49 |
# create play with tasks |
50 | 50 |
play_source = dict( |
51 |
- name = "Ansible Play", |
|
52 |
- hosts = host_list, |
|
53 |
- gather_facts = 'no', |
|
54 |
- tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ] |
|
55 |
- ) |
|
51 |
+ name = "Ansible Play", |
|
52 |
+ hosts = host_list, |
|
53 |
+ gather_facts = 'no', |
|
54 |
+ tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ] |
|
55 |
+ ) |
|
56 | 56 |
play = Play().load(play_source, variable_manager=variable_manager, loader=loader) |
57 | 57 |
|
58 | 58 |
# actually run it |
... | ... |
@@ -60,12 +60,12 @@ def main(): |
60 | 60 |
callback = ResultsCollector() |
61 | 61 |
try: |
62 | 62 |
tqm = TaskQueueManager( |
63 |
- inventory=inventory, |
|
64 |
- variable_manager=variable_manager, |
|
65 |
- loader=loader, |
|
66 |
- options=options, |
|
67 |
- passwords=passwords, |
|
68 |
- ) |
|
63 |
+ inventory=inventory, |
|
64 |
+ variable_manager=variable_manager, |
|
65 |
+ loader=loader, |
|
66 |
+ options=options, |
|
67 |
+ passwords=passwords, |
|
68 |
+ ) |
|
69 | 69 |
tqm._stdout_callback = callback |
70 | 70 |
result = tqm.run(play) |
71 | 71 |
finally: |
... | ... |
@@ -15,23 +15,23 @@ import json |
15 | 15 |
import sys |
16 | 16 |
|
17 | 17 |
filelist = [ |
18 |
- '/etc/oracle-release', |
|
19 |
- '/etc/slackware-version', |
|
20 |
- '/etc/redhat-release', |
|
21 |
- '/etc/vmware-release', |
|
22 |
- '/etc/openwrt_release', |
|
23 |
- '/etc/system-release', |
|
24 |
- '/etc/alpine-release', |
|
25 |
- '/etc/release', |
|
26 |
- '/etc/arch-release', |
|
27 |
- '/etc/os-release', |
|
28 |
- '/etc/SuSE-release', |
|
29 |
- '/etc/gentoo-release', |
|
30 |
- '/etc/os-release', |
|
31 |
- '/etc/lsb-release', |
|
32 |
- '/etc/altlinux-release', |
|
33 |
- '/etc/os-release', |
|
34 |
- '/etc/coreos/update.conf', |
|
18 |
+ '/etc/oracle-release', |
|
19 |
+ '/etc/slackware-version', |
|
20 |
+ '/etc/redhat-release', |
|
21 |
+ '/etc/vmware-release', |
|
22 |
+ '/etc/openwrt_release', |
|
23 |
+ '/etc/system-release', |
|
24 |
+ '/etc/alpine-release', |
|
25 |
+ '/etc/release', |
|
26 |
+ '/etc/arch-release', |
|
27 |
+ '/etc/os-release', |
|
28 |
+ '/etc/SuSE-release', |
|
29 |
+ '/etc/gentoo-release', |
|
30 |
+ '/etc/os-release', |
|
31 |
+ '/etc/lsb-release', |
|
32 |
+ '/etc/altlinux-release', |
|
33 |
+ '/etc/os-release', |
|
34 |
+ '/etc/coreos/update.conf', |
|
35 | 35 |
] |
36 | 36 |
|
37 | 37 |
fcont = {} |
... | ... |
@@ -187,15 +187,15 @@ class AdHocCLI(CLI): |
187 | 187 |
self._tqm = None |
188 | 188 |
try: |
189 | 189 |
self._tqm = TaskQueueManager( |
190 |
- inventory=inventory, |
|
191 |
- variable_manager=variable_manager, |
|
192 |
- loader=loader, |
|
193 |
- options=self.options, |
|
194 |
- passwords=passwords, |
|
195 |
- stdout_callback=cb, |
|
196 |
- run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, |
|
197 |
- run_tree=run_tree, |
|
198 |
- ) |
|
190 |
+ inventory=inventory, |
|
191 |
+ variable_manager=variable_manager, |
|
192 |
+ loader=loader, |
|
193 |
+ options=self.options, |
|
194 |
+ passwords=passwords, |
|
195 |
+ stdout_callback=cb, |
|
196 |
+ run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, |
|
197 |
+ run_tree=run_tree, |
|
198 |
+ ) |
|
199 | 199 |
|
200 | 200 |
result = self._tqm.run(play) |
201 | 201 |
finally: |
... | ... |
@@ -198,15 +198,15 @@ class ConsoleCLI(CLI, cmd.Cmd): |
198 | 198 |
self._tqm = None |
199 | 199 |
try: |
200 | 200 |
self._tqm = TaskQueueManager( |
201 |
- inventory=self.inventory, |
|
202 |
- variable_manager=self.variable_manager, |
|
203 |
- loader=self.loader, |
|
204 |
- options=self.options, |
|
205 |
- passwords=self.passwords, |
|
206 |
- stdout_callback=cb, |
|
207 |
- run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, |
|
208 |
- run_tree=False, |
|
209 |
- ) |
|
201 |
+ inventory=self.inventory, |
|
202 |
+ variable_manager=self.variable_manager, |
|
203 |
+ loader=self.loader, |
|
204 |
+ options=self.options, |
|
205 |
+ passwords=self.passwords, |
|
206 |
+ stdout_callback=cb, |
|
207 |
+ run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, |
|
208 |
+ run_tree=False, |
|
209 |
+ ) |
|
210 | 210 |
|
211 | 211 |
result = self._tqm.run(play) |
212 | 212 |
finally: |
... | ... |
@@ -177,7 +177,7 @@ class PlayIterator: |
177 | 177 |
setup_task.name = 'Gathering Facts' |
178 | 178 |
setup_task.tags = ['always'] |
179 | 179 |
setup_task.args = { |
180 |
- 'gather_subset': gather_subset, |
|
180 |
+ 'gather_subset': gather_subset, |
|
181 | 181 |
} |
182 | 182 |
if gather_timeout: |
183 | 183 |
setup_task.args['gather_timeout'] = gather_timeout |
... | ... |
@@ -35,26 +35,26 @@ BOOLEANS = BOOLEANS_TRUE + BOOLEANS_FALSE |
35 | 35 |
SIZE_RANGES = { 'Y': 1<<80, 'Z': 1<<70, 'E': 1<<60, 'P': 1<<50, 'T': 1<<40, 'G': 1<<30, 'M': 1<<20, 'K': 1<<10, 'B': 1 } |
36 | 36 |
|
37 | 37 |
FILE_ATTRIBUTES = { |
38 |
- 'A': 'noatime', |
|
39 |
- 'a': 'append', |
|
40 |
- 'c': 'compressed', |
|
41 |
- 'C': 'nocow', |
|
42 |
- 'd': 'nodump', |
|
43 |
- 'D': 'dirsync', |
|
44 |
- 'e': 'extents', |
|
45 |
- 'E': 'encrypted', |
|
46 |
- 'h': 'blocksize', |
|
47 |
- 'i': 'immutable', |
|
48 |
- 'I': 'indexed', |
|
49 |
- 'j': 'journalled', |
|
50 |
- 'N': 'inline', |
|
51 |
- 's': 'zero', |
|
52 |
- 'S': 'synchronous', |
|
53 |
- 't': 'notail', |
|
54 |
- 'T': 'blockroot', |
|
55 |
- 'u': 'undelete', |
|
56 |
- 'X': 'compressedraw', |
|
57 |
- 'Z': 'compresseddirty', |
|
38 |
+ 'A': 'noatime', |
|
39 |
+ 'a': 'append', |
|
40 |
+ 'c': 'compressed', |
|
41 |
+ 'C': 'nocow', |
|
42 |
+ 'd': 'nodump', |
|
43 |
+ 'D': 'dirsync', |
|
44 |
+ 'e': 'extents', |
|
45 |
+ 'E': 'encrypted', |
|
46 |
+ 'h': 'blocksize', |
|
47 |
+ 'i': 'immutable', |
|
48 |
+ 'I': 'indexed', |
|
49 |
+ 'j': 'journalled', |
|
50 |
+ 'N': 'inline', |
|
51 |
+ 's': 'zero', |
|
52 |
+ 'S': 'synchronous', |
|
53 |
+ 't': 'notail', |
|
54 |
+ 'T': 'blockroot', |
|
55 |
+ 'u': 'undelete', |
|
56 |
+ 'X': 'compressedraw', |
|
57 |
+ 'Z': 'compresseddirty', |
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
# ansible modules can be written in any language. To simplify |
... | ... |
@@ -728,19 +728,19 @@ class AnsibleModule(object): |
728 | 728 |
self._set_defaults(pre=True) |
729 | 729 |
|
730 | 730 |
self._CHECK_ARGUMENT_TYPES_DISPATCHER = { |
731 |
- 'str': self._check_type_str, |
|
732 |
- 'list': self._check_type_list, |
|
733 |
- 'dict': self._check_type_dict, |
|
734 |
- 'bool': self._check_type_bool, |
|
735 |
- 'int': self._check_type_int, |
|
736 |
- 'float': self._check_type_float, |
|
737 |
- 'path': self._check_type_path, |
|
738 |
- 'raw': self._check_type_raw, |
|
739 |
- 'jsonarg': self._check_type_jsonarg, |
|
740 |
- 'json': self._check_type_jsonarg, |
|
741 |
- 'bytes': self._check_type_bytes, |
|
742 |
- 'bits': self._check_type_bits, |
|
743 |
- } |
|
731 |
+ 'str': self._check_type_str, |
|
732 |
+ 'list': self._check_type_list, |
|
733 |
+ 'dict': self._check_type_dict, |
|
734 |
+ 'bool': self._check_type_bool, |
|
735 |
+ 'int': self._check_type_int, |
|
736 |
+ 'float': self._check_type_float, |
|
737 |
+ 'path': self._check_type_path, |
|
738 |
+ 'raw': self._check_type_raw, |
|
739 |
+ 'jsonarg': self._check_type_jsonarg, |
|
740 |
+ 'json': self._check_type_jsonarg, |
|
741 |
+ 'bytes': self._check_type_bytes, |
|
742 |
+ 'bits': self._check_type_bits, |
|
743 |
+ } |
|
744 | 744 |
if not bypass_checks: |
745 | 745 |
self._check_required_arguments() |
746 | 746 |
self._check_argument_types() |
... | ... |
@@ -1078,22 +1078,22 @@ class LinuxHardware(Hardware): |
1078 | 1078 |
memstats['swap:used'] = memstats['swaptotal'] - memstats['swapfree'] |
1079 | 1079 |
|
1080 | 1080 |
self.facts['memory_mb'] = { |
1081 |
- 'real' : { |
|
1082 |
- 'total': memstats.get('memtotal'), |
|
1083 |
- 'used': memstats.get('real:used'), |
|
1084 |
- 'free': memstats.get('memfree'), |
|
1085 |
- }, |
|
1086 |
- 'nocache' : { |
|
1087 |
- 'free': memstats.get('nocache:free'), |
|
1088 |
- 'used': memstats.get('nocache:used'), |
|
1089 |
- }, |
|
1090 |
- 'swap' : { |
|
1091 |
- 'total': memstats.get('swaptotal'), |
|
1092 |
- 'free': memstats.get('swapfree'), |
|
1093 |
- 'used': memstats.get('swap:used'), |
|
1094 |
- 'cached': memstats.get('swapcached'), |
|
1095 |
- }, |
|
1096 |
- } |
|
1081 |
+ 'real' : { |
|
1082 |
+ 'total': memstats.get('memtotal'), |
|
1083 |
+ 'used': memstats.get('real:used'), |
|
1084 |
+ 'free': memstats.get('memfree'), |
|
1085 |
+ }, |
|
1086 |
+ 'nocache' : { |
|
1087 |
+ 'free': memstats.get('nocache:free'), |
|
1088 |
+ 'used': memstats.get('nocache:used'), |
|
1089 |
+ }, |
|
1090 |
+ 'swap' : { |
|
1091 |
+ 'total': memstats.get('swaptotal'), |
|
1092 |
+ 'free': memstats.get('swapfree'), |
|
1093 |
+ 'used': memstats.get('swap:used'), |
|
1094 |
+ 'cached': memstats.get('swapcached'), |
|
1095 |
+ }, |
|
1096 |
+ } |
|
1097 | 1097 |
|
1098 | 1098 |
def get_cpu_facts(self): |
1099 | 1099 |
i = 0 |
... | ... |
@@ -1212,15 +1212,15 @@ class LinuxHardware(Hardware): |
1212 | 1212 |
"CompactPCI", "AdvancedTCA", "Blade" ] |
1213 | 1213 |
|
1214 | 1214 |
DMI_DICT = { |
1215 |
- 'bios_date': '/sys/devices/virtual/dmi/id/bios_date', |
|
1216 |
- 'bios_version': '/sys/devices/virtual/dmi/id/bios_version', |
|
1217 |
- 'form_factor': '/sys/devices/virtual/dmi/id/chassis_type', |
|
1218 |
- 'product_name': '/sys/devices/virtual/dmi/id/product_name', |
|
1219 |
- 'product_serial': '/sys/devices/virtual/dmi/id/product_serial', |
|
1220 |
- 'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid', |
|
1221 |
- 'product_version': '/sys/devices/virtual/dmi/id/product_version', |
|
1222 |
- 'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor' |
|
1223 |
- } |
|
1215 |
+ 'bios_date': '/sys/devices/virtual/dmi/id/bios_date', |
|
1216 |
+ 'bios_version': '/sys/devices/virtual/dmi/id/bios_version', |
|
1217 |
+ 'form_factor': '/sys/devices/virtual/dmi/id/chassis_type', |
|
1218 |
+ 'product_name': '/sys/devices/virtual/dmi/id/product_name', |
|
1219 |
+ 'product_serial': '/sys/devices/virtual/dmi/id/product_serial', |
|
1220 |
+ 'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid', |
|
1221 |
+ 'product_version': '/sys/devices/virtual/dmi/id/product_version', |
|
1222 |
+ 'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor' |
|
1223 |
+ } |
|
1224 | 1224 |
|
1225 | 1225 |
for (key,path) in DMI_DICT.items(): |
1226 | 1226 |
data = get_file_content(path) |
... | ... |
@@ -1239,15 +1239,15 @@ class LinuxHardware(Hardware): |
1239 | 1239 |
# Fall back to using dmidecode, if available |
1240 | 1240 |
dmi_bin = self.module.get_bin_path('dmidecode') |
1241 | 1241 |
DMI_DICT = { |
1242 |
- 'bios_date': 'bios-release-date', |
|
1243 |
- 'bios_version': 'bios-version', |
|
1244 |
- 'form_factor': 'chassis-type', |
|
1245 |
- 'product_name': 'system-product-name', |
|
1246 |
- 'product_serial': 'system-serial-number', |
|
1247 |
- 'product_uuid': 'system-uuid', |
|
1248 |
- 'product_version': 'system-version', |
|
1249 |
- 'system_vendor': 'system-manufacturer' |
|
1250 |
- } |
|
1242 |
+ 'bios_date': 'bios-release-date', |
|
1243 |
+ 'bios_version': 'bios-version', |
|
1244 |
+ 'form_factor': 'chassis-type', |
|
1245 |
+ 'product_name': 'system-product-name', |
|
1246 |
+ 'product_serial': 'system-serial-number', |
|
1247 |
+ 'product_uuid': 'system-uuid', |
|
1248 |
+ 'product_version': 'system-version', |
|
1249 |
+ 'system_vendor': 'system-manufacturer' |
|
1250 |
+ } |
|
1251 | 1251 |
for (k, v) in DMI_DICT.items(): |
1252 | 1252 |
if dmi_bin is not None: |
1253 | 1253 |
(rc, out, err) = self.module.run_command('%s -s %s' % (dmi_bin, v)) |
... | ... |
@@ -77,7 +77,7 @@ def _get_gcp_ansible_credentials(module): |
77 | 77 |
def _get_gcp_environ_var(var_name, default_value): |
78 | 78 |
"""Wrapper around os.environ.get call.""" |
79 | 79 |
return os.environ.get( |
80 |
- var_name, default_value) |
|
80 |
+ var_name, default_value) |
|
81 | 81 |
|
82 | 82 |
def _get_gcp_environment_credentials(service_account_email, credentials_file, project_id): |
83 | 83 |
"""Helper to look in environment variables for credentials.""" |
... | ... |
@@ -315,7 +315,7 @@ def get_google_cloud_credentials(module, scopes=[]): |
315 | 315 |
credentials = credentials.with_scopes(scopes) |
316 | 316 |
else: |
317 | 317 |
credentials = google.auth.default( |
318 |
- scopes=scopes)[0] |
|
318 |
+ scopes=scopes)[0] |
|
319 | 319 |
|
320 | 320 |
return (credentials, conn_params) |
321 | 321 |
except Exception as e: |
... | ... |
@@ -103,7 +103,7 @@ class Nxapi(NxapiConfigMixin): |
103 | 103 |
command_type = self.OUTPUT_TO_COMMAND_TYPE[output] |
104 | 104 |
except KeyError: |
105 | 105 |
msg = 'invalid format, received %s, expected one of %s' % \ |
106 |
- (output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys())) |
|
106 |
+ (output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys())) |
|
107 | 107 |
self._error(msg=msg) |
108 | 108 |
|
109 | 109 |
if isinstance(commands, (list, set, tuple)): |
... | ... |
@@ -141,7 +141,7 @@ class Rhsm(RegistrationBase): |
141 | 141 |
# Quick version... |
142 | 142 |
if False: |
143 | 143 |
return os.path.isfile('/etc/pki/consumer/cert.pem') and \ |
144 |
- os.path.isfile('/etc/pki/consumer/key.pem') |
|
144 |
+ os.path.isfile('/etc/pki/consumer/key.pem') |
|
145 | 145 |
|
146 | 146 |
args = ['subscription-manager', 'identity'] |
147 | 147 |
rc, stdout, stderr = self.module.run_command(args, check_rc=False) |
... | ... |
@@ -698,19 +698,19 @@ def terminate_vpc(module, vpc_conn, vpc_id=None, cidr=None): |
698 | 698 |
def main(): |
699 | 699 |
argument_spec = ec2_argument_spec() |
700 | 700 |
argument_spec.update(dict( |
701 |
- cidr_block = dict(), |
|
702 |
- instance_tenancy = dict(choices=['default', 'dedicated'], default='default'), |
|
703 |
- wait = dict(type='bool', default=False), |
|
704 |
- wait_timeout = dict(default=300), |
|
705 |
- dns_support = dict(type='bool', default=True), |
|
706 |
- dns_hostnames = dict(type='bool', default=True), |
|
707 |
- subnets = dict(type='list'), |
|
708 |
- vpc_id = dict(), |
|
709 |
- internet_gateway = dict(type='bool', default=False), |
|
710 |
- resource_tags = dict(type='dict', required=True), |
|
711 |
- route_tables = dict(type='list'), |
|
712 |
- state = dict(choices=['present', 'absent'], default='present'), |
|
713 |
- ) |
|
701 |
+ cidr_block = dict(), |
|
702 |
+ instance_tenancy = dict(choices=['default', 'dedicated'], default='default'), |
|
703 |
+ wait = dict(type='bool', default=False), |
|
704 |
+ wait_timeout = dict(default=300), |
|
705 |
+ dns_support = dict(type='bool', default=True), |
|
706 |
+ dns_hostnames = dict(type='bool', default=True), |
|
707 |
+ subnets = dict(type='list'), |
|
708 |
+ vpc_id = dict(), |
|
709 |
+ internet_gateway = dict(type='bool', default=False), |
|
710 |
+ resource_tags = dict(type='dict', required=True), |
|
711 |
+ route_tables = dict(type='list'), |
|
712 |
+ state = dict(choices=['present', 'absent'], default='present'), |
|
713 |
+ ) |
|
714 | 714 |
) |
715 | 715 |
|
716 | 716 |
module = AnsibleModule( |
... | ... |
@@ -15,9 +15,9 @@ |
15 | 15 |
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
|
17 | 17 |
ANSIBLE_METADATA = { |
18 |
- 'version': '1.0', |
|
19 |
- 'status': ['preview'], |
|
20 |
- 'supported_by': 'committer' |
|
18 |
+ 'version': '1.0', |
|
19 |
+ 'status': ['preview'], |
|
20 |
+ 'supported_by': 'committer' |
|
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
DOCUMENTATION = ''' |
... | ... |
@@ -236,14 +236,14 @@ def assert_policy_shape(policy): |
236 | 236 |
def main(): |
237 | 237 |
argument_spec = ansible.module_utils.ec2.ec2_argument_spec() |
238 | 238 |
argument_spec.update(dict( |
239 |
- mode = dict(choices=['grant', 'deny'], default='grant'), |
|
240 |
- key_alias = dict(required=False, type='str'), |
|
241 |
- key_arn = dict(required=False, type='str'), |
|
242 |
- role_name = dict(required=False, type='str'), |
|
243 |
- role_arn = dict(required=False, type='str'), |
|
244 |
- grant_types = dict(required=False, type='list'), |
|
245 |
- clean_invalid_entries = dict(type='bool', default=True), |
|
246 |
- ) |
|
239 |
+ mode = dict(choices=['grant', 'deny'], default='grant'), |
|
240 |
+ key_alias = dict(required=False, type='str'), |
|
241 |
+ key_arn = dict(required=False, type='str'), |
|
242 |
+ role_name = dict(required=False, type='str'), |
|
243 |
+ role_arn = dict(required=False, type='str'), |
|
244 |
+ grant_types = dict(required=False, type='list'), |
|
245 |
+ clean_invalid_entries = dict(type='bool', default=True), |
|
246 |
+ ) |
|
247 | 247 |
) |
248 | 248 |
|
249 | 249 |
module = AnsibleModule( |
... | ... |
@@ -390,18 +390,18 @@ def get_stack_facts(cfn, stack_name): |
390 | 390 |
def main(): |
391 | 391 |
argument_spec = ansible.module_utils.ec2.ec2_argument_spec() |
392 | 392 |
argument_spec.update(dict( |
393 |
- stack_name=dict(required=True), |
|
394 |
- template_parameters=dict(required=False, type='dict', default={}), |
|
395 |
- state=dict(default='present', choices=['present', 'absent']), |
|
396 |
- template=dict(default=None, required=False, type='path'), |
|
397 |
- notification_arns=dict(default=None, required=False), |
|
398 |
- stack_policy=dict(default=None, required=False), |
|
399 |
- disable_rollback=dict(default=False, type='bool'), |
|
400 |
- template_url=dict(default=None, required=False), |
|
401 |
- template_format=dict(default=None, choices=['json', 'yaml'], required=False), |
|
402 |
- role_arn=dict(default=None, required=False), |
|
403 |
- tags=dict(default=None, type='dict') |
|
404 |
- ) |
|
393 |
+ stack_name=dict(required=True), |
|
394 |
+ template_parameters=dict(required=False, type='dict', default={}), |
|
395 |
+ state=dict(default='present', choices=['present', 'absent']), |
|
396 |
+ template=dict(default=None, required=False, type='path'), |
|
397 |
+ notification_arns=dict(default=None, required=False), |
|
398 |
+ stack_policy=dict(default=None, required=False), |
|
399 |
+ disable_rollback=dict(default=False, type='bool'), |
|
400 |
+ template_url=dict(default=None, required=False), |
|
401 |
+ template_format=dict(default=None, choices=['json', 'yaml'], required=False), |
|
402 |
+ role_arn=dict(default=None, required=False), |
|
403 |
+ tags=dict(default=None, type='dict') |
|
404 |
+ ) |
|
405 | 405 |
) |
406 | 406 |
|
407 | 407 |
module = AnsibleModule( |
... | ... |
@@ -413,7 +413,7 @@ def main(): |
413 | 413 |
|
414 | 414 |
# collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around. |
415 | 415 |
stack_params = { |
416 |
- 'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], |
|
416 |
+ 'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], |
|
417 | 417 |
} |
418 | 418 |
state = module.params['state'] |
419 | 419 |
stack_params['StackName'] = module.params['stack_name'] |
... | ... |
@@ -1135,18 +1135,18 @@ def create_instances(module, ec2, vpc, override_count=None): |
1135 | 1135 |
if not spot_price: |
1136 | 1136 |
if assign_public_ip and private_ip: |
1137 | 1137 |
params.update(dict( |
1138 |
- min_count = count_remaining, |
|
1139 |
- max_count = count_remaining, |
|
1140 |
- client_token = id, |
|
1141 |
- placement_group = placement_group, |
|
1138 |
+ min_count = count_remaining, |
|
1139 |
+ max_count = count_remaining, |
|
1140 |
+ client_token = id, |
|
1141 |
+ placement_group = placement_group, |
|
1142 | 1142 |
)) |
1143 | 1143 |
else: |
1144 | 1144 |
params.update(dict( |
1145 |
- min_count = count_remaining, |
|
1146 |
- max_count = count_remaining, |
|
1147 |
- client_token = id, |
|
1148 |
- placement_group = placement_group, |
|
1149 |
- private_ip_address = private_ip, |
|
1145 |
+ min_count = count_remaining, |
|
1146 |
+ max_count = count_remaining, |
|
1147 |
+ client_token = id, |
|
1148 |
+ placement_group = placement_group, |
|
1149 |
+ private_ip_address = private_ip, |
|
1150 | 1150 |
)) |
1151 | 1151 |
|
1152 | 1152 |
# For ordinary (not spot) instances, we can select 'stop' |
... | ... |
@@ -1537,56 +1537,56 @@ def restart_instances(module, ec2, instance_ids, state, instance_tags): |
1537 | 1537 |
def main(): |
1538 | 1538 |
argument_spec = ec2_argument_spec() |
1539 | 1539 |
argument_spec.update(dict( |
1540 |
- key_name = dict(aliases = ['keypair']), |
|
1541 |
- id = dict(), |
|
1542 |
- group = dict(type='list', aliases=['groups']), |
|
1543 |
- group_id = dict(type='list'), |
|
1544 |
- zone = dict(aliases=['aws_zone', 'ec2_zone']), |
|
1545 |
- instance_type = dict(aliases=['type']), |
|
1546 |
- spot_price = dict(), |
|
1547 |
- spot_type = dict(default='one-time', choices=["one-time", "persistent"]), |
|
1548 |
- spot_launch_group = dict(), |
|
1549 |
- image = dict(), |
|
1550 |
- kernel = dict(), |
|
1551 |
- count = dict(type='int', default='1'), |
|
1552 |
- monitoring = dict(type='bool', default=False), |
|
1553 |
- ramdisk = dict(), |
|
1554 |
- wait = dict(type='bool', default=False), |
|
1555 |
- wait_timeout = dict(default=300), |
|
1556 |
- spot_wait_timeout = dict(default=600), |
|
1557 |
- placement_group = dict(), |
|
1558 |
- user_data = dict(), |
|
1559 |
- instance_tags = dict(type='dict'), |
|
1560 |
- vpc_subnet_id = dict(), |
|
1561 |
- assign_public_ip = dict(type='bool', default=False), |
|
1562 |
- private_ip = dict(), |
|
1563 |
- instance_profile_name = dict(), |
|
1564 |
- instance_ids = dict(type='list', aliases=['instance_id']), |
|
1565 |
- source_dest_check = dict(type='bool', default=True), |
|
1566 |
- termination_protection = dict(type='bool', default=None), |
|
1567 |
- state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']), |
|
1568 |
- instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']), |
|
1569 |
- exact_count = dict(type='int', default=None), |
|
1570 |
- count_tag = dict(), |
|
1571 |
- volumes = dict(type='list'), |
|
1572 |
- ebs_optimized = dict(type='bool', default=False), |
|
1573 |
- tenancy = dict(default='default'), |
|
1574 |
- network_interfaces = dict(type='list', aliases=['network_interface']) |
|
1575 |
- ) |
|
1540 |
+ key_name = dict(aliases = ['keypair']), |
|
1541 |
+ id = dict(), |
|
1542 |
+ group = dict(type='list', aliases=['groups']), |
|
1543 |
+ group_id = dict(type='list'), |
|
1544 |
+ zone = dict(aliases=['aws_zone', 'ec2_zone']), |
|
1545 |
+ instance_type = dict(aliases=['type']), |
|
1546 |
+ spot_price = dict(), |
|
1547 |
+ spot_type = dict(default='one-time', choices=["one-time", "persistent"]), |
|
1548 |
+ spot_launch_group = dict(), |
|
1549 |
+ image = dict(), |
|
1550 |
+ kernel = dict(), |
|
1551 |
+ count = dict(type='int', default='1'), |
|
1552 |
+ monitoring = dict(type='bool', default=False), |
|
1553 |
+ ramdisk = dict(), |
|
1554 |
+ wait = dict(type='bool', default=False), |
|
1555 |
+ wait_timeout = dict(default=300), |
|
1556 |
+ spot_wait_timeout = dict(default=600), |
|
1557 |
+ placement_group = dict(), |
|
1558 |
+ user_data = dict(), |
|
1559 |
+ instance_tags = dict(type='dict'), |
|
1560 |
+ vpc_subnet_id = dict(), |
|
1561 |
+ assign_public_ip = dict(type='bool', default=False), |
|
1562 |
+ private_ip = dict(), |
|
1563 |
+ instance_profile_name = dict(), |
|
1564 |
+ instance_ids = dict(type='list', aliases=['instance_id']), |
|
1565 |
+ source_dest_check = dict(type='bool', default=True), |
|
1566 |
+ termination_protection = dict(type='bool', default=None), |
|
1567 |
+ state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']), |
|
1568 |
+ instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']), |
|
1569 |
+ exact_count = dict(type='int', default=None), |
|
1570 |
+ count_tag = dict(), |
|
1571 |
+ volumes = dict(type='list'), |
|
1572 |
+ ebs_optimized = dict(type='bool', default=False), |
|
1573 |
+ tenancy = dict(default='default'), |
|
1574 |
+ network_interfaces = dict(type='list', aliases=['network_interface']) |
|
1575 |
+ ) |
|
1576 | 1576 |
) |
1577 | 1577 |
|
1578 | 1578 |
module = AnsibleModule( |
1579 | 1579 |
argument_spec=argument_spec, |
1580 | 1580 |
mutually_exclusive = [ |
1581 |
- ['exact_count', 'count'], |
|
1582 |
- ['exact_count', 'state'], |
|
1583 |
- ['exact_count', 'instance_ids'], |
|
1584 |
- ['network_interfaces', 'assign_public_ip'], |
|
1585 |
- ['network_interfaces', 'group'], |
|
1586 |
- ['network_interfaces', 'group_id'], |
|
1587 |
- ['network_interfaces', 'private_ip'], |
|
1588 |
- ['network_interfaces', 'vpc_subnet_id'], |
|
1589 |
- ], |
|
1581 |
+ ['exact_count', 'count'], |
|
1582 |
+ ['exact_count', 'state'], |
|
1583 |
+ ['exact_count', 'instance_ids'], |
|
1584 |
+ ['network_interfaces', 'assign_public_ip'], |
|
1585 |
+ ['network_interfaces', 'group'], |
|
1586 |
+ ['network_interfaces', 'group_id'], |
|
1587 |
+ ['network_interfaces', 'private_ip'], |
|
1588 |
+ ['network_interfaces', 'vpc_subnet_id'], |
|
1589 |
+ ], |
|
1590 | 1590 |
) |
1591 | 1591 |
|
1592 | 1592 |
if not HAS_BOTO: |
... | ... |
@@ -584,23 +584,23 @@ def update_image(module, ec2, image_id): |
584 | 584 |
def main(): |
585 | 585 |
argument_spec = ec2_argument_spec() |
586 | 586 |
argument_spec.update(dict( |
587 |
- instance_id = dict(), |
|
588 |
- image_id = dict(), |
|
589 |
- architecture = dict(default="x86_64"), |
|
590 |
- kernel_id = dict(), |
|
591 |
- virtualization_type = dict(default="hvm"), |
|
592 |
- root_device_name = dict(), |
|
593 |
- delete_snapshot = dict(default=False, type='bool'), |
|
594 |
- name = dict(), |
|
595 |
- wait = dict(type='bool', default=False), |
|
596 |
- wait_timeout = dict(default=900), |
|
597 |
- description = dict(default=""), |
|
598 |
- no_reboot = dict(default=False, type='bool'), |
|
599 |
- state = dict(default='present'), |
|
600 |
- device_mapping = dict(type='list'), |
|
601 |
- tags = dict(type='dict'), |
|
602 |
- launch_permissions = dict(type='dict') |
|
603 |
- ) |
|
587 |
+ instance_id = dict(), |
|
588 |
+ image_id = dict(), |
|
589 |
+ architecture = dict(default="x86_64"), |
|
590 |
+ kernel_id = dict(), |
|
591 |
+ virtualization_type = dict(default="hvm"), |
|
592 |
+ root_device_name = dict(), |
|
593 |
+ delete_snapshot = dict(default=False, type='bool'), |
|
594 |
+ name = dict(), |
|
595 |
+ wait = dict(type='bool', default=False), |
|
596 |
+ wait_timeout = dict(default=900), |
|
597 |
+ description = dict(default=""), |
|
598 |
+ no_reboot = dict(default=False, type='bool'), |
|
599 |
+ state = dict(default='present'), |
|
600 |
+ device_mapping = dict(type='list'), |
|
601 |
+ tags = dict(type='dict'), |
|
602 |
+ launch_permissions = dict(type='dict') |
|
603 |
+ ) |
|
604 | 604 |
) |
605 | 605 |
module = AnsibleModule(argument_spec=argument_spec) |
606 | 606 |
|
... | ... |
@@ -173,9 +173,9 @@ def copy_image(module, ec2): |
173 | 173 |
ec2.get_waiter('image_available').wait(ImageIds=[image_id]) |
174 | 174 |
if module.params.get('tags'): |
175 | 175 |
ec2.create_tags( |
176 |
- Resources=[image_id], |
|
177 |
- Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()] |
|
178 |
- ) |
|
176 |
+ Resources=[image_id], |
|
177 |
+ Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()] |
|
178 |
+ ) |
|
179 | 179 |
|
180 | 180 |
module.exit_json(changed=True, image_id=image_id) |
181 | 181 |
except WaiterError as we: |
... | ... |
@@ -298,27 +298,27 @@ def get_block_device_mapping(image): |
298 | 298 |
def main(): |
299 | 299 |
argument_spec = ec2_argument_spec() |
300 | 300 |
argument_spec.update(dict( |
301 |
- owner = dict(required=False, default=None), |
|
302 |
- ami_id = dict(required=False), |
|
303 |
- ami_tags = dict(required=False, type='dict', |
|
301 |
+ owner = dict(required=False, default=None), |
|
302 |
+ ami_id = dict(required=False), |
|
303 |
+ ami_tags = dict(required=False, type='dict', |
|
304 | 304 |
aliases = ['search_tags', 'image_tags']), |
305 |
- architecture = dict(required=False), |
|
306 |
- hypervisor = dict(required=False), |
|
307 |
- is_public = dict(required=False, type='bool'), |
|
308 |
- name = dict(required=False), |
|
309 |
- platform = dict(required=False), |
|
310 |
- sort = dict(required=False, default=None, |
|
305 |
+ architecture = dict(required=False), |
|
306 |
+ hypervisor = dict(required=False), |
|
307 |
+ is_public = dict(required=False, type='bool'), |
|
308 |
+ name = dict(required=False), |
|
309 |
+ platform = dict(required=False), |
|
310 |
+ sort = dict(required=False, default=None, |
|
311 | 311 |
choices=['name', 'description', 'tag', 'architecture', 'block_device_mapping', 'creationDate', 'hypervisor', 'is_public', 'location', 'owner_id', 'platform', 'root_device_name', 'root_device_type', 'state', 'virtualization_type']), |
312 |
- sort_tag = dict(required=False), |
|
313 |
- sort_order = dict(required=False, default='ascending', |
|
312 |
+ sort_tag = dict(required=False), |
|
313 |
+ sort_order = dict(required=False, default='ascending', |
|
314 | 314 |
choices=['ascending', 'descending']), |
315 |
- sort_start = dict(required=False), |
|
316 |
- sort_end = dict(required=False), |
|
317 |
- state = dict(required=False, default='available'), |
|
318 |
- virtualization_type = dict(required=False), |
|
319 |
- no_result_action = dict(required=False, default='success', |
|
315 |
+ sort_start = dict(required=False), |
|
316 |
+ sort_end = dict(required=False), |
|
317 |
+ state = dict(required=False, default='available'), |
|
318 |
+ virtualization_type = dict(required=False), |
|
319 |
+ no_result_action = dict(required=False, default='success', |
|
320 | 320 |
choices = ['success', 'fail']), |
321 |
- ) |
|
321 |
+ ) |
|
322 | 322 |
) |
323 | 323 |
|
324 | 324 |
module = AnsibleModule( |
... | ... |
@@ -473,21 +473,21 @@ def create_autoscaling_group(connection, module): |
473 | 473 |
if len(launch_configs) == 0: |
474 | 474 |
module.fail_json(msg="No launch config found with name %s" % launch_config_name) |
475 | 475 |
ag = AutoScalingGroup( |
476 |
- group_name=group_name, |
|
477 |
- load_balancers=load_balancers, |
|
478 |
- availability_zones=availability_zones, |
|
479 |
- launch_config=launch_configs[0], |
|
480 |
- min_size=min_size, |
|
481 |
- max_size=max_size, |
|
482 |
- placement_group=placement_group, |
|
483 |
- desired_capacity=desired_capacity, |
|
484 |
- vpc_zone_identifier=vpc_zone_identifier, |
|
485 |
- connection=connection, |
|
486 |
- tags=asg_tags, |
|
487 |
- health_check_period=health_check_period, |
|
488 |
- health_check_type=health_check_type, |
|
489 |
- default_cooldown=default_cooldown, |
|
490 |
- termination_policies=termination_policies) |
|
476 |
+ group_name=group_name, |
|
477 |
+ load_balancers=load_balancers, |
|
478 |
+ availability_zones=availability_zones, |
|
479 |
+ launch_config=launch_configs[0], |
|
480 |
+ min_size=min_size, |
|
481 |
+ max_size=max_size, |
|
482 |
+ placement_group=placement_group, |
|
483 |
+ desired_capacity=desired_capacity, |
|
484 |
+ vpc_zone_identifier=vpc_zone_identifier, |
|
485 |
+ connection=connection, |
|
486 |
+ tags=asg_tags, |
|
487 |
+ health_check_period=health_check_period, |
|
488 |
+ health_check_type=health_check_type, |
|
489 |
+ default_cooldown=default_cooldown, |
|
490 |
+ termination_policies=termination_policies) |
|
491 | 491 |
|
492 | 492 |
try: |
493 | 493 |
connection.create_auto_scaling_group(ag) |
... | ... |
@@ -326,13 +326,13 @@ class ElbManager: |
326 | 326 |
def main(): |
327 | 327 |
argument_spec = ec2_argument_spec() |
328 | 328 |
argument_spec.update(dict( |
329 |
- state={'required': True}, |
|
330 |
- instance_id={'required': True}, |
|
331 |
- ec2_elbs={'default': None, 'required': False, 'type':'list'}, |
|
332 |
- enable_availability_zone={'default': True, 'required': False, 'type': 'bool'}, |
|
333 |
- wait={'required': False, 'default': True, 'type': 'bool'}, |
|
334 |
- wait_timeout={'required': False, 'default': 0, 'type': 'int'} |
|
335 |
- ) |
|
329 |
+ state={'required': True}, |
|
330 |
+ instance_id={'required': True}, |
|
331 |
+ ec2_elbs={'default': None, 'required': False, 'type':'list'}, |
|
332 |
+ enable_availability_zone={'default': True, 'required': False, 'type': 'bool'}, |
|
333 |
+ wait={'required': False, 'default': True, 'type': 'bool'}, |
|
334 |
+ wait_timeout={'required': False, 'default': 0, 'type': 'int'} |
|
335 |
+ ) |
|
336 | 336 |
) |
337 | 337 |
|
338 | 338 |
module = AnsibleModule( |
... | ... |
@@ -195,8 +195,8 @@ class ElbInformation(object): |
195 | 195 |
elb_info['instances_outofservice'] = [inst.instance_id for inst in instance_health if inst.state == 'OutOfService'] |
196 | 196 |
elb_info['instances_outofservice_count'] = len(elb_info['instances_outofservice']) |
197 | 197 |
elb_info['instances_inservice_percent'] = float(elb_info['instances_inservice_count'])/( |
198 |
- float(elb_info['instances_inservice_count']) + |
|
199 |
- float(elb_info['instances_outofservice_count']))*100 |
|
198 |
+ float(elb_info['instances_inservice_count']) + |
|
199 |
+ float(elb_info['instances_outofservice_count']))*100 |
|
200 | 200 |
return elb_info |
201 | 201 |
|
202 | 202 |
|
... | ... |
@@ -221,8 +221,8 @@ class ElbInformation(object): |
221 | 221 |
def main(): |
222 | 222 |
argument_spec = ec2_argument_spec() |
223 | 223 |
argument_spec.update(dict( |
224 |
- names={'default': [], 'type': 'list'} |
|
225 |
- ) |
|
224 |
+ names={'default': [], 'type': 'list'} |
|
225 |
+ ) |
|
226 | 226 |
) |
227 | 227 |
module = AnsibleModule(argument_spec=argument_spec, |
228 | 228 |
supports_check_mode=True) |
... | ... |
@@ -650,7 +650,7 @@ class ElbManager(object): |
650 | 650 |
status_achieved = False |
651 | 651 |
|
652 | 652 |
elb_interfaces = self.ec2_conn.get_all_network_interfaces( |
653 |
- filters={'attachment.instance-owner-id': 'amazon-elb', |
|
653 |
+ filters={'attachment.instance-owner-id': 'amazon-elb', |
|
654 | 654 |
'description': 'ELB {0}'.format(self.name) }) |
655 | 655 |
|
656 | 656 |
for x in range(0, max_retries): |
... | ... |
@@ -1227,29 +1227,29 @@ class ElbManager(object): |
1227 | 1227 |
def main(): |
1228 | 1228 |
argument_spec = ec2_argument_spec() |
1229 | 1229 |
argument_spec.update(dict( |
1230 |
- state={'required': True, 'choices': ['present', 'absent']}, |
|
1231 |
- name={'required': True}, |
|
1232 |
- listeners={'default': None, 'required': False, 'type': 'list'}, |
|
1233 |
- purge_listeners={'default': True, 'required': False, 'type': 'bool'}, |
|
1234 |
- instance_ids={'default': None, 'required': False, 'type': 'list'}, |
|
1235 |
- purge_instance_ids={'default': False, 'required': False, 'type': 'bool'}, |
|
1236 |
- zones={'default': None, 'required': False, 'type': 'list'}, |
|
1237 |
- purge_zones={'default': False, 'required': False, 'type': 'bool'}, |
|
1238 |
- security_group_ids={'default': None, 'required': False, 'type': 'list'}, |
|
1239 |
- security_group_names={'default': None, 'required': False, 'type': 'list'}, |
|
1240 |
- health_check={'default': None, 'required': False, 'type': 'dict'}, |
|
1241 |
- subnets={'default': None, 'required': False, 'type': 'list'}, |
|
1242 |
- purge_subnets={'default': False, 'required': False, 'type': 'bool'}, |
|
1243 |
- scheme={'default': 'internet-facing', 'required': False}, |
|
1244 |
- connection_draining_timeout={'default': None, 'required': False}, |
|
1245 |
- idle_timeout={'default': None, 'required': False}, |
|
1246 |
- cross_az_load_balancing={'default': None, 'required': False}, |
|
1247 |
- stickiness={'default': None, 'required': False, 'type': 'dict'}, |
|
1248 |
- access_logs={'default': None, 'required': False, 'type': 'dict'}, |
|
1249 |
- wait={'default': False, 'type': 'bool', 'required': False}, |
|
1250 |
- wait_timeout={'default': 60, 'type': 'int', 'required': False}, |
|
1251 |
- tags={'default': None, 'required': False, 'type': 'dict'} |
|
1252 |
- ) |
|
1230 |
+ state={'required': True, 'choices': ['present', 'absent']}, |
|
1231 |
+ name={'required': True}, |
|
1232 |
+ listeners={'default': None, 'required': False, 'type': 'list'}, |
|
1233 |
+ purge_listeners={'default': True, 'required': False, 'type': 'bool'}, |
|
1234 |
+ instance_ids={'default': None, 'required': False, 'type': 'list'}, |
|
1235 |
+ purge_instance_ids={'default': False, 'required': False, 'type': 'bool'}, |
|
1236 |
+ zones={'default': None, 'required': False, 'type': 'list'}, |
|
1237 |
+ purge_zones={'default': False, 'required': False, 'type': 'bool'}, |
|
1238 |
+ security_group_ids={'default': None, 'required': False, 'type': 'list'}, |
|
1239 |
+ security_group_names={'default': None, 'required': False, 'type': 'list'}, |
|
1240 |
+ health_check={'default': None, 'required': False, 'type': 'dict'}, |
|
1241 |
+ subnets={'default': None, 'required': False, 'type': 'list'}, |
|
1242 |
+ purge_subnets={'default': False, 'required': False, 'type': 'bool'}, |
|
1243 |
+ scheme={'default': 'internet-facing', 'required': False}, |
|
1244 |
+ connection_draining_timeout={'default': None, 'required': False}, |
|
1245 |
+ idle_timeout={'default': None, 'required': False}, |
|
1246 |
+ cross_az_load_balancing={'default': None, 'required': False}, |
|
1247 |
+ stickiness={'default': None, 'required': False, 'type': 'dict'}, |
|
1248 |
+ access_logs={'default': None, 'required': False, 'type': 'dict'}, |
|
1249 |
+ wait={'default': False, 'type': 'bool', 'required': False}, |
|
1250 |
+ wait_timeout={'default': 60, 'type': 'int', 'required': False}, |
|
1251 |
+ tags={'default': None, 'required': False, 'type': 'dict'} |
|
1252 |
+ ) |
|
1253 | 1253 |
) |
1254 | 1254 |
|
1255 | 1255 |
module = AnsibleModule( |
... | ... |
@@ -532,12 +532,12 @@ def main(): |
532 | 532 |
module = AnsibleModule(argument_spec=argument_spec, |
533 | 533 |
mutually_exclusive=[ |
534 | 534 |
['secondary_private_ip_addresses', 'secondary_private_ip_address_count'] |
535 |
- ], |
|
535 |
+ ], |
|
536 | 536 |
required_if=([ |
537 | 537 |
('state', 'present', ['subnet_id']), |
538 | 538 |
('state', 'absent', ['eni_id']), |
539 | 539 |
('attached', True, ['instance_id']) |
540 |
- ]) |
|
540 |
+ ]) |
|
541 | 541 |
) |
542 | 542 |
|
543 | 543 |
if not HAS_BOTO: |
... | ... |
@@ -176,8 +176,8 @@ def main(): |
176 | 176 |
argument_spec = url_argument_spec() |
177 | 177 |
|
178 | 178 |
module = AnsibleModule( |
179 |
- argument_spec=argument_spec, |
|
180 |
- supports_check_mode=True, |
|
179 |
+ argument_spec=argument_spec, |
|
180 |
+ supports_check_mode=True, |
|
181 | 181 |
) |
182 | 182 |
|
183 | 183 |
ec2_facts = Ec2Metadata(module).run() |
... | ... |
@@ -241,16 +241,16 @@ def get_target_from_rule(module, ec2, rule, name, group, groups, vpc_id): |
241 | 241 |
def main(): |
242 | 242 |
argument_spec = ec2_argument_spec() |
243 | 243 |
argument_spec.update(dict( |
244 |
- name=dict(type='str', required=True), |
|
245 |
- description=dict(type='str', required=True), |
|
246 |
- vpc_id=dict(type='str'), |
|
247 |
- rules=dict(type='list'), |
|
248 |
- rules_egress=dict(type='list'), |
|
249 |
- state = dict(default='present', type='str', choices=['present', 'absent']), |
|
250 |
- purge_rules=dict(default=True, required=False, type='bool'), |
|
251 |
- purge_rules_egress=dict(default=True, required=False, type='bool'), |
|
252 |
- |
|
253 |
- ) |
|
244 |
+ name=dict(type='str', required=True), |
|
245 |
+ description=dict(type='str', required=True), |
|
246 |
+ vpc_id=dict(type='str'), |
|
247 |
+ rules=dict(type='list'), |
|
248 |
+ rules_egress=dict(type='list'), |
|
249 |
+ state = dict(default='present', type='str', choices=['present', 'absent']), |
|
250 |
+ purge_rules=dict(default=True, required=False, type='bool'), |
|
251 |
+ purge_rules_egress=dict(default=True, required=False, type='bool'), |
|
252 |
+ |
|
253 |
+ ) |
|
254 | 254 |
) |
255 | 255 |
module = AnsibleModule( |
256 | 256 |
argument_spec=argument_spec, |
... | ... |
@@ -427,12 +427,12 @@ def main(): |
427 | 427 |
|
428 | 428 |
if not module.check_mode: |
429 | 429 |
ec2.authorize_security_group_egress( |
430 |
- group_id=group.id, |
|
431 |
- ip_protocol=rule['proto'], |
|
432 |
- from_port=rule['from_port'], |
|
433 |
- to_port=rule['to_port'], |
|
434 |
- src_group_id=grantGroup, |
|
435 |
- cidr_ip=thisip) |
|
430 |
+ group_id=group.id, |
|
431 |
+ ip_protocol=rule['proto'], |
|
432 |
+ from_port=rule['from_port'], |
|
433 |
+ to_port=rule['to_port'], |
|
434 |
+ src_group_id=grantGroup, |
|
435 |
+ cidr_ip=thisip) |
|
436 | 436 |
changed = True |
437 | 437 |
elif vpc_id: |
438 | 438 |
# when using a vpc, but no egress rules are specified, |
... | ... |
@@ -462,12 +462,12 @@ def main(): |
462 | 462 |
grantGroup = groups[grant.group_id].id |
463 | 463 |
if not module.check_mode: |
464 | 464 |
ec2.revoke_security_group_egress( |
465 |
- group_id=group.id, |
|
466 |
- ip_protocol=rule.ip_protocol, |
|
467 |
- from_port=rule.from_port, |
|
468 |
- to_port=rule.to_port, |
|
469 |
- src_group_id=grantGroup, |
|
470 |
- cidr_ip=grant.cidr_ip) |
|
465 |
+ group_id=group.id, |
|
466 |
+ ip_protocol=rule.ip_protocol, |
|
467 |
+ from_port=rule.from_port, |
|
468 |
+ to_port=rule.to_port, |
|
469 |
+ src_group_id=grantGroup, |
|
470 |
+ cidr_ip=grant.cidr_ip) |
|
471 | 471 |
changed = True |
472 | 472 |
|
473 | 473 |
if group: |
... | ... |
@@ -108,12 +108,12 @@ import string |
108 | 108 |
def main(): |
109 | 109 |
argument_spec = ec2_argument_spec() |
110 | 110 |
argument_spec.update(dict( |
111 |
- name=dict(required=True), |
|
112 |
- key_material=dict(required=False), |
|
113 |
- state = dict(default='present', choices=['present', 'absent']), |
|
114 |
- wait = dict(type='bool', default=False), |
|
115 |
- wait_timeout = dict(default=300), |
|
116 |
- ) |
|
111 |
+ name=dict(required=True), |
|
112 |
+ key_material=dict(required=False), |
|
113 |
+ state = dict(default='present', choices=['present', 'absent']), |
|
114 |
+ wait = dict(type='bool', default=False), |
|
115 |
+ wait_timeout = dict(default=300), |
|
116 |
+ ) |
|
117 | 117 |
) |
118 | 118 |
module = AnsibleModule( |
119 | 119 |
argument_spec=argument_spec, |
... | ... |
@@ -229,7 +229,7 @@ def create_launch_config(connection, module): |
229 | 229 |
result = dict( |
230 | 230 |
((a[0], a[1]) for a in vars(launch_configs[0]).items() |
231 | 231 |
if a[0] not in ('connection', 'created_time', 'instance_monitoring', 'block_device_mappings')) |
232 |
- ) |
|
232 |
+ ) |
|
233 | 233 |
result['created_time'] = str(launch_configs[0].created_time) |
234 | 234 |
# Looking at boto's launchconfig.py, it looks like this could be a boolean |
235 | 235 |
# value or an object with an enabled attribute. The enabled attribute |
... | ... |
@@ -127,9 +127,9 @@ def get_instance_info(instance): |
127 | 127 |
'requester_id': instance.requester_id, |
128 | 128 |
'monitoring_state': instance.monitoring_state, |
129 | 129 |
'placement': { |
130 |
- 'tenancy': instance._placement.tenancy, |
|
131 |
- 'zone': instance._placement.zone |
|
132 |
- }, |
|
130 |
+ 'tenancy': instance._placement.tenancy, |
|
131 |
+ 'zone': instance._placement.zone |
|
132 |
+ }, |
|
133 | 133 |
'ami_launch_index': instance.ami_launch_index, |
134 | 134 |
'launch_time': instance.launch_time, |
135 | 135 |
'hypervisor': instance.hypervisor, |
... | ... |
@@ -130,10 +130,10 @@ except ImportError: |
130 | 130 |
def main(): |
131 | 131 |
argument_spec = ec2_argument_spec() |
132 | 132 |
argument_spec.update(dict( |
133 |
- resource = dict(required=True), |
|
134 |
- tags = dict(type='dict'), |
|
135 |
- state = dict(default='present', choices=['present', 'absent', 'list']), |
|
136 |
- ) |
|
133 |
+ resource = dict(required=True), |
|
134 |
+ tags = dict(type='dict'), |
|
135 |
+ state = dict(default='present', choices=['present', 'absent', 'list']), |
|
136 |
+ ) |
|
137 | 137 |
) |
138 | 138 |
module = AnsibleModule(argument_spec=argument_spec) |
139 | 139 |
|
... | ... |
@@ -470,23 +470,23 @@ def get_volume_info(volume, state): |
470 | 470 |
attachment = volume.attach_data |
471 | 471 |
|
472 | 472 |
volume_info = { |
473 |
- 'create_time': volume.create_time, |
|
474 |
- 'encrypted': volume.encrypted, |
|
475 |
- 'id': volume.id, |
|
476 |
- 'iops': volume.iops, |
|
477 |
- 'size': volume.size, |
|
478 |
- 'snapshot_id': volume.snapshot_id, |
|
479 |
- 'status': volume.status, |
|
480 |
- 'type': volume.type, |
|
481 |
- 'zone': volume.zone, |
|
482 |
- 'attachment_set': { |
|
483 |
- 'attach_time': attachment.attach_time, |
|
484 |
- 'device': attachment.device, |
|
485 |
- 'instance_id': attachment.instance_id, |
|
486 |
- 'status': attachment.status |
|
487 |
- }, |
|
488 |
- 'tags': volume.tags |
|
489 |
- } |
|
473 |
+ 'create_time': volume.create_time, |
|
474 |
+ 'encrypted': volume.encrypted, |
|
475 |
+ 'id': volume.id, |
|
476 |
+ 'iops': volume.iops, |
|
477 |
+ 'size': volume.size, |
|
478 |
+ 'snapshot_id': volume.snapshot_id, |
|
479 |
+ 'status': volume.status, |
|
480 |
+ 'type': volume.type, |
|
481 |
+ 'zone': volume.zone, |
|
482 |
+ 'attachment_set': { |
|
483 |
+ 'attach_time': attachment.attach_time, |
|
484 |
+ 'device': attachment.device, |
|
485 |
+ 'instance_id': attachment.instance_id, |
|
486 |
+ 'status': attachment.status |
|
487 |
+ }, |
|
488 |
+ 'tags': volume.tags |
|
489 |
+ } |
|
490 | 490 |
if hasattr(attachment, 'deleteOnTermination'): |
491 | 491 |
volume_info['attachment_set']['deleteOnTermination'] = attachment.deleteOnTermination |
492 | 492 |
|
... | ... |
@@ -496,20 +496,20 @@ def get_volume_info(volume, state): |
496 | 496 |
def main(): |
497 | 497 |
argument_spec = ec2_argument_spec() |
498 | 498 |
argument_spec.update(dict( |
499 |
- instance = dict(), |
|
500 |
- id = dict(), |
|
501 |
- name = dict(), |
|
502 |
- volume_size = dict(), |
|
503 |
- volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'), |
|
504 |
- iops = dict(), |
|
505 |
- encrypted = dict(type='bool', default=False), |
|
506 |
- kms_key_id = dict(), |
|
507 |
- device_name = dict(), |
|
508 |
- delete_on_termination = dict(type='bool', default=False), |
|
509 |
- zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']), |
|
510 |
- snapshot = dict(), |
|
511 |
- state = dict(choices=['absent', 'present', 'list'], default='present') |
|
512 |
- ) |
|
499 |
+ instance = dict(), |
|
500 |
+ id = dict(), |
|
501 |
+ name = dict(), |
|
502 |
+ volume_size = dict(), |
|
503 |
+ volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'), |
|
504 |
+ iops = dict(), |
|
505 |
+ encrypted = dict(type='bool', default=False), |
|
506 |
+ kms_key_id = dict(), |
|
507 |
+ device_name = dict(), |
|
508 |
+ delete_on_termination = dict(type='bool', default=False), |
|
509 |
+ zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']), |
|
510 |
+ snapshot = dict(), |
|
511 |
+ state = dict(choices=['absent', 'present', 'list'], default='present') |
|
512 |
+ ) |
|
513 | 513 |
) |
514 | 514 |
module = AnsibleModule(argument_spec=argument_spec) |
515 | 515 |
|
... | ... |
@@ -79,24 +79,24 @@ def get_volume_info(volume): |
79 | 79 |
attachment = volume.attach_data |
80 | 80 |
|
81 | 81 |
volume_info = { |
82 |
- 'create_time': volume.create_time, |
|
83 |
- 'id': volume.id, |
|
84 |
- 'encrypted': volume.encrypted, |
|
85 |
- 'iops': volume.iops, |
|
86 |
- 'size': volume.size, |
|
87 |
- 'snapshot_id': volume.snapshot_id, |
|
88 |
- 'status': volume.status, |
|
89 |
- 'type': volume.type, |
|
90 |
- 'zone': volume.zone, |
|
91 |
- 'region': volume.region.name, |
|
92 |
- 'attachment_set': { |
|
93 |
- 'attach_time': attachment.attach_time, |
|
94 |
- 'device': attachment.device, |
|
95 |
- 'instance_id': attachment.instance_id, |
|
96 |
- 'status': attachment.status |
|
97 |
- }, |
|
98 |
- 'tags': volume.tags |
|
99 |
- } |
|
82 |
+ 'create_time': volume.create_time, |
|
83 |
+ 'id': volume.id, |
|
84 |
+ 'encrypted': volume.encrypted, |
|
85 |
+ 'iops': volume.iops, |
|
86 |
+ 'size': volume.size, |
|
87 |
+ 'snapshot_id': volume.snapshot_id, |
|
88 |
+ 'status': volume.status, |
|
89 |
+ 'type': volume.type, |
|
90 |
+ 'zone': volume.zone, |
|
91 |
+ 'region': volume.region.name, |
|
92 |
+ 'attachment_set': { |
|
93 |
+ 'attach_time': attachment.attach_time, |
|
94 |
+ 'device': attachment.device, |
|
95 |
+ 'instance_id': attachment.instance_id, |
|
96 |
+ 'status': attachment.status |
|
97 |
+ }, |
|
98 |
+ 'tags': volume.tags |
|
99 |
+ } |
|
100 | 100 |
|
101 | 101 |
return volume_info |
102 | 102 |
|
... | ... |
@@ -186,16 +186,16 @@ def get_vpc_values(vpc_obj): |
186 | 186 |
def main(): |
187 | 187 |
argument_spec=ec2_argument_spec() |
188 | 188 |
argument_spec.update(dict( |
189 |
- name = dict(type='str', default=None, required=True), |
|
190 |
- cidr_block = dict(type='str', default=None, required=True), |
|
191 |
- tenancy = dict(choices=['default', 'dedicated'], default='default'), |
|
192 |
- dns_support = dict(type='bool', default=True), |
|
193 |
- dns_hostnames = dict(type='bool', default=True), |
|
194 |
- dhcp_opts_id = dict(type='str', default=None, required=False), |
|
195 |
- tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']), |
|
196 |
- state = dict(choices=['present', 'absent'], default='present'), |
|
197 |
- multi_ok = dict(type='bool', default=False) |
|
198 |
- ) |
|
189 |
+ name = dict(type='str', default=None, required=True), |
|
190 |
+ cidr_block = dict(type='str', default=None, required=True), |
|
191 |
+ tenancy = dict(choices=['default', 'dedicated'], default='default'), |
|
192 |
+ dns_support = dict(type='bool', default=True), |
|
193 |
+ dns_hostnames = dict(type='bool', default=True), |
|
194 |
+ dhcp_opts_id = dict(type='str', default=None, required=False), |
|
195 |
+ tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']), |
|
196 |
+ state = dict(choices=['present', 'absent'], default='present'), |
|
197 |
+ multi_ok = dict(type='bool', default=False) |
|
198 |
+ ) |
|
199 | 199 |
) |
200 | 200 |
|
201 | 201 |
module = AnsibleModule( |
... | ... |
@@ -150,7 +150,7 @@ def create_subnet(vpc_conn, vpc_id, cidr, az, check_mode): |
150 | 150 |
subnet = None |
151 | 151 |
else: |
152 | 152 |
raise AnsibleVPCSubnetCreationException( |
153 |
- 'Unable to create subnet {0}, error: {1}'.format(cidr, e)) |
|
153 |
+ 'Unable to create subnet {0}, error: {1}'.format(cidr, e)) |
|
154 | 154 |
|
155 | 155 |
return subnet |
156 | 156 |
|
... | ... |
@@ -106,12 +106,12 @@ except ImportError: |
106 | 106 |
def main(): |
107 | 107 |
argument_spec = ec2_argument_spec() |
108 | 108 |
argument_spec.update(dict( |
109 |
- instance_id = dict(required=True), |
|
110 |
- key_file = dict(required=True), |
|
111 |
- key_passphrase = dict(no_log=True, default=None, required=False), |
|
112 |
- wait = dict(type='bool', default=False, required=False), |
|
113 |
- wait_timeout = dict(default=120, required=False), |
|
114 |
- ) |
|
109 |
+ instance_id = dict(required=True), |
|
110 |
+ key_file = dict(required=True), |
|
111 |
+ key_passphrase = dict(no_log=True, default=None, required=False), |
|
112 |
+ wait = dict(type='bool', default=False, required=False), |
|
113 |
+ wait_timeout = dict(default=120, required=False), |
|
114 |
+ ) |
|
115 | 115 |
) |
116 | 116 |
module = AnsibleModule(argument_spec=argument_spec) |
117 | 117 |
|
... | ... |
@@ -483,22 +483,22 @@ class ElastiCacheManager(object): |
483 | 483 |
def main(): |
484 | 484 |
argument_spec = ec2_argument_spec() |
485 | 485 |
argument_spec.update(dict( |
486 |
- state ={'required': True, 'choices': ['present', 'absent', 'rebooted']}, |
|
487 |
- name ={'required': True}, |
|
488 |
- engine ={'required': False, 'default': 'memcached'}, |
|
489 |
- cache_engine_version ={'required': False}, |
|
490 |
- node_type ={'required': False, 'default': 'cache.m1.small'}, |
|
491 |
- num_nodes ={'required': False, 'default': None, 'type': 'int'}, |
|
492 |
- # alias for compat with the original PR 1950 |
|
493 |
- cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']}, |
|
494 |
- cache_port ={'required': False, 'type': 'int'}, |
|
495 |
- cache_subnet_group ={'required': False, 'default': None}, |
|
496 |
- cache_security_groups ={'required': False, 'default': [], 'type': 'list'}, |
|
497 |
- security_group_ids ={'required': False, 'default': [], 'type': 'list'}, |
|
498 |
- zone ={'required': False, 'default': None}, |
|
499 |
- wait ={'required': False, 'type' : 'bool', 'default': True}, |
|
500 |
- hard_modify ={'required': False, 'type': 'bool', 'default': False} |
|
501 |
- ) |
|
486 |
+ state ={'required': True, 'choices': ['present', 'absent', 'rebooted']}, |
|
487 |
+ name ={'required': True}, |
|
488 |
+ engine ={'required': False, 'default': 'memcached'}, |
|
489 |
+ cache_engine_version ={'required': False}, |
|
490 |
+ node_type ={'required': False, 'default': 'cache.m1.small'}, |
|
491 |
+ num_nodes ={'required': False, 'default': None, 'type': 'int'}, |
|
492 |
+ # alias for compat with the original PR 1950 |
|
493 |
+ cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']}, |
|
494 |
+ cache_port ={'required': False, 'type': 'int'}, |
|
495 |
+ cache_subnet_group ={'required': False, 'default': None}, |
|
496 |
+ cache_security_groups ={'required': False, 'default': [], 'type': 'list'}, |
|
497 |
+ security_group_ids ={'required': False, 'default': [], 'type': 'list'}, |
|
498 |
+ zone ={'required': False, 'default': None}, |
|
499 |
+ wait ={'required': False, 'type' : 'bool', 'default': True}, |
|
500 |
+ hard_modify ={'required': False, 'type': 'bool', 'default': False} |
|
501 |
+ ) |
|
502 | 502 |
) |
503 | 503 |
|
504 | 504 |
module = AnsibleModule( |
... | ... |
@@ -80,11 +80,11 @@ except ImportError: |
80 | 80 |
def main(): |
81 | 81 |
argument_spec = ec2_argument_spec() |
82 | 82 |
argument_spec.update(dict( |
83 |
- state = dict(required=True, choices=['present', 'absent']), |
|
84 |
- name = dict(required=True), |
|
85 |
- description = dict(required=False), |
|
86 |
- subnets = dict(required=False, type='list'), |
|
87 |
- ) |
|
83 |
+ state = dict(required=True, choices=['present', 'absent']), |
|
84 |
+ name = dict(required=True), |
|
85 |
+ description = dict(required=False), |
|
86 |
+ subnets = dict(required=False, type='list'), |
|
87 |
+ ) |
|
88 | 88 |
) |
89 | 89 |
module = AnsibleModule(argument_spec=argument_spec) |
90 | 90 |
|
... | ... |
@@ -297,9 +297,9 @@ def update_user(module, iam, name, new_name, new_path, key_state, key_count, key |
297 | 297 |
error_msg = boto_exception(err) |
298 | 298 |
if 'cannot be found' in error_msg and updated: |
299 | 299 |
current_keys, status = \ |
300 |
- [ck['access_key_id'] for ck in |
|
300 |
+ [ck['access_key_id'] for ck in |
|
301 | 301 |
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata],\ |
302 |
- [ck['status'] for ck in |
|
302 |
+ [ck['status'] for ck in |
|
303 | 303 |
iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata] |
304 | 304 |
name = new_name |
305 | 305 |
else: |
... | ... |
@@ -129,9 +129,9 @@ def boto_exception(err): |
129 | 129 |
|
130 | 130 |
def cert_meta(iam, name): |
131 | 131 |
opath = iam.get_server_certificate(name).get_server_certificate_result.\ |
132 |
- server_certificate.\ |
|
133 |
- server_certificate_metadata.\ |
|
134 |
- path |
|
132 |
+ server_certificate.\ |
|
133 |
+ server_certificate_metadata.\ |
|
134 |
+ path |
|
135 | 135 |
ocert = iam.get_server_certificate(name).get_server_certificate_result.\ |
136 | 136 |
server_certificate.\ |
137 | 137 |
certificate_body |
... | ... |
@@ -694,7 +694,7 @@ def create_db_instance(module, conn): |
694 | 694 |
try: |
695 | 695 |
result = conn.create_db_instance(instance_name, module.params.get('size'), |
696 | 696 |
module.params.get('instance_type'), module.params.get('db_engine'), |
697 |
- module.params.get('username'), module.params.get('password'), **params) |
|
697 |
+ module.params.get('username'), module.params.get('password'), **params) |
|
698 | 698 |
changed = True |
699 | 699 |
except RDSException as e: |
700 | 700 |
module.fail_json(msg="Failed to create instance: %s" % e.message) |
... | ... |
@@ -953,40 +953,40 @@ def validate_parameters(required_vars, valid_vars, module): |
953 | 953 |
|
954 | 954 |
# map to convert rds module options to boto rds and rds2 options |
955 | 955 |
optional_params = { |
956 |
- 'port': 'port', |
|
957 |
- 'db_name': 'db_name', |
|
958 |
- 'zone': 'availability_zone', |
|
959 |
- 'maint_window': 'preferred_maintenance_window', |
|
960 |
- 'backup_window': 'preferred_backup_window', |
|
961 |
- 'backup_retention': 'backup_retention_period', |
|
962 |
- 'multi_zone': 'multi_az', |
|
963 |
- 'engine_version': 'engine_version', |
|
964 |
- 'upgrade': 'auto_minor_version_upgrade', |
|
965 |
- 'subnet': 'db_subnet_group_name', |
|
966 |
- 'license_model': 'license_model', |
|
967 |
- 'option_group': 'option_group_name', |
|
968 |
- 'size': 'allocated_storage', |
|
969 |
- 'iops': 'iops', |
|
970 |
- 'new_instance_name': 'new_instance_id', |
|
971 |
- 'apply_immediately': 'apply_immediately', |
|
956 |
+ 'port': 'port', |
|
957 |
+ 'db_name': 'db_name', |
|
958 |
+ 'zone': 'availability_zone', |
|
959 |
+ 'maint_window': 'preferred_maintenance_window', |
|
960 |
+ 'backup_window': 'preferred_backup_window', |
|
961 |
+ 'backup_retention': 'backup_retention_period', |
|
962 |
+ 'multi_zone': 'multi_az', |
|
963 |
+ 'engine_version': 'engine_version', |
|
964 |
+ 'upgrade': 'auto_minor_version_upgrade', |
|
965 |
+ 'subnet': 'db_subnet_group_name', |
|
966 |
+ 'license_model': 'license_model', |
|
967 |
+ 'option_group': 'option_group_name', |
|
968 |
+ 'size': 'allocated_storage', |
|
969 |
+ 'iops': 'iops', |
|
970 |
+ 'new_instance_name': 'new_instance_id', |
|
971 |
+ 'apply_immediately': 'apply_immediately', |
|
972 | 972 |
} |
973 | 973 |
# map to convert rds module options to boto rds options |
974 | 974 |
optional_params_rds = { |
975 |
- 'db_engine': 'engine', |
|
976 |
- 'password': 'master_password', |
|
977 |
- 'parameter_group': 'param_group', |
|
978 |
- 'instance_type': 'instance_class', |
|
975 |
+ 'db_engine': 'engine', |
|
976 |
+ 'password': 'master_password', |
|
977 |
+ 'parameter_group': 'param_group', |
|
978 |
+ 'instance_type': 'instance_class', |
|
979 | 979 |
} |
980 | 980 |
# map to convert rds module options to boto rds2 options |
981 | 981 |
optional_params_rds2 = { |
982 |
- 'tags': 'tags', |
|
983 |
- 'publicly_accessible': 'publicly_accessible', |
|
984 |
- 'parameter_group': 'db_parameter_group_name', |
|
985 |
- 'character_set_name': 'character_set_name', |
|
986 |
- 'instance_type': 'db_instance_class', |
|
987 |
- 'password': 'master_user_password', |
|
988 |
- 'new_instance_name': 'new_db_instance_identifier', |
|
989 |
- 'force_failover': 'force_failover', |
|
982 |
+ 'tags': 'tags', |
|
983 |
+ 'publicly_accessible': 'publicly_accessible', |
|
984 |
+ 'parameter_group': 'db_parameter_group_name', |
|
985 |
+ 'character_set_name': 'character_set_name', |
|
986 |
+ 'instance_type': 'db_instance_class', |
|
987 |
+ 'password': 'master_user_password', |
|
988 |
+ 'new_instance_name': 'new_db_instance_identifier', |
|
989 |
+ 'force_failover': 'force_failover', |
|
990 | 990 |
} |
991 | 991 |
if has_rds2: |
992 | 992 |
optional_params.update(optional_params_rds2) |
... | ... |
@@ -1029,40 +1029,40 @@ def validate_parameters(required_vars, valid_vars, module): |
1029 | 1029 |
def main(): |
1030 | 1030 |
argument_spec = ec2_argument_spec() |
1031 | 1031 |
argument_spec.update(dict( |
1032 |
- command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True), |
|
1033 |
- instance_name = dict(required=False), |
|
1034 |
- source_instance = dict(required=False), |
|
1035 |
- db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False), |
|
1036 |
- size = dict(required=False), |
|
1037 |
- instance_type = dict(aliases=['type'], required=False), |
|
1038 |
- username = dict(required=False), |
|
1039 |
- password = dict(no_log=True, required=False), |
|
1040 |
- db_name = dict(required=False), |
|
1041 |
- engine_version = dict(required=False), |
|
1042 |
- parameter_group = dict(required=False), |
|
1043 |
- license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False), |
|
1044 |
- multi_zone = dict(type='bool', default=False), |
|
1045 |
- iops = dict(required=False), |
|
1046 |
- security_groups = dict(required=False), |
|
1047 |
- vpc_security_groups = dict(type='list', required=False), |
|
1048 |
- port = dict(required=False), |
|
1049 |
- upgrade = dict(type='bool', default=False), |
|
1050 |
- option_group = dict(required=False), |
|
1051 |
- maint_window = dict(required=False), |
|
1052 |
- backup_window = dict(required=False), |
|
1053 |
- backup_retention = dict(required=False), |
|
1054 |
- zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False), |
|
1055 |
- subnet = dict(required=False), |
|
1056 |
- wait = dict(type='bool', default=False), |
|
1057 |
- wait_timeout = dict(type='int', default=300), |
|
1058 |
- snapshot = dict(required=False), |
|
1059 |
- apply_immediately = dict(type='bool', default=False), |
|
1060 |
- new_instance_name = dict(required=False), |
|
1061 |
- tags = dict(type='dict', required=False), |
|
1062 |
- publicly_accessible = dict(required=False), |
|
1063 |
- character_set_name = dict(required=False), |
|
1064 |
- force_failover = dict(type='bool', required=False, default=False) |
|
1065 |
- ) |
|
1032 |
+ command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True), |
|
1033 |
+ instance_name = dict(required=False), |
|
1034 |
+ source_instance = dict(required=False), |
|
1035 |
+ db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False), |
|
1036 |
+ size = dict(required=False), |
|
1037 |
+ instance_type = dict(aliases=['type'], required=False), |
|
1038 |
+ username = dict(required=False), |
|
1039 |
+ password = dict(no_log=True, required=False), |
|
1040 |
+ db_name = dict(required=False), |
|
1041 |
+ engine_version = dict(required=False), |
|
1042 |
+ parameter_group = dict(required=False), |
|
1043 |
+ license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False), |
|
1044 |
+ multi_zone = dict(type='bool', default=False), |
|
1045 |
+ iops = dict(required=False), |
|
1046 |
+ security_groups = dict(required=False), |
|
1047 |
+ vpc_security_groups = dict(type='list', required=False), |
|
1048 |
+ port = dict(required=False), |
|
1049 |
+ upgrade = dict(type='bool', default=False), |
|
1050 |
+ option_group = dict(required=False), |
|
1051 |
+ maint_window = dict(required=False), |
|
1052 |
+ backup_window = dict(required=False), |
|
1053 |
+ backup_retention = dict(required=False), |
|
1054 |
+ zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False), |
|
1055 |
+ subnet = dict(required=False), |
|
1056 |
+ wait = dict(type='bool', default=False), |
|
1057 |
+ wait_timeout = dict(type='int', default=300), |
|
1058 |
+ snapshot = dict(required=False), |
|
1059 |
+ apply_immediately = dict(type='bool', default=False), |
|
1060 |
+ new_instance_name = dict(required=False), |
|
1061 |
+ tags = dict(type='dict', required=False), |
|
1062 |
+ publicly_accessible = dict(required=False), |
|
1063 |
+ character_set_name = dict(required=False), |
|
1064 |
+ force_failover = dict(type='bool', required=False, default=False) |
|
1065 |
+ ) |
|
1066 | 1066 |
) |
1067 | 1067 |
|
1068 | 1068 |
module = AnsibleModule( |
... | ... |
@@ -1073,15 +1073,15 @@ def main(): |
1073 | 1073 |
module.fail_json(msg='boto required for this module') |
1074 | 1074 |
|
1075 | 1075 |
invocations = { |
1076 |
- 'create': create_db_instance, |
|
1077 |
- 'replicate': replicate_db_instance, |
|
1078 |
- 'delete': delete_db_instance_or_snapshot, |
|
1079 |
- 'facts': facts_db_instance_or_snapshot, |
|
1080 |
- 'modify': modify_db_instance, |
|
1081 |
- 'promote': promote_db_instance, |
|
1082 |
- 'snapshot': snapshot_db_instance, |
|
1083 |
- 'reboot': reboot_db_instance, |
|
1084 |
- 'restore': restore_db_instance, |
|
1076 |
+ 'create': create_db_instance, |
|
1077 |
+ 'replicate': replicate_db_instance, |
|
1078 |
+ 'delete': delete_db_instance_or_snapshot, |
|
1079 |
+ 'facts': facts_db_instance_or_snapshot, |
|
1080 |
+ 'modify': modify_db_instance, |
|
1081 |
+ 'promote': promote_db_instance, |
|
1082 |
+ 'snapshot': snapshot_db_instance, |
|
1083 |
+ 'reboot': reboot_db_instance, |
|
1084 |
+ 'restore': restore_db_instance, |
|
1085 | 1085 |
} |
1086 | 1086 |
|
1087 | 1087 |
region, ec2_url, aws_connect_params = get_aws_connection_info(module) |
... | ... |
@@ -219,13 +219,13 @@ def modify_group(group, params, immediate=False): |
219 | 219 |
def main(): |
220 | 220 |
argument_spec = ec2_argument_spec() |
221 | 221 |
argument_spec.update(dict( |
222 |
- state = dict(required=True, choices=['present', 'absent']), |
|
223 |
- name = dict(required=True), |
|
224 |
- engine = dict(required=False, choices=VALID_ENGINES), |
|
225 |
- description = dict(required=False), |
|
226 |
- params = dict(required=False, aliases=['parameters'], type='dict'), |
|
227 |
- immediate = dict(required=False, type='bool'), |
|
228 |
- ) |
|
222 |
+ state = dict(required=True, choices=['present', 'absent']), |
|
223 |
+ name = dict(required=True), |
|
224 |
+ engine = dict(required=False, choices=VALID_ENGINES), |
|
225 |
+ description = dict(required=False), |
|
226 |
+ params = dict(required=False, aliases=['parameters'], type='dict'), |
|
227 |
+ immediate = dict(required=False, type='bool'), |
|
228 |
+ ) |
|
229 | 229 |
) |
230 | 230 |
module = AnsibleModule(argument_spec=argument_spec) |
231 | 231 |
|
... | ... |
@@ -84,11 +84,11 @@ except ImportError: |
84 | 84 |
def main(): |
85 | 85 |
argument_spec = ec2_argument_spec() |
86 | 86 |
argument_spec.update(dict( |
87 |
- state = dict(required=True, choices=['present', 'absent']), |
|
88 |
- name = dict(required=True), |
|
89 |
- description = dict(required=False), |
|
90 |
- subnets = dict(required=False, type='list'), |
|
91 |
- ) |
|
87 |
+ state = dict(required=True, choices=['present', 'absent']), |
|
88 |
+ name = dict(required=True), |
|
89 |
+ description = dict(required=False), |
|
90 |
+ subnets = dict(required=False, type='list'), |
|
91 |
+ ) |
|
92 | 92 |
) |
93 | 93 |
module = AnsibleModule(argument_spec=argument_spec) |
94 | 94 |
|
... | ... |
@@ -410,31 +410,31 @@ def modify_cluster(module, redshift): |
410 | 410 |
def main(): |
411 | 411 |
argument_spec = ec2_argument_spec() |
412 | 412 |
argument_spec.update(dict( |
413 |
- command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True), |
|
414 |
- identifier = dict(required=True), |
|
415 |
- node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False), |
|
416 |
- username = dict(required=False), |
|
417 |
- password = dict(no_log=True, required=False), |
|
418 |
- db_name = dict(require=False), |
|
419 |
- cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'), |
|
420 |
- cluster_security_groups = dict(aliases=['security_groups'], type='list'), |
|
421 |
- vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'), |
|
422 |
- cluster_subnet_group_name = dict(aliases=['subnet']), |
|
423 |
- availability_zone = dict(aliases=['aws_zone', 'zone']), |
|
424 |
- preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']), |
|
425 |
- cluster_parameter_group_name = dict(aliases=['param_group_name']), |
|
426 |
- automated_snapshot_retention_period = dict(aliases=['retention_period']), |
|
427 |
- port = dict(type='int'), |
|
428 |
- cluster_version = dict(aliases=['version'], choices=['1.0']), |
|
429 |
- allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True), |
|
430 |
- number_of_nodes = dict(type='int'), |
|
431 |
- publicly_accessible = dict(type='bool', default=False), |
|
432 |
- encrypted = dict(type='bool', default=False), |
|
433 |
- elastic_ip = dict(required=False), |
|
434 |
- new_cluster_identifier = dict(aliases=['new_identifier']), |
|
435 |
- wait = dict(type='bool', default=False), |
|
436 |
- wait_timeout = dict(default=300), |
|
437 |
- ) |
|
413 |
+ command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True), |
|
414 |
+ identifier = dict(required=True), |
|
415 |
+ node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False), |
|
416 |
+ username = dict(required=False), |
|
417 |
+ password = dict(no_log=True, required=False), |
|
418 |
+ db_name = dict(require=False), |
|
419 |
+ cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'), |
|
420 |
+ cluster_security_groups = dict(aliases=['security_groups'], type='list'), |
|
421 |
+ vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'), |
|
422 |
+ cluster_subnet_group_name = dict(aliases=['subnet']), |
|
423 |
+ availability_zone = dict(aliases=['aws_zone', 'zone']), |
|
424 |
+ preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']), |
|
425 |
+ cluster_parameter_group_name = dict(aliases=['param_group_name']), |
|
426 |
+ automated_snapshot_retention_period = dict(aliases=['retention_period']), |
|
427 |
+ port = dict(type='int'), |
|
428 |
+ cluster_version = dict(aliases=['version'], choices=['1.0']), |
|
429 |
+ allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True), |
|
430 |
+ number_of_nodes = dict(type='int'), |
|
431 |
+ publicly_accessible = dict(type='bool', default=False), |
|
432 |
+ encrypted = dict(type='bool', default=False), |
|
433 |
+ elastic_ip = dict(required=False), |
|
434 |
+ new_cluster_identifier = dict(aliases=['new_identifier']), |
|
435 |
+ wait = dict(type='bool', default=False), |
|
436 |
+ wait_timeout = dict(default=300), |
|
437 |
+ ) |
|
438 | 438 |
) |
439 | 439 |
|
440 | 440 |
module = AnsibleModule( |
... | ... |
@@ -388,28 +388,28 @@ def invoke_with_throttling_retries(function_ref, *argv): |
388 | 388 |
def main(): |
389 | 389 |
argument_spec = ec2_argument_spec() |
390 | 390 |
argument_spec.update(dict( |
391 |
- command = dict(choices=['get', 'create', 'delete'], required=True), |
|
392 |
- zone = dict(required=True), |
|
393 |
- hosted_zone_id = dict(required=False, default=None), |
|
394 |
- record = dict(required=True), |
|
395 |
- ttl = dict(required=False, type='int', default=3600), |
|
396 |
- type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True), |
|
397 |
- alias = dict(required=False, type='bool'), |
|
398 |
- alias_hosted_zone_id = dict(required=False), |
|
399 |
- alias_evaluate_target_health = dict(required=False, type='bool', default=False), |
|
400 |
- value = dict(required=False), |
|
401 |
- overwrite = dict(required=False, type='bool'), |
|
402 |
- retry_interval = dict(required=False, default=500), |
|
403 |
- private_zone = dict(required=False, type='bool', default=False), |
|
404 |
- identifier = dict(required=False, default=None), |
|
405 |
- weight = dict(required=False, type='int'), |
|
406 |
- region = dict(required=False), |
|
407 |
- health_check = dict(required=False), |
|
408 |
- failover = dict(required=False,choices=['PRIMARY','SECONDARY']), |
|
409 |
- vpc_id = dict(required=False), |
|
410 |
- wait = dict(required=False, type='bool', default=False), |
|
411 |
- wait_timeout = dict(required=False, type='int', default=300), |
|
412 |
- ) |
|
391 |
+ command = dict(choices=['get', 'create', 'delete'], required=True), |
|
392 |
+ zone = dict(required=True), |
|
393 |
+ hosted_zone_id = dict(required=False, default=None), |
|
394 |
+ record = dict(required=True), |
|
395 |
+ ttl = dict(required=False, type='int', default=3600), |
|
396 |
+ type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True), |
|
397 |
+ alias = dict(required=False, type='bool'), |
|
398 |
+ alias_hosted_zone_id = dict(required=False), |
|
399 |
+ alias_evaluate_target_health = dict(required=False, type='bool', default=False), |
|
400 |
+ value = dict(required=False), |
|
401 |
+ overwrite = dict(required=False, type='bool'), |
|
402 |
+ retry_interval = dict(required=False, default=500), |
|
403 |
+ private_zone = dict(required=False, type='bool', default=False), |
|
404 |
+ identifier = dict(required=False, default=None), |
|
405 |
+ weight = dict(required=False, type='int'), |
|
406 |
+ region = dict(required=False), |
|
407 |
+ health_check = dict(required=False), |
|
408 |
+ failover = dict(required=False,choices=['PRIMARY','SECONDARY']), |
|
409 |
+ vpc_id = dict(required=False), |
|
410 |
+ wait = dict(required=False, type='bool', default=False), |
|
411 |
+ wait_timeout = dict(required=False, type='int', default=300), |
|
412 |
+ ) |
|
413 | 413 |
) |
414 | 414 |
module = AnsibleModule(argument_spec=argument_spec) |
415 | 415 |
|
... | ... |
@@ -275,16 +275,16 @@ def update_health_check(conn, health_check_id, health_check_version, health_chec |
275 | 275 |
def main(): |
276 | 276 |
argument_spec = ec2_argument_spec() |
277 | 277 |
argument_spec.update(dict( |
278 |
- state = dict(choices=['present', 'absent'], default='present'), |
|
279 |
- ip_address = dict(), |
|
280 |
- port = dict(type='int'), |
|
281 |
- type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), |
|
282 |
- resource_path = dict(), |
|
283 |
- fqdn = dict(), |
|
284 |
- string_match = dict(), |
|
285 |
- request_interval = dict(type='int', choices=[10, 30], default=30), |
|
286 |
- failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3), |
|
287 |
- ) |
|
278 |
+ state = dict(choices=['present', 'absent'], default='present'), |
|
279 |
+ ip_address = dict(), |
|
280 |
+ port = dict(type='int'), |
|
281 |
+ type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), |
|
282 |
+ resource_path = dict(), |
|
283 |
+ fqdn = dict(), |
|
284 |
+ string_match = dict(), |
|
285 |
+ request_interval = dict(type='int', choices=[10, 30], default=30), |
|
286 |
+ failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3), |
|
287 |
+ ) |
|
288 | 288 |
) |
289 | 289 |
module = AnsibleModule(argument_spec=argument_spec) |
290 | 290 |
|
... | ... |
@@ -138,11 +138,11 @@ from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info |
138 | 138 |
def main(): |
139 | 139 |
argument_spec = ec2_argument_spec() |
140 | 140 |
argument_spec.update(dict( |
141 |
- zone=dict(required=True), |
|
142 |
- state=dict(default='present', choices=['present', 'absent']), |
|
143 |
- vpc_id=dict(default=None), |
|
144 |
- vpc_region=dict(default=None), |
|
145 |
- comment=dict(default=''))) |
|
141 |
+ zone=dict(required=True), |
|
142 |
+ state=dict(default='present', choices=['present', 'absent']), |
|
143 |
+ vpc_id=dict(default=None), |
|
144 |
+ vpc_region=dict(default=None), |
|
145 |
+ comment=dict(default=''))) |
|
146 | 146 |
module = AnsibleModule(argument_spec=argument_spec) |
147 | 147 |
|
148 | 148 |
if not HAS_BOTO: |
... | ... |
@@ -433,25 +433,25 @@ def is_walrus(s3_url): |
433 | 433 |
def main(): |
434 | 434 |
argument_spec = ec2_argument_spec() |
435 | 435 |
argument_spec.update(dict( |
436 |
- bucket = dict(required=True), |
|
437 |
- dest = dict(default=None), |
|
438 |
- encrypt = dict(default=True, type='bool'), |
|
439 |
- expiry = dict(default=600, aliases=['expiration']), |
|
440 |
- headers = dict(type='dict'), |
|
441 |
- marker = dict(default=None), |
|
442 |
- max_keys = dict(default=1000), |
|
443 |
- metadata = dict(type='dict'), |
|
444 |
- mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True), |
|
445 |
- object = dict(), |
|
446 |
- permission = dict(type='list', default=['private']), |
|
447 |
- version = dict(default=None), |
|
448 |
- overwrite = dict(aliases=['force'], default='always'), |
|
449 |
- prefix = dict(default=None), |
|
450 |
- retries = dict(aliases=['retry'], type='int', default=0), |
|
451 |
- s3_url = dict(aliases=['S3_URL']), |
|
452 |
- rgw = dict(default='no', type='bool'), |
|
453 |
- src = dict(), |
|
454 |
- ), |
|
436 |
+ bucket = dict(required=True), |
|
437 |
+ dest = dict(default=None), |
|
438 |
+ encrypt = dict(default=True, type='bool'), |
|
439 |
+ expiry = dict(default=600, aliases=['expiration']), |
|
440 |
+ headers = dict(type='dict'), |
|
441 |
+ marker = dict(default=None), |
|
442 |
+ max_keys = dict(default=1000), |
|
443 |
+ metadata = dict(type='dict'), |
|
444 |
+ mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True), |
|
445 |
+ object = dict(), |
|
446 |
+ permission = dict(type='list', default=['private']), |
|
447 |
+ version = dict(default=None), |
|
448 |
+ overwrite = dict(aliases=['force'], default='always'), |
|
449 |
+ prefix = dict(default=None), |
|
450 |
+ retries = dict(aliases=['retry'], type='int', default=0), |
|
451 |
+ s3_url = dict(aliases=['S3_URL']), |
|
452 |
+ rgw = dict(default='no', type='bool'), |
|
453 |
+ src = dict(), |
|
454 |
+ ), |
|
455 | 455 |
) |
456 | 456 |
module = AnsibleModule(argument_spec=argument_spec) |
457 | 457 |
|
... | ... |
@@ -377,11 +377,11 @@ def main(): |
377 | 377 |
|
378 | 378 |
module = AnsibleModule(argument_spec=argument_spec, |
379 | 379 |
mutually_exclusive = [ |
380 |
- [ 'expiration_days', 'expiration_date' ], |
|
381 |
- [ 'expiration_days', 'transition_date' ], |
|
382 |
- [ 'transition_days', 'transition_date' ], |
|
383 |
- [ 'transition_days', 'expiration_date' ] |
|
384 |
- ] |
|
380 |
+ [ 'expiration_days', 'expiration_date' ], |
|
381 |
+ [ 'expiration_days', 'transition_date' ], |
|
382 |
+ [ 'transition_days', 'transition_date' ], |
|
383 |
+ [ 'transition_days', 'expiration_date' ] |
|
384 |
+ ] |
|
385 | 385 |
) |
386 | 386 |
|
387 | 387 |
if not HAS_BOTO: |
... | ... |
@@ -306,7 +306,7 @@ def gather_files(fileroot, include=None, exclude=None): |
306 | 306 |
'chopped_path':chopped_path, |
307 | 307 |
'modified_epoch': f_modified_epoch, |
308 | 308 |
'bytes': f_size |
309 |
- }) |
|
309 |
+ }) |
|
310 | 310 |
# dirpath = path *to* the directory |
311 | 311 |
# dirnames = subdirs *in* our directory |
312 | 312 |
# filenames |
... | ... |
@@ -428,7 +428,7 @@ def upload_files(s3, bucket, filelist, params): |
428 | 428 |
ret = [] |
429 | 429 |
for entry in filelist: |
430 | 430 |
args = { |
431 |
- 'ContentType': entry['mime_type'] |
|
431 |
+ 'ContentType': entry['mime_type'] |
|
432 | 432 |
} |
433 | 433 |
if params.get('permission'): |
434 | 434 |
args['ACL'] = params['permission'] |
... | ... |
@@ -440,18 +440,18 @@ def upload_files(s3, bucket, filelist, params): |
440 | 440 |
def main(): |
441 | 441 |
argument_spec = ec2_argument_spec() |
442 | 442 |
argument_spec.update(dict( |
443 |
- mode = dict(choices=['push'], default='push'), |
|
444 |
- file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'), |
|
445 |
- bucket = dict(required=True), |
|
446 |
- key_prefix = dict(required=False, default=''), |
|
447 |
- file_root = dict(required=True, type='path'), |
|
448 |
- permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']), |
|
449 |
- retries = dict(required=False), |
|
450 |
- mime_map = dict(required=False, type='dict'), |
|
451 |
- exclude = dict(required=False, default=".*"), |
|
452 |
- include = dict(required=False, default="*"), |
|
453 |
- # future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries |
|
454 |
- ) |
|
443 |
+ mode = dict(choices=['push'], default='push'), |
|
444 |
+ file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'), |
|
445 |
+ bucket = dict(required=True), |
|
446 |
+ key_prefix = dict(required=False, default=''), |
|
447 |
+ file_root = dict(required=True, type='path'), |
|
448 |
+ permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']), |
|
449 |
+ retries = dict(required=False), |
|
450 |
+ mime_map = dict(required=False, type='dict'), |
|
451 |
+ exclude = dict(required=False, default=".*"), |
|
452 |
+ include = dict(required=False, default="*"), |
|
453 |
+ # future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries |
|
454 |
+ ) |
|
455 | 455 |
) |
456 | 456 |
|
457 | 457 |
module = AnsibleModule( |
... | ... |
@@ -267,9 +267,9 @@ def main(): |
267 | 267 |
module = AnsibleModule( |
268 | 268 |
argument_spec=argument_spec, |
269 | 269 |
mutually_exclusive = [ |
270 |
- ['redirect_all_requests', 'suffix'], |
|
271 |
- ['redirect_all_requests', 'error_key'] |
|
272 |
- ]) |
|
270 |
+ ['redirect_all_requests', 'suffix'], |
|
271 |
+ ['redirect_all_requests', 'error_key'] |
|
272 |
+ ]) |
|
273 | 273 |
|
274 | 274 |
if not HAS_BOTO3: |
275 | 275 |
module.fail_json(msg='boto3 required for this module') |
... | ... |
@@ -89,10 +89,10 @@ def core(module): |
89 | 89 |
|
90 | 90 |
def main(): |
91 | 91 |
module = AnsibleModule( |
92 |
- argument_spec = dict( |
|
93 |
- revision = dict(default='latest', required=False, aliases=["version"]), |
|
94 |
- ), |
|
95 |
- ) |
|
92 |
+ argument_spec = dict( |
|
93 |
+ revision = dict(default='latest', required=False, aliases=["version"]), |
|
94 |
+ ), |
|
95 |
+ ) |
|
96 | 96 |
|
97 | 97 |
# Verify that the platform is atomic host |
98 | 98 |
if not os.path.exists("/run/ostree-booted"): |
... | ... |
@@ -119,12 +119,12 @@ def core(module): |
119 | 119 |
|
120 | 120 |
def main(): |
121 | 121 |
module = AnsibleModule( |
122 |
- argument_spec = dict( |
|
123 |
- name = dict(default=None, required=True), |
|
124 |
- state = dict(default='latest', choices=['present', 'absent', 'latest']), |
|
125 |
- started = dict(default='yes', type='bool'), |
|
126 |
- ), |
|
127 |
- ) |
|
122 |
+ argument_spec = dict( |
|
123 |
+ name = dict(default=None, required=True), |
|
124 |
+ state = dict(default='latest', choices=['present', 'absent', 'latest']), |
|
125 |
+ started = dict(default='yes', type='bool'), |
|
126 |
+ ), |
|
127 |
+ ) |
|
128 | 128 |
|
129 | 129 |
# Verify that the platform supports atomic command |
130 | 130 |
rc, out, err = module.run_command('atomic -v', check_rc=False) |
... | ... |
@@ -299,9 +299,9 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack): |
299 | 299 |
|
300 | 300 |
def _icmp_match(self, rule, protocol, icmp_code, icmp_type): |
301 | 301 |
return protocol == 'icmp' \ |
302 |
- and protocol == rule['protocol'] \ |
|
303 |
- and icmp_code == rule['icmpcode'] \ |
|
304 |
- and icmp_type == rule['icmptype'] |
|
302 |
+ and protocol == rule['protocol'] \ |
|
303 |
+ and icmp_code == rule['icmpcode'] \ |
|
304 |
+ and icmp_type == rule['icmptype'] |
|
305 | 305 |
|
306 | 306 |
|
307 | 307 |
def _type_cidr_match(self, rule, cidr): |
... | ... |
@@ -206,27 +206,27 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack): |
206 | 206 |
|
207 | 207 |
def _tcp_udp_match(self, rule, protocol, start_port, end_port): |
208 | 208 |
return protocol in ['tcp', 'udp'] \ |
209 |
- and protocol == rule['protocol'] \ |
|
210 |
- and start_port == int(rule['startport']) \ |
|
211 |
- and end_port == int(rule['endport']) |
|
209 |
+ and protocol == rule['protocol'] \ |
|
210 |
+ and start_port == int(rule['startport']) \ |
|
211 |
+ and end_port == int(rule['endport']) |
|
212 | 212 |
|
213 | 213 |
|
214 | 214 |
def _icmp_match(self, rule, protocol, icmp_code, icmp_type): |
215 | 215 |
return protocol == 'icmp' \ |
216 |
- and protocol == rule['protocol'] \ |
|
217 |
- and icmp_code == int(rule['icmpcode']) \ |
|
218 |
- and icmp_type == int(rule['icmptype']) |
|
216 |
+ and protocol == rule['protocol'] \ |
|
217 |
+ and icmp_code == int(rule['icmpcode']) \ |
|
218 |
+ and icmp_type == int(rule['icmptype']) |
|
219 | 219 |
|
220 | 220 |
|
221 | 221 |
def _ah_esp_gre_match(self, rule, protocol): |
222 | 222 |
return protocol in ['ah', 'esp', 'gre'] \ |
223 |
- and protocol == rule['protocol'] |
|
223 |
+ and protocol == rule['protocol'] |
|
224 | 224 |
|
225 | 225 |
|
226 | 226 |
def _type_security_group_match(self, rule, security_group_name): |
227 | 227 |
return security_group_name \ |
228 |
- and 'securitygroupname' in rule \ |
|
229 |
- and security_group_name == rule['securitygroupname'] |
|
228 |
+ and 'securitygroupname' in rule \ |
|
229 |
+ and security_group_name == rule['securitygroupname'] |
|
230 | 230 |
|
231 | 231 |
|
232 | 232 |
def _type_cidr_match(self, rule, cidr): |
... | ... |
@@ -682,26 +682,26 @@ class DockerManager(object): |
682 | 682 |
# docker-py version is a tuple of ints because we have to compare them |
683 | 683 |
# server APIVersion is passed to a docker-py function that takes strings |
684 | 684 |
_cap_ver_req = { |
685 |
- 'devices': ((0, 7, 0), '1.2'), |
|
686 |
- 'dns': ((0, 3, 0), '1.10'), |
|
687 |
- 'volumes_from': ((0, 3, 0), '1.10'), |
|
688 |
- 'restart_policy': ((0, 5, 0), '1.14'), |
|
689 |
- 'extra_hosts': ((0, 7, 0), '1.3.1'), |
|
690 |
- 'pid': ((1, 0, 0), '1.17'), |
|
691 |
- 'log_driver': ((1, 2, 0), '1.18'), |
|
692 |
- 'log_opt': ((1, 2, 0), '1.18'), |
|
693 |
- 'host_config': ((0, 7, 0), '1.15'), |
|
694 |
- 'cpu_set': ((0, 6, 0), '1.14'), |
|
695 |
- 'cap_add': ((0, 5, 0), '1.14'), |
|
696 |
- 'cap_drop': ((0, 5, 0), '1.14'), |
|
697 |
- 'read_only': ((1, 0, 0), '1.17'), |
|
698 |
- 'labels': ((1, 2, 0), '1.18'), |
|
699 |
- 'stop_timeout': ((0, 5, 0), '1.0'), |
|
700 |
- 'ulimits': ((1, 2, 0), '1.18'), |
|
701 |
- # Clientside only |
|
702 |
- 'insecure_registry': ((0, 5, 0), '0.0'), |
|
703 |
- 'env_file': ((1, 4, 0), '0.0') |
|
704 |
- } |
|
685 |
+ 'devices': ((0, 7, 0), '1.2'), |
|
686 |
+ 'dns': ((0, 3, 0), '1.10'), |
|
687 |
+ 'volumes_from': ((0, 3, 0), '1.10'), |
|
688 |
+ 'restart_policy': ((0, 5, 0), '1.14'), |
|
689 |
+ 'extra_hosts': ((0, 7, 0), '1.3.1'), |
|
690 |
+ 'pid': ((1, 0, 0), '1.17'), |
|
691 |
+ 'log_driver': ((1, 2, 0), '1.18'), |
|
692 |
+ 'log_opt': ((1, 2, 0), '1.18'), |
|
693 |
+ 'host_config': ((0, 7, 0), '1.15'), |
|
694 |
+ 'cpu_set': ((0, 6, 0), '1.14'), |
|
695 |
+ 'cap_add': ((0, 5, 0), '1.14'), |
|
696 |
+ 'cap_drop': ((0, 5, 0), '1.14'), |
|
697 |
+ 'read_only': ((1, 0, 0), '1.17'), |
|
698 |
+ 'labels': ((1, 2, 0), '1.18'), |
|
699 |
+ 'stop_timeout': ((0, 5, 0), '1.0'), |
|
700 |
+ 'ulimits': ((1, 2, 0), '1.18'), |
|
701 |
+ # Clientside only |
|
702 |
+ 'insecure_registry': ((0, 5, 0), '0.0'), |
|
703 |
+ 'env_file': ((1, 4, 0), '0.0') |
|
704 |
+ } |
|
705 | 705 |
|
706 | 706 |
def __init__(self, module): |
707 | 707 |
self.module = module |
... | ... |
@@ -1475,10 +1475,10 @@ class Container(DockerBaseClass): |
1475 | 1475 |
else: |
1476 | 1476 |
expected_devices.append( |
1477 | 1477 |
dict( |
1478 |
- CgroupPermissions=parts[2], |
|
1479 |
- PathInContainer=parts[1], |
|
1480 |
- PathOnHost=parts[0] |
|
1481 |
- )) |
|
1478 |
+ CgroupPermissions=parts[2], |
|
1479 |
+ PathInContainer=parts[1], |
|
1480 |
+ PathOnHost=parts[0] |
|
1481 |
+ )) |
|
1482 | 1482 |
return expected_devices |
1483 | 1483 |
|
1484 | 1484 |
def _get_expected_entrypoint(self): |
... | ... |
@@ -225,7 +225,7 @@ def main(): |
225 | 225 |
try: |
226 | 226 |
gcelb = get_driver_lb(Provider_lb.GCE)(gce_driver=gce) |
227 | 227 |
gcelb.connection.user_agent_append("%s/%s" % ( |
228 |
- USER_AGENT_PRODUCT, USER_AGENT_VERSION)) |
|
228 |
+ USER_AGENT_PRODUCT, USER_AGENT_VERSION)) |
|
229 | 229 |
except Exception as e: |
230 | 230 |
module.fail_json(msg=unexpected_error_msg(e), changed=False) |
231 | 231 |
|
... | ... |
@@ -829,7 +829,7 @@ def main(): |
829 | 829 |
if not autoscaler: |
830 | 830 |
module.fail_json(msg='Unable to fetch autoscaler %s to delete \ |
831 | 831 |
in zone: %s' % (params['autoscaling']['name'], params['zone']), |
832 |
- changed=False) |
|
832 |
+ changed=False) |
|
833 | 833 |
|
834 | 834 |
changed = delete_autoscaler(autoscaler) |
835 | 835 |
json_output['deleted_autoscaler'] = changed |
... | ... |
@@ -254,7 +254,7 @@ def main(): |
254 | 254 |
|
255 | 255 |
if instance_name and inst is None: |
256 | 256 |
module.fail_json(msg='Instance %s does not exist in zone %s' % ( |
257 |
- instance_name, zone), changed=False) |
|
257 |
+ instance_name, zone), changed=False) |
|
258 | 258 |
|
259 | 259 |
if not disk: |
260 | 260 |
if image is not None and snapshot is not None: |
... | ... |
@@ -182,10 +182,10 @@ def main(): |
182 | 182 |
project_id=dict(), |
183 | 183 |
), |
184 | 184 |
mutually_exclusive=[ |
185 |
- [ 'instance_name', 'instance_pattern' ] |
|
185 |
+ [ 'instance_name', 'instance_pattern' ] |
|
186 | 186 |
], |
187 | 187 |
required_one_of=[ |
188 |
- [ 'instance_name', 'instance_pattern' ] |
|
188 |
+ [ 'instance_name', 'instance_pattern' ] |
|
189 | 189 |
] |
190 | 190 |
) |
191 | 191 |
|
... | ... |
@@ -226,17 +226,17 @@ def pull_messages(pull_params, sub): |
226 | 226 |
def main(): |
227 | 227 |
|
228 | 228 |
module = AnsibleModule(argument_spec=dict( |
229 |
- topic=dict(required=True), |
|
230 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
231 |
- publish=dict(type='list', default=None), |
|
232 |
- subscription=dict(type='dict', default=None), |
|
233 |
- service_account_email=dict(), |
|
234 |
- credentials_file=dict(), |
|
235 |
- project_id=dict(), ),) |
|
229 |
+ topic=dict(required=True), |
|
230 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
231 |
+ publish=dict(type='list', default=None), |
|
232 |
+ subscription=dict(type='dict', default=None), |
|
233 |
+ service_account_email=dict(), |
|
234 |
+ credentials_file=dict(), |
|
235 |
+ project_id=dict(), ),) |
|
236 | 236 |
|
237 | 237 |
if not HAS_PYTHON26: |
238 | 238 |
module.fail_json( |
239 |
- msg="GCE module requires python's 'ast' module, python v2.6+") |
|
239 |
+ msg="GCE module requires python's 'ast' module, python v2.6+") |
|
240 | 240 |
|
241 | 241 |
if not HAS_GOOGLE_CLOUD_PUBSUB: |
242 | 242 |
module.fail_json(msg="Please install google-cloud-pubsub library.") |
... | ... |
@@ -307,7 +307,7 @@ def main(): |
307 | 307 |
if s.push_endpoint is not None: |
308 | 308 |
module.fail_json(msg="Cannot pull messages, push_endpoint is configured.") |
309 | 309 |
(json_output['pulled_messages'], changed) = pull_messages( |
310 |
- mod_params['subscription']['pull'], s) |
|
310 |
+ mod_params['subscription']['pull'], s) |
|
311 | 311 |
|
312 | 312 |
# publish messages to the topic |
313 | 313 |
if mod_params['publish'] and len(mod_params['publish']) > 0: |
... | ... |
@@ -102,16 +102,16 @@ def list_func(data, member='name'): |
102 | 102 |
|
103 | 103 |
def main(): |
104 | 104 |
module = AnsibleModule(argument_spec=dict( |
105 |
- view=dict(choices=['topics', 'subscriptions'], default='topics'), |
|
106 |
- topic=dict(required=False), |
|
107 |
- state=dict(choices=['list'], default='list'), |
|
108 |
- service_account_email=dict(), |
|
109 |
- credentials_file=dict(), |
|
110 |
- project_id=dict(), ),) |
|
105 |
+ view=dict(choices=['topics', 'subscriptions'], default='topics'), |
|
106 |
+ topic=dict(required=False), |
|
107 |
+ state=dict(choices=['list'], default='list'), |
|
108 |
+ service_account_email=dict(), |
|
109 |
+ credentials_file=dict(), |
|
110 |
+ project_id=dict(), ),) |
|
111 | 111 |
|
112 | 112 |
if not HAS_PYTHON26: |
113 | 113 |
module.fail_json( |
114 |
- msg="GCE module requires python's 'ast' module, python v2.6+") |
|
114 |
+ msg="GCE module requires python's 'ast' module, python v2.6+") |
|
115 | 115 |
|
116 | 116 |
if not HAS_GOOGLE_CLOUD_PUBSUB: |
117 | 117 |
module.fail_json(msg="Please install google-cloud-pubsub library.") |
... | ... |
@@ -282,13 +282,13 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino |
282 | 282 |
size = servers[0]['TOTALHD'] - swap |
283 | 283 |
if ssh_pub_key: |
284 | 284 |
res = api.linode_disk_createfromdistribution( |
285 |
- LinodeId=linode_id, DistributionID=distribution, |
|
286 |
- rootPass=password, rootSSHKey=ssh_pub_key, |
|
287 |
- Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) |
|
285 |
+ LinodeId=linode_id, DistributionID=distribution, |
|
286 |
+ rootPass=password, rootSSHKey=ssh_pub_key, |
|
287 |
+ Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) |
|
288 | 288 |
else: |
289 | 289 |
res = api.linode_disk_createfromdistribution( |
290 |
- LinodeId=linode_id, DistributionID=distribution, rootPass=password, |
|
291 |
- Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) |
|
290 |
+ LinodeId=linode_id, DistributionID=distribution, rootPass=password, |
|
291 |
+ Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) |
|
292 | 292 |
jobs.append(res['JobID']) |
293 | 293 |
# Create SWAP disk |
294 | 294 |
res = api.linode_disk_create(LinodeId=linode_id, Type='swap', |
... | ... |
@@ -402,33 +402,33 @@ def umount_instance(module, proxmox, vm, vmid, timeout): |
402 | 402 |
|
403 | 403 |
def main(): |
404 | 404 |
module = AnsibleModule( |
405 |
- argument_spec = dict( |
|
406 |
- api_host = dict(required=True), |
|
407 |
- api_user = dict(required=True), |
|
408 |
- api_password = dict(no_log=True), |
|
409 |
- vmid = dict(required=False), |
|
410 |
- validate_certs = dict(type='bool', default='no'), |
|
411 |
- node = dict(), |
|
412 |
- pool = dict(), |
|
413 |
- password = dict(no_log=True), |
|
414 |
- hostname = dict(), |
|
415 |
- ostemplate = dict(), |
|
416 |
- disk = dict(type='str', default='3'), |
|
417 |
- cpus = dict(type='int', default=1), |
|
418 |
- memory = dict(type='int', default=512), |
|
419 |
- swap = dict(type='int', default=0), |
|
420 |
- netif = dict(type='dict'), |
|
421 |
- mounts = dict(type='dict'), |
|
422 |
- ip_address = dict(), |
|
423 |
- onboot = dict(type='bool', default='no'), |
|
424 |
- storage = dict(default='local'), |
|
425 |
- cpuunits = dict(type='int', default=1000), |
|
426 |
- nameserver = dict(), |
|
427 |
- searchdomain = dict(), |
|
428 |
- timeout = dict(type='int', default=30), |
|
429 |
- force = dict(type='bool', default='no'), |
|
430 |
- state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), |
|
431 |
- ) |
|
405 |
+ argument_spec = dict( |
|
406 |
+ api_host = dict(required=True), |
|
407 |
+ api_user = dict(required=True), |
|
408 |
+ api_password = dict(no_log=True), |
|
409 |
+ vmid = dict(required=False), |
|
410 |
+ validate_certs = dict(type='bool', default='no'), |
|
411 |
+ node = dict(), |
|
412 |
+ pool = dict(), |
|
413 |
+ password = dict(no_log=True), |
|
414 |
+ hostname = dict(), |
|
415 |
+ ostemplate = dict(), |
|
416 |
+ disk = dict(type='str', default='3'), |
|
417 |
+ cpus = dict(type='int', default=1), |
|
418 |
+ memory = dict(type='int', default=512), |
|
419 |
+ swap = dict(type='int', default=0), |
|
420 |
+ netif = dict(type='dict'), |
|
421 |
+ mounts = dict(type='dict'), |
|
422 |
+ ip_address = dict(), |
|
423 |
+ onboot = dict(type='bool', default='no'), |
|
424 |
+ storage = dict(default='local'), |
|
425 |
+ cpuunits = dict(type='int', default=1000), |
|
426 |
+ nameserver = dict(), |
|
427 |
+ searchdomain = dict(), |
|
428 |
+ timeout = dict(type='int', default=30), |
|
429 |
+ force = dict(type='bool', default='no'), |
|
430 |
+ state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), |
|
431 |
+ ) |
|
432 | 432 |
) |
433 | 433 |
|
434 | 434 |
if not HAS_PROXMOXER: |
... | ... |
@@ -795,71 +795,71 @@ def stop_vm(module, proxmox, vm, vmid, timeout, force): |
795 | 795 |
|
796 | 796 |
def main(): |
797 | 797 |
module = AnsibleModule( |
798 |
- argument_spec = dict( |
|
799 |
- acpi = dict(type='bool', default='yes'), |
|
800 |
- agent = dict(type='bool'), |
|
801 |
- args = dict(type='str', default=None), |
|
802 |
- api_host = dict(required=True), |
|
803 |
- api_user = dict(required=True), |
|
804 |
- api_password = dict(no_log=True), |
|
805 |
- autostart = dict(type='bool', default='no'), |
|
806 |
- balloon = dict(type='int',default=0), |
|
807 |
- bios = dict(choices=['seabios', 'ovmf']), |
|
808 |
- boot = dict(type='str', default='cnd'), |
|
809 |
- bootdisk = dict(type='str'), |
|
810 |
- cores = dict(type='int', default=1), |
|
811 |
- cpu = dict(type='str', default='kvm64'), |
|
812 |
- cpulimit = dict(type='int'), |
|
813 |
- cpuunits = dict(type='int', default=1000), |
|
814 |
- delete = dict(type='str'), |
|
815 |
- description = dict(type='str'), |
|
816 |
- digest = dict(type='str'), |
|
817 |
- force = dict(type='bool', default=None), |
|
818 |
- freeze = dict(type='bool'), |
|
819 |
- hostpci = dict(type='dict'), |
|
820 |
- hotplug = dict(type='str'), |
|
821 |
- hugepages = dict(choices=['any', '2', '1024']), |
|
822 |
- ide = dict(type='dict', default=None), |
|
823 |
- keyboard = dict(type='str'), |
|
824 |
- kvm = dict(type='bool', default='yes'), |
|
825 |
- localtime = dict(type='bool'), |
|
826 |
- lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']), |
|
827 |
- machine = dict(type='str'), |
|
828 |
- memory = dict(type='int', default=512), |
|
829 |
- migrate_downtime = dict(type='int'), |
|
830 |
- migrate_speed = dict(type='int'), |
|
831 |
- name = dict(type='str'), |
|
832 |
- net = dict(type='dict'), |
|
833 |
- node = dict(), |
|
834 |
- numa = dict(type='dict'), |
|
835 |
- onboot = dict(type='bool', default='yes'), |
|
836 |
- ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']), |
|
837 |
- parallel = dict(type='dict'), |
|
838 |
- protection = dict(type='bool'), |
|
839 |
- reboot = dict(type='bool'), |
|
840 |
- revert = dict(), |
|
841 |
- sata = dict(type='dict'), |
|
842 |
- scsi = dict(type='dict'), |
|
843 |
- scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']), |
|
844 |
- serial = dict(type='dict'), |
|
845 |
- shares = dict(type='int'), |
|
846 |
- skiplock = dict(type='bool'), |
|
847 |
- smbios = dict(type='str'), |
|
848 |
- sockets = dict(type='int', default=1), |
|
849 |
- startdate = dict(type='str'), |
|
850 |
- startup = dict(), |
|
851 |
- state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']), |
|
852 |
- tablet = dict(type='bool', default='no'), |
|
853 |
- tdf = dict(type='bool'), |
|
854 |
- template = dict(type='bool', default='no'), |
|
855 |
- timeout = dict(type='int', default=30), |
|
856 |
- validate_certs = dict(type='bool', default='no'), |
|
857 |
- vcpus = dict(type='int', default=None), |
|
858 |
- vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']), |
|
859 |
- virtio = dict(type='dict', default=None), |
|
860 |
- vmid = dict(type='int', default=None), |
|
861 |
- watchdog = dict(), |
|
862 |
- ) |
|
798 |
+ argument_spec = dict( |
|
799 |
+ acpi = dict(type='bool', default='yes'), |
|
800 |
+ agent = dict(type='bool'), |
|
801 |
+ args = dict(type='str', default=None), |
|
802 |
+ api_host = dict(required=True), |
|
803 |
+ api_user = dict(required=True), |
|
804 |
+ api_password = dict(no_log=True), |
|
805 |
+ autostart = dict(type='bool', default='no'), |
|
806 |
+ balloon = dict(type='int',default=0), |
|
807 |
+ bios = dict(choices=['seabios', 'ovmf']), |
|
808 |
+ boot = dict(type='str', default='cnd'), |
|
809 |
+ bootdisk = dict(type='str'), |
|
810 |
+ cores = dict(type='int', default=1), |
|
811 |
+ cpu = dict(type='str', default='kvm64'), |
|
812 |
+ cpulimit = dict(type='int'), |
|
813 |
+ cpuunits = dict(type='int', default=1000), |
|
814 |
+ delete = dict(type='str'), |
|
815 |
+ description = dict(type='str'), |
|
816 |
+ digest = dict(type='str'), |
|
817 |
+ force = dict(type='bool', default=None), |
|
818 |
+ freeze = dict(type='bool'), |
|
819 |
+ hostpci = dict(type='dict'), |
|
820 |
+ hotplug = dict(type='str'), |
|
821 |
+ hugepages = dict(choices=['any', '2', '1024']), |
|
822 |
+ ide = dict(type='dict', default=None), |
|
823 |
+ keyboard = dict(type='str'), |
|
824 |
+ kvm = dict(type='bool', default='yes'), |
|
825 |
+ localtime = dict(type='bool'), |
|
826 |
+ lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']), |
|
827 |
+ machine = dict(type='str'), |
|
828 |
+ memory = dict(type='int', default=512), |
|
829 |
+ migrate_downtime = dict(type='int'), |
|
830 |
+ migrate_speed = dict(type='int'), |
|
831 |
+ name = dict(type='str'), |
|
832 |
+ net = dict(type='dict'), |
|
833 |
+ node = dict(), |
|
834 |
+ numa = dict(type='dict'), |
|
835 |
+ onboot = dict(type='bool', default='yes'), |
|
836 |
+ ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']), |
|
837 |
+ parallel = dict(type='dict'), |
|
838 |
+ protection = dict(type='bool'), |
|
839 |
+ reboot = dict(type='bool'), |
|
840 |
+ revert = dict(), |
|
841 |
+ sata = dict(type='dict'), |
|
842 |
+ scsi = dict(type='dict'), |
|
843 |
+ scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']), |
|
844 |
+ serial = dict(type='dict'), |
|
845 |
+ shares = dict(type='int'), |
|
846 |
+ skiplock = dict(type='bool'), |
|
847 |
+ smbios = dict(type='str'), |
|
848 |
+ sockets = dict(type='int', default=1), |
|
849 |
+ startdate = dict(type='str'), |
|
850 |
+ startup = dict(), |
|
851 |
+ state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']), |
|
852 |
+ tablet = dict(type='bool', default='no'), |
|
853 |
+ tdf = dict(type='bool'), |
|
854 |
+ template = dict(type='bool', default='no'), |
|
855 |
+ timeout = dict(type='int', default=30), |
|
856 |
+ validate_certs = dict(type='bool', default='no'), |
|
857 |
+ vcpus = dict(type='int', default=None), |
|
858 |
+ vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']), |
|
859 |
+ virtio = dict(type='dict', default=None), |
|
860 |
+ vmid = dict(type='int', default=None), |
|
861 |
+ watchdog = dict(), |
|
862 |
+ ) |
|
863 | 863 |
) |
864 | 864 |
|
865 | 865 |
if not HAS_PROXMOXER: |
... | ... |
@@ -179,20 +179,20 @@ def delete_template(module, proxmox, node, storage, content_type, template, time |
179 | 179 |
|
180 | 180 |
def main(): |
181 | 181 |
module = AnsibleModule( |
182 |
- argument_spec = dict( |
|
183 |
- api_host = dict(required=True), |
|
184 |
- api_user = dict(required=True), |
|
185 |
- api_password = dict(no_log=True), |
|
186 |
- validate_certs = dict(type='bool', default='no'), |
|
187 |
- node = dict(), |
|
188 |
- src = dict(), |
|
189 |
- template = dict(), |
|
190 |
- content_type = dict(default='vztmpl', choices=['vztmpl','iso']), |
|
191 |
- storage = dict(default='local'), |
|
192 |
- timeout = dict(type='int', default=30), |
|
193 |
- force = dict(type='bool', default='no'), |
|
194 |
- state = dict(default='present', choices=['present', 'absent']), |
|
195 |
- ) |
|
182 |
+ argument_spec = dict( |
|
183 |
+ api_host = dict(required=True), |
|
184 |
+ api_user = dict(required=True), |
|
185 |
+ api_password = dict(no_log=True), |
|
186 |
+ validate_certs = dict(type='bool', default='no'), |
|
187 |
+ node = dict(), |
|
188 |
+ src = dict(), |
|
189 |
+ template = dict(), |
|
190 |
+ content_type = dict(default='vztmpl', choices=['vztmpl','iso']), |
|
191 |
+ storage = dict(default='local'), |
|
192 |
+ timeout = dict(type='int', default=30), |
|
193 |
+ force = dict(type='bool', default='no'), |
|
194 |
+ state = dict(default='present', choices=['present', 'absent']), |
|
195 |
+ ) |
|
196 | 196 |
) |
197 | 197 |
|
198 | 198 |
if not HAS_PROXMOXER: |
... | ... |
@@ -132,13 +132,13 @@ ALL_COMMANDS.extend(VM_COMMANDS) |
132 | 132 |
ALL_COMMANDS.extend(HOST_COMMANDS) |
133 | 133 |
|
134 | 134 |
VIRT_STATE_NAME_MAP = { |
135 |
- 0 : "running", |
|
136 |
- 1 : "running", |
|
137 |
- 2 : "running", |
|
138 |
- 3 : "paused", |
|
139 |
- 4 : "shutdown", |
|
140 |
- 5 : "shutdown", |
|
141 |
- 6 : "crashed" |
|
135 |
+ 0 : "running", |
|
136 |
+ 1 : "running", |
|
137 |
+ 2 : "running", |
|
138 |
+ 3 : "paused", |
|
139 |
+ 4 : "shutdown", |
|
140 |
+ 5 : "shutdown", |
|
141 |
+ 6 : "crashed" |
|
142 | 142 |
} |
143 | 143 |
|
144 | 144 |
class VMNotFound(Exception): |
... | ... |
@@ -173,7 +173,7 @@ def _get_glance_client(module, kwargs): |
173 | 173 |
token = _ksclient.auth_token |
174 | 174 |
endpoint =_get_endpoint(module, _ksclient, kwargs.get('endpoint_type')) |
175 | 175 |
kwargs = { |
176 |
- 'token': token, |
|
176 |
+ 'token': token, |
|
177 | 177 |
} |
178 | 178 |
try: |
179 | 179 |
client = glanceclient.Client('1', endpoint, **kwargs) |
... | ... |
@@ -194,12 +194,12 @@ def _glance_image_present(module, params, client): |
194 | 194 |
|
195 | 195 |
def _glance_image_create(module, params, client): |
196 | 196 |
kwargs = { |
197 |
- 'name': params.get('name'), |
|
198 |
- 'disk_format': params.get('disk_format'), |
|
199 |
- 'container_format': params.get('container_format'), |
|
200 |
- 'owner': params.get('owner'), |
|
201 |
- 'is_public': params.get('is_public'), |
|
202 |
- 'copy_from': params.get('copy_from'), |
|
197 |
+ 'name': params.get('name'), |
|
198 |
+ 'disk_format': params.get('disk_format'), |
|
199 |
+ 'container_format': params.get('container_format'), |
|
200 |
+ 'owner': params.get('owner'), |
|
201 |
+ 'is_public': params.get('is_public'), |
|
202 |
+ 'copy_from': params.get('copy_from'), |
|
203 | 203 |
} |
204 | 204 |
try: |
205 | 205 |
timeout = float(params.get('timeout')) |
... | ... |
@@ -332,19 +332,19 @@ def main(): |
332 | 332 |
|
333 | 333 |
argument_spec = openstack_argument_spec() |
334 | 334 |
argument_spec.update(dict( |
335 |
- tenant_description=dict(required=False), |
|
336 |
- email=dict(required=False), |
|
337 |
- user=dict(required=False), |
|
338 |
- tenant=dict(required=False), |
|
339 |
- password=dict(required=False), |
|
340 |
- role=dict(required=False), |
|
341 |
- state=dict(default='present', choices=['present', 'absent']), |
|
342 |
- endpoint=dict(required=False, |
|
335 |
+ tenant_description=dict(required=False), |
|
336 |
+ email=dict(required=False), |
|
337 |
+ user=dict(required=False), |
|
338 |
+ tenant=dict(required=False), |
|
339 |
+ password=dict(required=False), |
|
340 |
+ role=dict(required=False), |
|
341 |
+ state=dict(default='present', choices=['present', 'absent']), |
|
342 |
+ endpoint=dict(required=False, |
|
343 | 343 |
default="http://127.0.0.1:35357/v2.0"), |
344 |
- token=dict(required=False), |
|
345 |
- login_user=dict(required=False), |
|
346 |
- login_password=dict(required=False), |
|
347 |
- login_tenant_name=dict(required=False) |
|
344 |
+ token=dict(required=False), |
|
345 |
+ login_user=dict(required=False), |
|
346 |
+ login_password=dict(required=False), |
|
347 |
+ login_tenant_name=dict(required=False) |
|
348 | 348 |
)) |
349 | 349 |
# keystone operations themselves take an endpoint, not a keystone auth_url |
350 | 350 |
del(argument_spec['auth_url']) |
... | ... |
@@ -428,12 +428,12 @@ def _create_server(module, nova): |
428 | 428 |
flavor_id = _get_flavor_id(module, nova) |
429 | 429 |
bootargs = [module.params['name'], image_id, flavor_id] |
430 | 430 |
bootkwargs = { |
431 |
- 'nics' : module.params['nics'], |
|
432 |
- 'meta' : module.params['meta'], |
|
433 |
- 'security_groups': module.params['security_groups'].split(','), |
|
434 |
- #userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module: |
|
435 |
- 'userdata': module.params['user_data'], |
|
436 |
- 'config_drive': module.params['config_drive'], |
|
431 |
+ 'nics' : module.params['nics'], |
|
432 |
+ 'meta' : module.params['meta'], |
|
433 |
+ 'security_groups': module.params['security_groups'].split(','), |
|
434 |
+ #userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module: |
|
435 |
+ 'userdata': module.params['user_data'], |
|
436 |
+ 'config_drive': module.params['config_drive'], |
|
437 | 437 |
} |
438 | 438 |
|
439 | 439 |
for optional_param in ('region_name', 'key_name', 'availability_zone', 'scheduler_hints'): |
... | ... |
@@ -136,8 +136,8 @@ def _get_neutron_client(module, kwargs): |
136 | 136 |
token = _ksclient.auth_token |
137 | 137 |
endpoint = _get_endpoint(module, _ksclient) |
138 | 138 |
kwargs = { |
139 |
- 'token': token, |
|
140 |
- 'endpoint_url': endpoint |
|
139 |
+ 'token': token, |
|
140 |
+ 'endpoint_url': endpoint |
|
141 | 141 |
} |
142 | 142 |
try: |
143 | 143 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -174,7 +174,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None): |
174 | 174 |
subnets = neutron.list_subnets(**kwargs) |
175 | 175 |
subnet_id = subnets['subnets'][0]['id'] |
176 | 176 |
kwargs = { |
177 |
- 'device_id': instance_id, |
|
177 |
+ 'device_id': instance_id, |
|
178 | 178 |
} |
179 | 179 |
try: |
180 | 180 |
ports = neutron.list_ports(**kwargs) |
... | ... |
@@ -193,7 +193,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None): |
193 | 193 |
|
194 | 194 |
def _get_floating_ip(module, neutron, fixed_ip_address, network_name): |
195 | 195 |
kwargs = { |
196 |
- 'fixed_ip_address': fixed_ip_address |
|
196 |
+ 'fixed_ip_address': fixed_ip_address |
|
197 | 197 |
} |
198 | 198 |
try: |
199 | 199 |
ips = neutron.list_floatingips(**kwargs) |
... | ... |
@@ -214,9 +214,9 @@ def _check_ips_network(neutron, net_id, network_name): |
214 | 214 |
|
215 | 215 |
def _create_floating_ip(neutron, module, port_id, net_id, fixed_ip): |
216 | 216 |
kwargs = { |
217 |
- 'port_id': port_id, |
|
218 |
- 'floating_network_id': net_id, |
|
219 |
- 'fixed_ip_address': fixed_ip |
|
217 |
+ 'port_id': port_id, |
|
218 |
+ 'floating_network_id': net_id, |
|
219 |
+ 'fixed_ip_address': fixed_ip |
|
220 | 220 |
} |
221 | 221 |
try: |
222 | 222 |
result = neutron.create_floatingip({'floatingip': kwargs}) |
... | ... |
@@ -251,10 +251,10 @@ def main(): |
251 | 251 |
|
252 | 252 |
argument_spec = openstack_argument_spec() |
253 | 253 |
argument_spec.update(dict( |
254 |
- network_name = dict(required=True), |
|
255 |
- instance_name = dict(required=True), |
|
256 |
- state = dict(default='present', choices=['absent', 'present']), |
|
257 |
- internal_network_name = dict(default=None), |
|
254 |
+ network_name = dict(required=True), |
|
255 |
+ instance_name = dict(required=True), |
|
256 |
+ state = dict(default='present', choices=['absent', 'present']), |
|
257 |
+ internal_network_name = dict(default=None), |
|
258 | 258 |
)) |
259 | 259 |
module = AnsibleModule(argument_spec=argument_spec) |
260 | 260 |
|
... | ... |
@@ -125,8 +125,8 @@ def _get_neutron_client(module, kwargs): |
125 | 125 |
token = _ksclient.auth_token |
126 | 126 |
endpoint = _get_endpoint(module, _ksclient) |
127 | 127 |
kwargs = { |
128 |
- 'token': token, |
|
129 |
- 'endpoint_url': endpoint |
|
128 |
+ 'token': token, |
|
129 |
+ 'endpoint_url': endpoint |
|
130 | 130 |
} |
131 | 131 |
try: |
132 | 132 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -191,9 +191,9 @@ def main(): |
191 | 191 |
|
192 | 192 |
argument_spec = openstack_argument_spec() |
193 | 193 |
argument_spec.update(dict( |
194 |
- ip_address = dict(required=True), |
|
195 |
- instance_name = dict(required=True), |
|
196 |
- state = dict(default='present', choices=['absent', 'present']) |
|
194 |
+ ip_address = dict(required=True), |
|
195 |
+ instance_name = dict(required=True), |
|
196 |
+ state = dict(default='present', choices=['absent', 'present']) |
|
197 | 197 |
)) |
198 | 198 |
module = AnsibleModule(argument_spec=argument_spec) |
199 | 199 |
|
... | ... |
@@ -167,8 +167,8 @@ def _get_neutron_client(module, kwargs): |
167 | 167 |
token = _ksclient.auth_token |
168 | 168 |
endpoint = _get_endpoint(module, _ksclient) |
169 | 169 |
kwargs = { |
170 |
- 'token': token, |
|
171 |
- 'endpoint_url': endpoint |
|
170 |
+ 'token': token, |
|
171 |
+ 'endpoint_url': endpoint |
|
172 | 172 |
} |
173 | 173 |
try: |
174 | 174 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -192,8 +192,8 @@ def _set_tenant_id(module): |
192 | 192 |
|
193 | 193 |
def _get_net_id(neutron, module): |
194 | 194 |
kwargs = { |
195 |
- 'tenant_id': _os_tenant_id, |
|
196 |
- 'name': module.params['name'], |
|
195 |
+ 'tenant_id': _os_tenant_id, |
|
196 |
+ 'name': module.params['name'], |
|
197 | 197 |
} |
198 | 198 |
try: |
199 | 199 |
networks = neutron.list_networks(**kwargs) |
... | ... |
@@ -251,15 +251,15 @@ def main(): |
251 | 251 |
|
252 | 252 |
argument_spec = openstack_argument_spec() |
253 | 253 |
argument_spec.update(dict( |
254 |
- name = dict(required=True), |
|
255 |
- tenant_name = dict(default=None), |
|
256 |
- provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']), |
|
257 |
- provider_physical_network = dict(default=None), |
|
258 |
- provider_segmentation_id = dict(default=None), |
|
259 |
- router_external = dict(default=False, type='bool'), |
|
260 |
- shared = dict(default=False, type='bool'), |
|
261 |
- admin_state_up = dict(default=True, type='bool'), |
|
262 |
- state = dict(default='present', choices=['absent', 'present']) |
|
254 |
+ name = dict(required=True), |
|
255 |
+ tenant_name = dict(default=None), |
|
256 |
+ provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']), |
|
257 |
+ provider_physical_network = dict(default=None), |
|
258 |
+ provider_segmentation_id = dict(default=None), |
|
259 |
+ router_external = dict(default=False, type='bool'), |
|
260 |
+ shared = dict(default=False, type='bool'), |
|
261 |
+ admin_state_up = dict(default=True, type='bool'), |
|
262 |
+ state = dict(default='present', choices=['absent', 'present']) |
|
263 | 263 |
)) |
264 | 264 |
module = AnsibleModule(argument_spec=argument_spec) |
265 | 265 |
|
... | ... |
@@ -129,8 +129,8 @@ def _get_neutron_client(module, kwargs): |
129 | 129 |
token = _ksclient.auth_token |
130 | 130 |
endpoint = _get_endpoint(module, _ksclient) |
131 | 131 |
kwargs = { |
132 |
- 'token': token, |
|
133 |
- 'endpoint_url': endpoint |
|
132 |
+ 'token': token, |
|
133 |
+ 'endpoint_url': endpoint |
|
134 | 134 |
} |
135 | 135 |
try: |
136 | 136 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -154,8 +154,8 @@ def _set_tenant_id(module): |
154 | 154 |
|
155 | 155 |
def _get_router_id(module, neutron): |
156 | 156 |
kwargs = { |
157 |
- 'name': module.params['name'], |
|
158 |
- 'tenant_id': _os_tenant_id, |
|
157 |
+ 'name': module.params['name'], |
|
158 |
+ 'tenant_id': _os_tenant_id, |
|
159 | 159 |
} |
160 | 160 |
try: |
161 | 161 |
routers = neutron.list_routers(**kwargs) |
... | ... |
@@ -167,9 +167,9 @@ def _get_router_id(module, neutron): |
167 | 167 |
|
168 | 168 |
def _create_router(module, neutron): |
169 | 169 |
router = { |
170 |
- 'name': module.params['name'], |
|
171 |
- 'tenant_id': _os_tenant_id, |
|
172 |
- 'admin_state_up': module.params['admin_state_up'], |
|
170 |
+ 'name': module.params['name'], |
|
171 |
+ 'tenant_id': _os_tenant_id, |
|
172 |
+ 'admin_state_up': module.params['admin_state_up'], |
|
173 | 173 |
} |
174 | 174 |
try: |
175 | 175 |
new_router = neutron.create_router(dict(router=router)) |
... | ... |
@@ -123,8 +123,8 @@ def _get_neutron_client(module, kwargs): |
123 | 123 |
token = _ksclient.auth_token |
124 | 124 |
endpoint = _get_endpoint(module, _ksclient) |
125 | 125 |
kwargs = { |
126 |
- 'token': token, |
|
127 |
- 'endpoint_url': endpoint |
|
126 |
+ 'token': token, |
|
127 |
+ 'endpoint_url': endpoint |
|
128 | 128 |
} |
129 | 129 |
try: |
130 | 130 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -134,7 +134,7 @@ def _get_neutron_client(module, kwargs): |
134 | 134 |
|
135 | 135 |
def _get_router_id(module, neutron): |
136 | 136 |
kwargs = { |
137 |
- 'name': module.params['router_name'], |
|
137 |
+ 'name': module.params['router_name'], |
|
138 | 138 |
} |
139 | 139 |
try: |
140 | 140 |
routers = neutron.list_routers(**kwargs) |
... | ... |
@@ -191,9 +191,9 @@ def main(): |
191 | 191 |
|
192 | 192 |
argument_spec = openstack_argument_spec() |
193 | 193 |
argument_spec.update(dict( |
194 |
- router_name = dict(required=True), |
|
195 |
- network_name = dict(required=True), |
|
196 |
- state = dict(default='present', choices=['absent', 'present']), |
|
194 |
+ router_name = dict(required=True), |
|
195 |
+ network_name = dict(required=True), |
|
196 |
+ state = dict(default='present', choices=['absent', 'present']), |
|
197 | 197 |
)) |
198 | 198 |
module = AnsibleModule(argument_spec=argument_spec) |
199 | 199 |
if not HAVE_DEPS: |
... | ... |
@@ -132,8 +132,8 @@ def _get_neutron_client(module, kwargs): |
132 | 132 |
token = _ksclient.auth_token |
133 | 133 |
endpoint = _get_endpoint(module, _ksclient) |
134 | 134 |
kwargs = { |
135 |
- 'token': token, |
|
136 |
- 'endpoint_url': endpoint |
|
135 |
+ 'token': token, |
|
136 |
+ 'endpoint_url': endpoint |
|
137 | 137 |
} |
138 | 138 |
try: |
139 | 139 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -171,8 +171,8 @@ def _get_router_id(module, neutron): |
171 | 171 |
def _get_subnet_id(module, neutron): |
172 | 172 |
subnet_id = None |
173 | 173 |
kwargs = { |
174 |
- 'tenant_id': _os_tenant_id, |
|
175 |
- 'name': module.params['subnet_name'], |
|
174 |
+ 'tenant_id': _os_tenant_id, |
|
175 |
+ 'name': module.params['subnet_name'], |
|
176 | 176 |
} |
177 | 177 |
try: |
178 | 178 |
subnets = neutron.list_subnets(**kwargs) |
... | ... |
@@ -184,8 +184,8 @@ def _get_subnet_id(module, neutron): |
184 | 184 |
|
185 | 185 |
def _get_port_id(neutron, module, router_id, subnet_id): |
186 | 186 |
kwargs = { |
187 |
- 'tenant_id': _os_tenant_id, |
|
188 |
- 'device_id': router_id, |
|
187 |
+ 'tenant_id': _os_tenant_id, |
|
188 |
+ 'device_id': router_id, |
|
189 | 189 |
} |
190 | 190 |
try: |
191 | 191 |
ports = neutron.list_ports(**kwargs) |
... | ... |
@@ -222,10 +222,10 @@ def _remove_interface_router(neutron, module, router_id, subnet_id): |
222 | 222 |
def main(): |
223 | 223 |
argument_spec = openstack_argument_spec() |
224 | 224 |
argument_spec.update(dict( |
225 |
- router_name = dict(required=True), |
|
226 |
- subnet_name = dict(required=True), |
|
227 |
- tenant_name = dict(default=None), |
|
228 |
- state = dict(default='present', choices=['absent', 'present']), |
|
225 |
+ router_name = dict(required=True), |
|
226 |
+ subnet_name = dict(required=True), |
|
227 |
+ tenant_name = dict(default=None), |
|
228 |
+ state = dict(default='present', choices=['absent', 'present']), |
|
229 | 229 |
)) |
230 | 230 |
module = AnsibleModule(argument_spec=argument_spec) |
231 | 231 |
if not HAVE_DEPS: |
... | ... |
@@ -168,8 +168,8 @@ def _get_neutron_client(module, kwargs): |
168 | 168 |
token = _ksclient.auth_token |
169 | 169 |
endpoint = _get_endpoint(module, _ksclient) |
170 | 170 |
kwargs = { |
171 |
- 'token': token, |
|
172 |
- 'endpoint_url': endpoint |
|
171 |
+ 'token': token, |
|
172 |
+ 'endpoint_url': endpoint |
|
173 | 173 |
} |
174 | 174 |
try: |
175 | 175 |
neutron = client.Client('2.0', **kwargs) |
... | ... |
@@ -227,14 +227,14 @@ def _get_subnet_id(module, neutron): |
227 | 227 |
def _create_subnet(module, neutron): |
228 | 228 |
neutron.format = 'json' |
229 | 229 |
subnet = { |
230 |
- 'name': module.params['name'], |
|
231 |
- 'ip_version': module.params['ip_version'], |
|
232 |
- 'enable_dhcp': module.params['enable_dhcp'], |
|
233 |
- 'tenant_id': _os_tenant_id, |
|
234 |
- 'gateway_ip': module.params['gateway_ip'], |
|
235 |
- 'dns_nameservers': module.params['dns_nameservers'], |
|
236 |
- 'network_id': _os_network_id, |
|
237 |
- 'cidr': module.params['cidr'], |
|
230 |
+ 'name': module.params['name'], |
|
231 |
+ 'ip_version': module.params['ip_version'], |
|
232 |
+ 'enable_dhcp': module.params['enable_dhcp'], |
|
233 |
+ 'tenant_id': _os_tenant_id, |
|
234 |
+ 'gateway_ip': module.params['gateway_ip'], |
|
235 |
+ 'dns_nameservers': module.params['dns_nameservers'], |
|
236 |
+ 'network_id': _os_network_id, |
|
237 |
+ 'cidr': module.params['cidr'], |
|
238 | 238 |
} |
239 | 239 |
if module.params['allocation_pool_start'] and module.params['allocation_pool_end']: |
240 | 240 |
allocation_pools = [ |
... | ... |
@@ -269,17 +269,17 @@ def main(): |
269 | 269 |
|
270 | 270 |
argument_spec = openstack_argument_spec() |
271 | 271 |
argument_spec.update(dict( |
272 |
- name = dict(required=True), |
|
273 |
- network_name = dict(required=True), |
|
274 |
- cidr = dict(required=True), |
|
275 |
- tenant_name = dict(default=None), |
|
276 |
- state = dict(default='present', choices=['absent', 'present']), |
|
277 |
- ip_version = dict(default='4', choices=['4', '6']), |
|
278 |
- enable_dhcp = dict(default='true', type='bool'), |
|
279 |
- gateway_ip = dict(default=None), |
|
280 |
- dns_nameservers = dict(default=None), |
|
281 |
- allocation_pool_start = dict(default=None), |
|
282 |
- allocation_pool_end = dict(default=None), |
|
272 |
+ name = dict(required=True), |
|
273 |
+ network_name = dict(required=True), |
|
274 |
+ cidr = dict(required=True), |
|
275 |
+ tenant_name = dict(default=None), |
|
276 |
+ state = dict(default='present', choices=['absent', 'present']), |
|
277 |
+ ip_version = dict(default='4', choices=['4', '6']), |
|
278 |
+ enable_dhcp = dict(default='true', type='bool'), |
|
279 |
+ gateway_ip = dict(default=None), |
|
280 |
+ dns_nameservers = dict(default=None), |
|
281 |
+ allocation_pool_start = dict(default=None), |
|
282 |
+ allocation_pool_end = dict(default=None), |
|
283 | 283 |
)) |
284 | 284 |
module = AnsibleModule(argument_spec=argument_spec) |
285 | 285 |
if not HAVE_DEPS: |
... | ... |
@@ -64,8 +64,8 @@ def main(): |
64 | 64 |
module.exit_json( |
65 | 65 |
changed=False, |
66 | 66 |
ansible_facts=dict( |
67 |
- auth_token=cloud.auth_token, |
|
68 |
- service_catalog=cloud.service_catalog)) |
|
67 |
+ auth_token=cloud.auth_token, |
|
68 |
+ service_catalog=cloud.service_catalog)) |
|
69 | 69 |
except shade.OpenStackCloudException as e: |
70 | 70 |
module.fail_json(msg=str(e)) |
71 | 71 |
|
... | ... |
@@ -345,9 +345,9 @@ def _system_state_change(module, project_quota_output): |
345 | 345 |
""" |
346 | 346 |
|
347 | 347 |
changes_required, quota_change_request = _system_state_change_details( |
348 |
- module, |
|
349 |
- project_quota_output |
|
350 |
- ) |
|
348 |
+ module, |
|
349 |
+ project_quota_output |
|
350 |
+ ) |
|
351 | 351 |
|
352 | 352 |
if changes_required: |
353 | 353 |
return True |
... | ... |
@@ -452,9 +452,9 @@ def main(): |
452 | 452 |
module.exit_json(changed=_system_state_change(module, project_quota_output)) |
453 | 453 |
|
454 | 454 |
changes_required, quota_change_request = _system_state_change_details( |
455 |
- module, |
|
456 |
- project_quota_output |
|
457 |
- ) |
|
455 |
+ module, |
|
456 |
+ project_quota_output |
|
457 |
+ ) |
|
458 | 458 |
|
459 | 459 |
if changes_required: |
460 | 460 |
for quota_type in quota_change_request.keys(): |
... | ... |
@@ -215,10 +215,10 @@ def main(): |
215 | 215 |
zone, pre_update_recordset) |
216 | 216 |
if changed: |
217 | 217 |
zone = cloud.update_recordset( |
218 |
- zone, name + '.' + zone, |
|
219 |
- records=records, |
|
220 |
- description=description, |
|
221 |
- ttl=ttl) |
|
218 |
+ zone, name + '.' + zone, |
|
219 |
+ records=records, |
|
220 |
+ description=description, |
|
221 |
+ ttl=ttl) |
|
222 | 222 |
module.exit_json(changed=changed, recordset=recordset) |
223 | 223 |
|
224 | 224 |
elif state == 'absent': |
... | ... |
@@ -212,9 +212,9 @@ def main(): |
212 | 212 |
masters, pre_update_zone) |
213 | 213 |
if changed: |
214 | 214 |
zone = cloud.update_zone( |
215 |
- name, email=email, |
|
216 |
- description=description, |
|
217 |
- ttl=ttl, masters=masters) |
|
215 |
+ name, email=email, |
|
216 |
+ description=description, |
|
217 |
+ ttl=ttl, masters=masters) |
|
218 | 218 |
module.exit_json(changed=changed, zone=zone) |
219 | 219 |
|
220 | 220 |
elif state == 'absent': |
... | ... |
@@ -202,7 +202,7 @@ def act_on_sshkeys(target_state, module, packet_conn): |
202 | 202 |
raise Exception(_msg) |
203 | 203 |
matching_sshkeys = [] |
204 | 204 |
new_key_response = packet_conn.create_ssh_key( |
205 |
- newkey['label'], newkey['key']) |
|
205 |
+ newkey['label'], newkey['key']) |
|
206 | 206 |
changed = True |
207 | 207 |
|
208 | 208 |
matching_sshkeys.append(new_key_response) |
... | ... |
@@ -260,9 +260,9 @@ except ImportError: |
260 | 260 |
def create_virtual_instance(module): |
261 | 261 |
|
262 | 262 |
instances = vsManager.list_instances( |
263 |
- hostname = module.params.get('hostname'), |
|
264 |
- domain = module.params.get('domain'), |
|
265 |
- datacenter = module.params.get('datacenter') |
|
263 |
+ hostname = module.params.get('hostname'), |
|
264 |
+ domain = module.params.get('domain'), |
|
265 |
+ datacenter = module.params.get('datacenter') |
|
266 | 266 |
) |
267 | 267 |
|
268 | 268 |
if instances: |
... | ... |
@@ -283,24 +283,24 @@ def create_virtual_instance(module): |
283 | 283 |
tags = ','.join(map(str, module.params.get('tags'))) |
284 | 284 |
|
285 | 285 |
instance = vsManager.create_instance( |
286 |
- hostname = module.params.get('hostname'), |
|
287 |
- domain = module.params.get('domain'), |
|
288 |
- cpus = module.params.get('cpus'), |
|
289 |
- memory = module.params.get('memory'), |
|
290 |
- hourly = module.params.get('hourly'), |
|
291 |
- datacenter = module.params.get('datacenter'), |
|
292 |
- os_code = module.params.get('os_code'), |
|
293 |
- image_id = module.params.get('image_id'), |
|
294 |
- local_disk = module.params.get('local_disk'), |
|
295 |
- disks = module.params.get('disks'), |
|
296 |
- ssh_keys = module.params.get('ssh_keys'), |
|
297 |
- nic_speed = module.params.get('nic_speed'), |
|
298 |
- private = module.params.get('private'), |
|
299 |
- public_vlan = module.params.get('public_vlan'), |
|
300 |
- private_vlan = module.params.get('private_vlan'), |
|
301 |
- dedicated = module.params.get('dedicated'), |
|
302 |
- post_uri = module.params.get('post_uri'), |
|
303 |
- tags = tags) |
|
286 |
+ hostname = module.params.get('hostname'), |
|
287 |
+ domain = module.params.get('domain'), |
|
288 |
+ cpus = module.params.get('cpus'), |
|
289 |
+ memory = module.params.get('memory'), |
|
290 |
+ hourly = module.params.get('hourly'), |
|
291 |
+ datacenter = module.params.get('datacenter'), |
|
292 |
+ os_code = module.params.get('os_code'), |
|
293 |
+ image_id = module.params.get('image_id'), |
|
294 |
+ local_disk = module.params.get('local_disk'), |
|
295 |
+ disks = module.params.get('disks'), |
|
296 |
+ ssh_keys = module.params.get('ssh_keys'), |
|
297 |
+ nic_speed = module.params.get('nic_speed'), |
|
298 |
+ private = module.params.get('private'), |
|
299 |
+ public_vlan = module.params.get('public_vlan'), |
|
300 |
+ private_vlan = module.params.get('private_vlan'), |
|
301 |
+ dedicated = module.params.get('dedicated'), |
|
302 |
+ post_uri = module.params.get('post_uri'), |
|
303 |
+ tags = tags) |
|
304 | 304 |
|
305 | 305 |
if instance is not None and instance['id'] > 0: |
306 | 306 |
return True, instance |
... | ... |
@@ -349,30 +349,30 @@ def cancel_instance(module): |
349 | 349 |
def main(): |
350 | 350 |
|
351 | 351 |
module = AnsibleModule( |
352 |
- argument_spec=dict( |
|
353 |
- instance_id=dict(), |
|
354 |
- hostname=dict(), |
|
355 |
- domain=dict(), |
|
356 |
- datacenter=dict(choices=DATACENTERS), |
|
357 |
- tags=dict(), |
|
358 |
- hourly=dict(type='bool', default=True), |
|
359 |
- private=dict(type='bool', default=False), |
|
360 |
- dedicated=dict(type='bool', default=False), |
|
361 |
- local_disk=dict(type='bool', default=True), |
|
362 |
- cpus=dict(type='int', choices=CPU_SIZES), |
|
363 |
- memory=dict(type='int', choices=MEMORY_SIZES), |
|
364 |
- disks=dict(type='list', default=[25]), |
|
365 |
- os_code=dict(), |
|
366 |
- image_id=dict(), |
|
367 |
- nic_speed=dict(type='int', choices=NIC_SPEEDS), |
|
368 |
- public_vlan=dict(), |
|
369 |
- private_vlan=dict(), |
|
370 |
- ssh_keys=dict(type='list', default=[]), |
|
371 |
- post_uri=dict(), |
|
372 |
- state=dict(default='present', choices=STATES), |
|
373 |
- wait=dict(type='bool', default=True), |
|
374 |
- wait_time=dict(type='int', default=600) |
|
375 |
- ) |
|
352 |
+ argument_spec=dict( |
|
353 |
+ instance_id=dict(), |
|
354 |
+ hostname=dict(), |
|
355 |
+ domain=dict(), |
|
356 |
+ datacenter=dict(choices=DATACENTERS), |
|
357 |
+ tags=dict(), |
|
358 |
+ hourly=dict(type='bool', default=True), |
|
359 |
+ private=dict(type='bool', default=False), |
|
360 |
+ dedicated=dict(type='bool', default=False), |
|
361 |
+ local_disk=dict(type='bool', default=True), |
|
362 |
+ cpus=dict(type='int', choices=CPU_SIZES), |
|
363 |
+ memory=dict(type='int', choices=MEMORY_SIZES), |
|
364 |
+ disks=dict(type='list', default=[25]), |
|
365 |
+ os_code=dict(), |
|
366 |
+ image_id=dict(), |
|
367 |
+ nic_speed=dict(type='int', choices=NIC_SPEEDS), |
|
368 |
+ public_vlan=dict(), |
|
369 |
+ private_vlan=dict(), |
|
370 |
+ ssh_keys=dict(type='list', default=[]), |
|
371 |
+ post_uri=dict(), |
|
372 |
+ state=dict(default='present', choices=STATES), |
|
373 |
+ wait=dict(type='bool', default=True), |
|
374 |
+ wait_time=dict(type='int', default=600) |
|
375 |
+ ) |
|
376 | 376 |
) |
377 | 377 |
|
378 | 378 |
if not HAS_SL: |
... | ... |
@@ -408,9 +408,9 @@ class PyVmomiDeviceHelper(object): |
408 | 408 |
@staticmethod |
409 | 409 |
def is_scsi_controller(device): |
410 | 410 |
return isinstance(device, vim.vm.device.VirtualLsiLogicController) or \ |
411 |
- isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \ |
|
412 |
- isinstance(device, vim.vm.device.VirtualBusLogicController) or \ |
|
413 |
- isinstance(device, vim.vm.device.VirtualLsiLogicSASController) |
|
411 |
+ isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \ |
|
412 |
+ isinstance(device, vim.vm.device.VirtualBusLogicController) or \ |
|
413 |
+ isinstance(device, vim.vm.device.VirtualLsiLogicSASController) |
|
414 | 414 |
|
415 | 415 |
def create_scsi_disk(self, scsi_ctl, disk_index=None): |
416 | 416 |
diskspec = vim.vm.device.VirtualDeviceSpec() |
... | ... |
@@ -91,8 +91,8 @@ class VMwareLocalUserManager(object): |
91 | 91 |
try: |
92 | 92 |
local_account_manager_states = { |
93 | 93 |
'absent': { |
94 |
- 'present': self.state_remove_user, |
|
95 |
- 'absent': self.state_exit_unchanged, |
|
94 |
+ 'present': self.state_remove_user, |
|
95 |
+ 'absent': self.state_exit_unchanged, |
|
96 | 96 |
}, |
97 | 97 |
'present': { |
98 | 98 |
'present': self.state_update_user, |
... | ... |
@@ -178,8 +178,8 @@ def main(): |
178 | 178 |
if not module.check_mode: |
179 | 179 |
# If this isn't a dry run, create or modify the site |
180 | 180 |
result.update( |
181 |
- webfaction.create_website( |
|
182 |
- *positional_args |
|
181 |
+ webfaction.create_website( |
|
182 |
+ *positional_args |
|
183 | 183 |
) if not existing_site else webfaction.update_website ( |
184 | 184 |
*positional_args |
185 | 185 |
) |
... | ... |
@@ -366,18 +366,18 @@ def parse_check(module): |
366 | 366 |
if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'): |
367 | 367 |
|
368 | 368 |
return ConsulCheck( |
369 |
- module.params.get('check_id'), |
|
370 |
- module.params.get('check_name'), |
|
371 |
- module.params.get('check_node'), |
|
372 |
- module.params.get('check_host'), |
|
373 |
- module.params.get('script'), |
|
374 |
- module.params.get('interval'), |
|
375 |
- module.params.get('ttl'), |
|
376 |
- module.params.get('notes'), |
|
377 |
- module.params.get('http'), |
|
378 |
- module.params.get('timeout'), |
|
379 |
- module.params.get('service_id'), |
|
380 |
- ) |
|
369 |
+ module.params.get('check_id'), |
|
370 |
+ module.params.get('check_name'), |
|
371 |
+ module.params.get('check_node'), |
|
372 |
+ module.params.get('check_host'), |
|
373 |
+ module.params.get('script'), |
|
374 |
+ module.params.get('interval'), |
|
375 |
+ module.params.get('ttl'), |
|
376 |
+ module.params.get('notes'), |
|
377 |
+ module.params.get('http'), |
|
378 |
+ module.params.get('timeout'), |
|
379 |
+ module.params.get('service_id'), |
|
380 |
+ ) |
|
381 | 381 |
|
382 | 382 |
|
383 | 383 |
def parse_service(module): |
... | ... |
@@ -578,7 +578,7 @@ def main(): |
578 | 578 |
register_with_consul(module) |
579 | 579 |
except ConnectionError as e: |
580 | 580 |
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( |
581 |
- module.params.get('host'), module.params.get('port'), str(e))) |
|
581 |
+ module.params.get('host'), module.params.get('port'), str(e))) |
|
582 | 582 |
except Exception as e: |
583 | 583 |
module.fail_json(msg=str(e)) |
584 | 584 |
|
... | ... |
@@ -223,7 +223,7 @@ def load_rules_for_token(module, consul_api, token): |
223 | 223 |
except Exception as e: |
224 | 224 |
module.fail_json( |
225 | 225 |
msg="Could not load rule list from retrieved rule data %s, %s" % ( |
226 |
- token, e)) |
|
226 |
+ token, e)) |
|
227 | 227 |
|
228 | 228 |
return json_to_rules(module, loaded) |
229 | 229 |
|
... | ... |
@@ -357,7 +357,7 @@ def main(): |
357 | 357 |
execute(module) |
358 | 358 |
except ConnectionError as e: |
359 | 359 |
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( |
360 |
- module.params.get('host'), module.params.get('port'), str(e))) |
|
360 |
+ module.params.get('host'), module.params.get('port'), str(e))) |
|
361 | 361 |
except Exception as e: |
362 | 362 |
module.fail_json(msg=str(e)) |
363 | 363 |
|
... | ... |
@@ -282,7 +282,7 @@ def main(): |
282 | 282 |
execute(module) |
283 | 283 |
except ConnectionError as e: |
284 | 284 |
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( |
285 |
- module.params.get('host'), module.params.get('port'), str(e))) |
|
285 |
+ module.params.get('host'), module.params.get('port'), str(e))) |
|
286 | 286 |
except Exception as e: |
287 | 287 |
module.fail_json(msg=str(e)) |
288 | 288 |
|
... | ... |
@@ -173,7 +173,7 @@ def lookup_sessions(module): |
173 | 173 |
node = module.params.get('node') |
174 | 174 |
if not node: |
175 | 175 |
module.fail_json( |
176 |
- msg="node name is required to retrieve sessions for node") |
|
176 |
+ msg="node name is required to retrieve sessions for node") |
|
177 | 177 |
sessions = consul_client.session.node(node, dc=datacenter) |
178 | 178 |
module.exit_json(changed=True, |
179 | 179 |
node=node, |
... | ... |
@@ -182,7 +182,7 @@ def lookup_sessions(module): |
182 | 182 |
session_id = module.params.get('id') |
183 | 183 |
if not session_id: |
184 | 184 |
module.fail_json( |
185 |
- msg="session_id is required to retrieve indvidual session info") |
|
185 |
+ msg="session_id is required to retrieve indvidual session info") |
|
186 | 186 |
|
187 | 187 |
session_by_id = consul_client.session.info(session_id, dc=datacenter) |
188 | 188 |
module.exit_json(changed=True, |
... | ... |
@@ -276,7 +276,7 @@ def main(): |
276 | 276 |
execute(module) |
277 | 277 |
except ConnectionError as e: |
278 | 278 |
module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( |
279 |
- module.params.get('host'), module.params.get('port'), str(e))) |
|
279 |
+ module.params.get('host'), module.params.get('port'), str(e))) |
|
280 | 280 |
except Exception as e: |
281 | 281 |
module.fail_json(msg=str(e)) |
282 | 282 |
|
... | ... |
@@ -136,13 +136,13 @@ def main(): |
136 | 136 |
# hence don't copy this one if you are looking to build others! |
137 | 137 |
module = AnsibleModule( |
138 | 138 |
argument_spec=dict( |
139 |
- _raw_params = dict(), |
|
140 |
- _uses_shell = dict(type='bool', default=False), |
|
141 |
- chdir = dict(type='path'), |
|
142 |
- executable = dict(), |
|
143 |
- creates = dict(type='path'), |
|
144 |
- removes = dict(type='path'), |
|
145 |
- warn = dict(type='bool', default=True), |
|
139 |
+ _raw_params = dict(), |
|
140 |
+ _uses_shell = dict(type='bool', default=False), |
|
141 |
+ chdir = dict(type='path'), |
|
142 |
+ executable = dict(), |
|
143 |
+ creates = dict(type='path'), |
|
144 |
+ removes = dict(type='path'), |
|
145 |
+ warn = dict(type='bool', default=True), |
|
146 | 146 |
) |
147 | 147 |
) |
148 | 148 |
|
... | ... |
@@ -285,8 +285,8 @@ def load_mongocnf(): |
285 | 285 |
try: |
286 | 286 |
config.readfp(open(mongocnf)) |
287 | 287 |
creds = dict( |
288 |
- user=config.get('client', 'user'), |
|
289 |
- password=config.get('client', 'pass') |
|
288 |
+ user=config.get('client', 'user'), |
|
289 |
+ password=config.get('client', 'pass') |
|
290 | 290 |
) |
291 | 291 |
except (ConfigParser.NoOptionError, IOError): |
292 | 292 |
return False |
... | ... |
@@ -218,11 +218,11 @@ def main(): |
218 | 218 |
if mode == "slave": # Only need data if we want to be slave |
219 | 219 |
if not master_host: |
220 | 220 |
module.fail_json( |
221 |
- msg='In slave mode master host must be provided') |
|
221 |
+ msg='In slave mode master host must be provided') |
|
222 | 222 |
|
223 | 223 |
if not master_port: |
224 | 224 |
module.fail_json( |
225 |
- msg='In slave mode master port must be provided') |
|
225 |
+ msg='In slave mode master port must be provided') |
|
226 | 226 |
|
227 | 227 |
#Connect and check |
228 | 228 |
r = redis.StrictRedis(host=login_host, |
... | ... |
@@ -281,7 +281,7 @@ def main(): |
281 | 281 |
if mode == "db": |
282 | 282 |
if db is None: |
283 | 283 |
module.fail_json( |
284 |
- msg="In db mode the db number must be provided") |
|
284 |
+ msg="In db mode the db number must be provided") |
|
285 | 285 |
|
286 | 286 |
#Connect and check |
287 | 287 |
r = redis.StrictRedis(host=login_host, |
... | ... |
@@ -131,16 +131,16 @@ def main(): |
131 | 131 |
|
132 | 132 |
module = AnsibleModule( |
133 | 133 |
argument_spec=dict( |
134 |
- command=dict(required=False, default=None, choices=[ |
|
135 |
- 'ping', 'kv_test', 'join', 'plan', 'commit']), |
|
136 |
- config_dir=dict(default='/etc/riak', type='path'), |
|
137 |
- http_conn=dict(required=False, default='127.0.0.1:8098'), |
|
138 |
- target_node=dict(default='riak@127.0.0.1', required=False), |
|
139 |
- wait_for_handoffs=dict(default=False, type='int'), |
|
140 |
- wait_for_ring=dict(default=False, type='int'), |
|
141 |
- wait_for_service=dict( |
|
142 |
- required=False, default=None, choices=['kv']), |
|
143 |
- validate_certs = dict(default='yes', type='bool')) |
|
134 |
+ command=dict(required=False, default=None, choices=[ |
|
135 |
+ 'ping', 'kv_test', 'join', 'plan', 'commit']), |
|
136 |
+ config_dir=dict(default='/etc/riak', type='path'), |
|
137 |
+ http_conn=dict(required=False, default='127.0.0.1:8098'), |
|
138 |
+ target_node=dict(default='riak@127.0.0.1', required=False), |
|
139 |
+ wait_for_handoffs=dict(default=False, type='int'), |
|
140 |
+ wait_for_ring=dict(default=False, type='int'), |
|
141 |
+ wait_for_service=dict( |
|
142 |
+ required=False, default=None, choices=['kv']), |
|
143 |
+ validate_certs = dict(default='yes', type='bool')) |
|
144 | 144 |
) |
145 | 145 |
|
146 | 146 |
|
... | ... |
@@ -199,7 +199,7 @@ def changemaster(cursor, chm, chm_params): |
199 | 199 |
|
200 | 200 |
def main(): |
201 | 201 |
module = AnsibleModule( |
202 |
- argument_spec = dict( |
|
202 |
+ argument_spec = dict( |
|
203 | 203 |
login_user=dict(default=None), |
204 | 204 |
login_password=dict(default=None, no_log=True), |
205 | 205 |
login_host=dict(default="localhost"), |
... | ... |
@@ -123,7 +123,7 @@ def setvariable(cursor, mysqlvar, value): |
123 | 123 |
|
124 | 124 |
def main(): |
125 | 125 |
module = AnsibleModule( |
126 |
- argument_spec = dict( |
|
126 |
+ argument_spec = dict( |
|
127 | 127 |
login_user=dict(default=None), |
128 | 128 |
login_password=dict(default=None, no_log=True), |
129 | 129 |
login_host=dict(default="localhost"), |
... | ... |
@@ -164,7 +164,7 @@ def main(): |
164 | 164 |
.extensions |
165 | 165 |
.ISOLATION_LEVEL_AUTOCOMMIT) |
166 | 166 |
cursor = db_connection.cursor( |
167 |
- cursor_factory=psycopg2.extras.DictCursor) |
|
167 |
+ cursor_factory=psycopg2.extras.DictCursor) |
|
168 | 168 |
except Exception: |
169 | 169 |
e = get_exception() |
170 | 170 |
module.fail_json(msg="unable to connect to database: %s" % e) |
... | ... |
@@ -228,7 +228,7 @@ def main(): |
228 | 228 |
.extensions |
229 | 229 |
.ISOLATION_LEVEL_AUTOCOMMIT) |
230 | 230 |
cursor = db_connection.cursor( |
231 |
- cursor_factory=psycopg2.extras.DictCursor) |
|
231 |
+ cursor_factory=psycopg2.extras.DictCursor) |
|
232 | 232 |
except Exception: |
233 | 233 |
e = get_exception() |
234 | 234 |
module.fail_json(msg="unable to connect to database: %s" %(text, str(e))) |
... | ... |
@@ -216,7 +216,7 @@ def write_changes(module, b_lines, dest): |
216 | 216 |
if valid: |
217 | 217 |
module.atomic_move(tmpfile, |
218 | 218 |
to_native(os.path.realpath(to_bytes(dest, errors='surrogate_or_strict')), errors='surrogate_or_strict'), |
219 |
- unsafe_writes=module.params['unsafe_writes']) |
|
219 |
+ unsafe_writes=module.params['unsafe_writes']) |
|
220 | 220 |
|
221 | 221 |
|
222 | 222 |
def check_file_attrs(module, changed, message, diff): |
... | ... |
@@ -196,14 +196,14 @@ def main(): |
196 | 196 |
) |
197 | 197 |
|
198 | 198 |
r = requests.post( |
199 |
- url, |
|
200 |
- auth = (module.params['login_user'],module.params['login_password']), |
|
201 |
- headers = { "content-type": "application/json"}, |
|
202 |
- data = json.dumps({ |
|
203 |
- "routing_key": module.params['routing_key'], |
|
204 |
- "arguments": module.params['arguments'] |
|
199 |
+ url, |
|
200 |
+ auth = (module.params['login_user'],module.params['login_password']), |
|
201 |
+ headers = { "content-type": "application/json"}, |
|
202 |
+ data = json.dumps({ |
|
203 |
+ "routing_key": module.params['routing_key'], |
|
204 |
+ "arguments": module.params['arguments'] |
|
205 | 205 |
}) |
206 |
- ) |
|
206 |
+ ) |
|
207 | 207 |
elif module.params['state'] == 'absent': |
208 | 208 |
r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) |
209 | 209 |
|
... | ... |
@@ -189,17 +189,17 @@ def main(): |
189 | 189 |
if change_required: |
190 | 190 |
if module.params['state'] == 'present': |
191 | 191 |
r = requests.put( |
192 |
- url, |
|
193 |
- auth = (module.params['login_user'],module.params['login_password']), |
|
194 |
- headers = { "content-type": "application/json"}, |
|
195 |
- data = json.dumps({ |
|
196 |
- "durable": module.params['durable'], |
|
197 |
- "auto_delete": module.params['auto_delete'], |
|
198 |
- "internal": module.params['internal'], |
|
199 |
- "type": module.params['exchange_type'], |
|
200 |
- "arguments": module.params['arguments'] |
|
192 |
+ url, |
|
193 |
+ auth = (module.params['login_user'],module.params['login_password']), |
|
194 |
+ headers = { "content-type": "application/json"}, |
|
195 |
+ data = json.dumps({ |
|
196 |
+ "durable": module.params['durable'], |
|
197 |
+ "auto_delete": module.params['auto_delete'], |
|
198 |
+ "internal": module.params['internal'], |
|
199 |
+ "type": module.params['exchange_type'], |
|
200 |
+ "arguments": module.params['arguments'] |
|
201 | 201 |
}) |
202 |
- ) |
|
202 |
+ ) |
|
203 | 203 |
elif module.params['state'] == 'absent': |
204 | 204 |
r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) |
205 | 205 |
|
... | ... |
@@ -237,15 +237,15 @@ def main(): |
237 | 237 |
if change_required: |
238 | 238 |
if module.params['state'] == 'present': |
239 | 239 |
r = requests.put( |
240 |
- url, |
|
241 |
- auth = (module.params['login_user'],module.params['login_password']), |
|
242 |
- headers = { "content-type": "application/json"}, |
|
243 |
- data = json.dumps({ |
|
244 |
- "durable": module.params['durable'], |
|
245 |
- "auto_delete": module.params['auto_delete'], |
|
246 |
- "arguments": module.params['arguments'] |
|
240 |
+ url, |
|
241 |
+ auth = (module.params['login_user'],module.params['login_password']), |
|
242 |
+ headers = { "content-type": "application/json"}, |
|
243 |
+ data = json.dumps({ |
|
244 |
+ "durable": module.params['durable'], |
|
245 |
+ "auto_delete": module.params['auto_delete'], |
|
246 |
+ "arguments": module.params['arguments'] |
|
247 | 247 |
}) |
248 |
- ) |
|
248 |
+ ) |
|
249 | 249 |
elif module.params['state'] == 'absent': |
250 | 250 |
r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) |
251 | 251 |
|
... | ... |
@@ -248,11 +248,11 @@ def main(): |
248 | 248 |
|
249 | 249 |
module = AnsibleModule( |
250 | 250 |
argument_spec=dict( |
251 |
- state=dict(required=True, choices=['present', 'absent']), |
|
252 |
- name=dict(required=False), |
|
253 |
- apikey=dict(required=True), |
|
254 |
- apiid=dict(required=True), |
|
255 |
- validate_certs = dict(default='yes', type='bool'), |
|
251 |
+ state=dict(required=True, choices=['present', 'absent']), |
|
252 |
+ name=dict(required=False), |
|
253 |
+ apikey=dict(required=True), |
|
254 |
+ apiid=dict(required=True), |
|
255 |
+ validate_certs = dict(default='yes', type='bool'), |
|
256 | 256 |
) |
257 | 257 |
) |
258 | 258 |
|
... | ... |
@@ -146,16 +146,16 @@ def main(): |
146 | 146 |
|
147 | 147 |
module = AnsibleModule( |
148 | 148 |
argument_spec = dict( |
149 |
- user = dict(required=True), |
|
150 |
- api_key = dict(required=True), |
|
151 |
- name = dict(required=False), |
|
152 |
- title = dict(required=True), |
|
153 |
- source = dict(required=False), |
|
154 |
- description = dict(required=False), |
|
155 |
- start_time = dict(required=False, default=None, type='int'), |
|
156 |
- end_time = dict(require=False, default=None, type='int'), |
|
157 |
- links = dict(type='list') |
|
158 |
- ) |
|
149 |
+ user = dict(required=True), |
|
150 |
+ api_key = dict(required=True), |
|
151 |
+ name = dict(required=False), |
|
152 |
+ title = dict(required=True), |
|
153 |
+ source = dict(required=False), |
|
154 |
+ description = dict(required=False), |
|
155 |
+ start_time = dict(required=False, default=None, type='int'), |
|
156 |
+ end_time = dict(require=False, default=None, type='int'), |
|
157 |
+ links = dict(type='list') |
|
158 |
+ ) |
|
159 | 159 |
) |
160 | 160 |
|
161 | 161 |
post_annotation(module) |
... | ... |
@@ -32,8 +32,8 @@ try: |
32 | 32 |
# Look for simplejson if that's the case |
33 | 33 |
try: |
34 | 34 |
if ( |
35 |
- not isinstance(json.loads, types.FunctionType) or |
|
36 |
- not isinstance(json.dumps, types.FunctionType) |
|
35 |
+ not isinstance(json.loads, types.FunctionType) or |
|
36 |
+ not isinstance(json.dumps, types.FunctionType) |
|
37 | 37 |
): |
38 | 38 |
raise ImportError |
39 | 39 |
except AttributeError: |
... | ... |
@@ -29,8 +29,8 @@ try: |
29 | 29 |
# Look for simplejson if that's the case |
30 | 30 |
try: |
31 | 31 |
if ( |
32 |
- not isinstance(json.loads, types.FunctionType) or |
|
33 |
- not isinstance(json.dumps, types.FunctionType) |
|
32 |
+ not isinstance(json.loads, types.FunctionType) or |
|
33 |
+ not isinstance(json.dumps, types.FunctionType) |
|
34 | 34 |
): |
35 | 35 |
raise ImportError |
36 | 36 |
except AttributeError: |
... | ... |
@@ -259,17 +259,17 @@ def main(): |
259 | 259 |
|
260 | 260 |
module = AnsibleModule( |
261 | 261 |
argument_spec=dict( |
262 |
- state=dict(required=True, choices=['running', 'started', 'ongoing', 'absent']), |
|
263 |
- name=dict(required=True), |
|
264 |
- user=dict(required=False), |
|
265 |
- passwd=dict(required=False), |
|
266 |
- token=dict(required=False), |
|
267 |
- service=dict(required=False, type='list', aliases=["services"]), |
|
268 |
- requester_id=dict(required=False), |
|
269 |
- hours=dict(default='1', required=False), |
|
270 |
- minutes=dict(default='0', required=False), |
|
271 |
- desc=dict(default='Created by Ansible', required=False), |
|
272 |
- validate_certs = dict(default='yes', type='bool'), |
|
262 |
+ state=dict(required=True, choices=['running', 'started', 'ongoing', 'absent']), |
|
263 |
+ name=dict(required=True), |
|
264 |
+ user=dict(required=False), |
|
265 |
+ passwd=dict(required=False), |
|
266 |
+ token=dict(required=False), |
|
267 |
+ service=dict(required=False, type='list', aliases=["services"]), |
|
268 |
+ requester_id=dict(required=False), |
|
269 |
+ hours=dict(default='1', required=False), |
|
270 |
+ minutes=dict(default='0', required=False), |
|
271 |
+ desc=dict(default='Created by Ansible', required=False), |
|
272 |
+ validate_certs = dict(default='yes', type='bool'), |
|
273 | 273 |
) |
274 | 274 |
) |
275 | 275 |
|
... | ... |
@@ -189,10 +189,10 @@ def main(): |
189 | 189 |
incident_key = module.params['incident_key'] |
190 | 190 |
|
191 | 191 |
state_event_dict = { |
192 |
- 'triggered': 'trigger', |
|
193 |
- 'acknowledged': 'acknowledge', |
|
194 |
- 'resolved': 'resolve' |
|
195 |
- } |
|
192 |
+ 'triggered': 'trigger', |
|
193 |
+ 'acknowledged': 'acknowledge', |
|
194 |
+ 'resolved': 'resolve' |
|
195 |
+ } |
|
196 | 196 |
|
197 | 197 |
event_type = state_event_dict[state] |
198 | 198 |
|
... | ... |
@@ -125,11 +125,11 @@ def main(): |
125 | 125 |
|
126 | 126 |
module = AnsibleModule( |
127 | 127 |
argument_spec=dict( |
128 |
- state=dict(required=True, choices=['running', 'paused', 'started', 'stopped']), |
|
129 |
- checkid=dict(required=True), |
|
130 |
- uid=dict(required=True), |
|
131 |
- passwd=dict(required=True), |
|
132 |
- key=dict(required=True) |
|
128 |
+ state=dict(required=True, choices=['running', 'paused', 'started', 'stopped']), |
|
129 |
+ checkid=dict(required=True), |
|
130 |
+ uid=dict(required=True), |
|
131 |
+ passwd=dict(required=True), |
|
132 |
+ key=dict(required=True) |
|
133 | 133 |
) |
134 | 134 |
) |
135 | 135 |
|
... | ... |
@@ -201,7 +201,7 @@ def get_api_auth_headers(api_id, api_key, url, statuspage): |
201 | 201 |
|
202 | 202 |
try: |
203 | 203 |
response = open_url( |
204 |
- url + "/v2/component/list/" + statuspage, headers=headers) |
|
204 |
+ url + "/v2/component/list/" + statuspage, headers=headers) |
|
205 | 205 |
data = json.loads(response.read()) |
206 | 206 |
if data['status']['message'] == 'Authentication failed': |
207 | 207 |
return 1, None, None, "Authentication failed: " \ |
... | ... |
@@ -265,7 +265,7 @@ def get_date_time(start_date, start_time, minutes): |
265 | 265 |
try: |
266 | 266 |
# Work out end date/time based on minutes |
267 | 267 |
date_time_start = datetime.datetime.strptime( |
268 |
- start_time + start_date, '%H:%M%m/%d/%Y') |
|
268 |
+ start_time + start_date, '%H:%M%m/%d/%Y') |
|
269 | 269 |
delta = date_time_start + datetime.timedelta(minutes=minutes) |
270 | 270 |
returned_date.append(delta.strftime("%m/%d/%Y")) |
271 | 271 |
returned_date.append(delta.strftime("%H:%M")) |
... | ... |
@@ -296,25 +296,25 @@ def create_maintenance(auth_headers, url, statuspage, host_ids, |
296 | 296 |
container_id.append(val['container_id']) |
297 | 297 |
try: |
298 | 298 |
values = json.dumps({ |
299 |
- "statuspage_id": statuspage, |
|
300 |
- "components": component_id, |
|
301 |
- "containers": container_id, |
|
302 |
- "all_infrastructure_affected": str(int(all_infrastructure_affected)), |
|
303 |
- "automation": str(int(automation)), |
|
304 |
- "maintenance_name": title, |
|
305 |
- "maintenance_details": desc, |
|
306 |
- "date_planned_start": returned_dates[0], |
|
307 |
- "time_planned_start": returned_dates[1], |
|
308 |
- "date_planned_end": returned_dates[2], |
|
309 |
- "time_planned_end": returned_dates[3], |
|
310 |
- "maintenance_notify_now": str(int(maintenance_notify_now)), |
|
311 |
- "maintenance_notify_72_hr": str(int(maintenance_notify_72_hr)), |
|
312 |
- "maintenance_notify_24_hr": str(int(maintenance_notify_24_hr)), |
|
313 |
- "maintenance_notify_1_hr": str(int(maintenance_notify_1_hr)) |
|
314 |
- }) |
|
299 |
+ "statuspage_id": statuspage, |
|
300 |
+ "components": component_id, |
|
301 |
+ "containers": container_id, |
|
302 |
+ "all_infrastructure_affected": str(int(all_infrastructure_affected)), |
|
303 |
+ "automation": str(int(automation)), |
|
304 |
+ "maintenance_name": title, |
|
305 |
+ "maintenance_details": desc, |
|
306 |
+ "date_planned_start": returned_dates[0], |
|
307 |
+ "time_planned_start": returned_dates[1], |
|
308 |
+ "date_planned_end": returned_dates[2], |
|
309 |
+ "time_planned_end": returned_dates[3], |
|
310 |
+ "maintenance_notify_now": str(int(maintenance_notify_now)), |
|
311 |
+ "maintenance_notify_72_hr": str(int(maintenance_notify_72_hr)), |
|
312 |
+ "maintenance_notify_24_hr": str(int(maintenance_notify_24_hr)), |
|
313 |
+ "maintenance_notify_1_hr": str(int(maintenance_notify_1_hr)) |
|
314 |
+ }) |
|
315 | 315 |
response = open_url( |
316 |
- url + "/v2/maintenance/schedule", data=values, |
|
317 |
- headers=auth_headers) |
|
316 |
+ url + "/v2/maintenance/schedule", data=values, |
|
317 |
+ headers=auth_headers) |
|
318 | 318 |
data = json.loads(response.read()) |
319 | 319 |
|
320 | 320 |
if data["status"]["error"] == "yes": |
... | ... |
@@ -332,9 +332,9 @@ def delete_maintenance(auth_headers, url, statuspage, maintenance_id): |
332 | 332 |
"maintenance_id": maintenance_id, |
333 | 333 |
}) |
334 | 334 |
response = open_url( |
335 |
- url=url + "/v2/maintenance/delete", |
|
336 |
- data=values, |
|
337 |
- headers=auth_headers) |
|
335 |
+ url=url + "/v2/maintenance/delete", |
|
336 |
+ data=values, |
|
337 |
+ headers=auth_headers) |
|
338 | 338 |
data = json.loads(response.read()) |
339 | 339 |
if data["status"]["error"] == "yes": |
340 | 340 |
return 1, None, "Invalid maintenance_id" |
... | ... |
@@ -411,7 +411,7 @@ def main(): |
411 | 411 |
|
412 | 412 |
if minutes or start_time and start_date: |
413 | 413 |
(rc, returned_date, error) = get_date_time( |
414 |
- start_date, start_time, minutes) |
|
414 |
+ start_date, start_time, minutes) |
|
415 | 415 |
if rc != 0: |
416 | 416 |
module.fail_json(msg="Failed to set date/time: %s" % error) |
417 | 417 |
|
... | ... |
@@ -438,11 +438,11 @@ def main(): |
438 | 438 |
module.exit_json(changed=True) |
439 | 439 |
else: |
440 | 440 |
(rc, _, error) = create_maintenance( |
441 |
- auth_headers, url, statuspage, host_ids, |
|
442 |
- all_infrastructure_affected, automation, |
|
443 |
- title, desc, returned_date, maintenance_notify_now, |
|
444 |
- maintenance_notify_72_hr, maintenance_notify_24_hr, |
|
445 |
- maintenance_notify_1_hr) |
|
441 |
+ auth_headers, url, statuspage, host_ids, |
|
442 |
+ all_infrastructure_affected, automation, |
|
443 |
+ title, desc, returned_date, maintenance_notify_now, |
|
444 |
+ maintenance_notify_72_hr, maintenance_notify_24_hr, |
|
445 |
+ maintenance_notify_1_hr) |
|
446 | 446 |
if rc == 0: |
447 | 447 |
module.exit_json(changed=True, result="Successfully created " |
448 | 448 |
"maintenance") |
... | ... |
@@ -464,15 +464,15 @@ def main(): |
464 | 464 |
module.exit_json(changed=True) |
465 | 465 |
else: |
466 | 466 |
(rc, _, error) = delete_maintenance( |
467 |
- auth_headers, url, statuspage, maintenance_id) |
|
467 |
+ auth_headers, url, statuspage, maintenance_id) |
|
468 | 468 |
if rc == 0: |
469 | 469 |
module.exit_json( |
470 |
- changed=True, |
|
471 |
- result="Successfully deleted maintenance" |
|
470 |
+ changed=True, |
|
471 |
+ result="Successfully deleted maintenance" |
|
472 | 472 |
) |
473 | 473 |
else: |
474 | 474 |
module.fail_json( |
475 |
- msg="Failed to delete maintenance: %s" % error) |
|
475 |
+ msg="Failed to delete maintenance: %s" % error) |
|
476 | 476 |
|
477 | 477 |
from ansible.module_utils.basic import * |
478 | 478 |
from ansible.module_utils.urls import * |
... | ... |
@@ -628,16 +628,16 @@ def main(): |
628 | 628 |
), |
629 | 629 |
supports_check_mode = True, |
630 | 630 |
required_if = ([ |
631 |
- ('state','present',['record','type']), |
|
632 |
- ('type','MX',['priority','value']), |
|
633 |
- ('type','SRV',['port','priority','proto','service','value','weight']), |
|
634 |
- ('type','A',['value']), |
|
635 |
- ('type','AAAA',['value']), |
|
636 |
- ('type','CNAME',['value']), |
|
637 |
- ('type','TXT',['value']), |
|
638 |
- ('type','NS',['value']), |
|
639 |
- ('type','SPF',['value']) |
|
640 |
- ] |
|
631 |
+ ('state','present',['record','type']), |
|
632 |
+ ('type','MX',['priority','value']), |
|
633 |
+ ('type','SRV',['port','priority','proto','service','value','weight']), |
|
634 |
+ ('type','A',['value']), |
|
635 |
+ ('type','AAAA',['value']), |
|
636 |
+ ('type','CNAME',['value']), |
|
637 |
+ ('type','TXT',['value']), |
|
638 |
+ ('type','NS',['value']), |
|
639 |
+ ('type','SPF',['value']) |
|
640 |
+ ] |
|
641 | 641 |
), |
642 | 642 |
required_one_of = ( |
643 | 643 |
[['record','value','type']] |
... | ... |
@@ -391,7 +391,7 @@ def get_aaa_server_info(server_type, module): |
391 | 391 |
aaa_regex = '.*{0}-server\skey\s\d\s+(?P<key>\S+).*'.format(server_type) |
392 | 392 |
|
393 | 393 |
server_body = execute_show_command( |
394 |
- server_command, module, command_type='cli_show_ascii')[0] |
|
394 |
+ server_command, module, command_type='cli_show_ascii')[0] |
|
395 | 395 |
|
396 | 396 |
split_server = server_body.splitlines() |
397 | 397 |
|
... | ... |
@@ -403,11 +403,11 @@ def get_aaa_server_info(server_type, module): |
403 | 403 |
aaa_server_info['deadtime'] = line.split(':')[1] |
404 | 404 |
|
405 | 405 |
request_body = execute_show_command( |
406 |
- request_command, module, command_type='cli_show_ascii')[0] |
|
406 |
+ request_command, module, command_type='cli_show_ascii')[0] |
|
407 | 407 |
aaa_server_info['directed_request'] = request_body.replace('\n', '') |
408 | 408 |
|
409 | 409 |
key_body = execute_show_command( |
410 |
- global_key_command, module, command_type='cli_show_ascii')[0] |
|
410 |
+ global_key_command, module, command_type='cli_show_ascii')[0] |
|
411 | 411 |
|
412 | 412 |
try: |
413 | 413 |
match_global_key = re.match(aaa_regex, key_body, re.DOTALL) |
... | ... |
@@ -480,15 +480,15 @@ def default_aaa_server(existing, params, server_type): |
480 | 480 |
|
481 | 481 |
def main(): |
482 | 482 |
argument_spec = dict( |
483 |
- server_type=dict(type='str', |
|
483 |
+ server_type=dict(type='str', |
|
484 | 484 |
choices=['radius', 'tacacs'], required=True), |
485 |
- global_key=dict(type='str'), |
|
486 |
- encrypt_type=dict(type='str', choices=['0', '7']), |
|
487 |
- deadtime=dict(type='str'), |
|
488 |
- server_timeout=dict(type='str'), |
|
489 |
- directed_request=dict(type='str', |
|
485 |
+ global_key=dict(type='str'), |
|
486 |
+ encrypt_type=dict(type='str', choices=['0', '7']), |
|
487 |
+ deadtime=dict(type='str'), |
|
488 |
+ server_timeout=dict(type='str'), |
|
489 |
+ directed_request=dict(type='str', |
|
490 | 490 |
choices=['enabled', 'disabled', 'default']), |
491 |
- state=dict(choices=['default', 'present'], default='present'), |
|
491 |
+ state=dict(choices=['default', 'present'], default='present'), |
|
492 | 492 |
) |
493 | 493 |
module = get_network_module(argument_spec=argument_spec, |
494 | 494 |
supports_check_mode=True) |
... | ... |
@@ -522,7 +522,7 @@ def main(): |
522 | 522 |
raise ValueError |
523 | 523 |
except ValueError: |
524 | 524 |
module.fail_json( |
525 |
- msg='deadtime must be an integer between 0 and 1440') |
|
525 |
+ msg='deadtime must be an integer between 0 and 1440') |
|
526 | 526 |
|
527 | 527 |
if server_timeout: |
528 | 528 |
try: |
... | ... |
@@ -533,7 +533,7 @@ def main(): |
533 | 533 |
msg='server_timeout must be an integer between 1 and 60') |
534 | 534 |
|
535 | 535 |
delta = dict(set(proposed.items()).difference( |
536 |
- existing.items())) |
|
536 |
+ existing.items())) |
|
537 | 537 |
if delta: |
538 | 538 |
command = config_aaa_server(delta, server_type) |
539 | 539 |
if command: |
... | ... |
@@ -485,15 +485,15 @@ def config_aaa_host(server_type, address, params, clear=False): |
485 | 485 |
|
486 | 486 |
def main(): |
487 | 487 |
argument_spec = dict( |
488 |
- server_type=dict(choices=['radius', 'tacacs'], required=True), |
|
489 |
- address=dict(type='str', required=True), |
|
490 |
- key=dict(type='str'), |
|
491 |
- encrypt_type=dict(type='str', choices=['0', '7']), |
|
492 |
- host_timeout=dict(type='str'), |
|
493 |
- auth_port=dict(type='str'), |
|
494 |
- acct_port=dict(type='str'), |
|
495 |
- tacacs_port=dict(type='str'), |
|
496 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
488 |
+ server_type=dict(choices=['radius', 'tacacs'], required=True), |
|
489 |
+ address=dict(type='str', required=True), |
|
490 |
+ key=dict(type='str'), |
|
491 |
+ encrypt_type=dict(type='str', choices=['0', '7']), |
|
492 |
+ host_timeout=dict(type='str'), |
|
493 |
+ auth_port=dict(type='str'), |
|
494 |
+ acct_port=dict(type='str'), |
|
495 |
+ tacacs_port=dict(type='str'), |
|
496 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
497 | 497 |
) |
498 | 498 |
module = get_network_module(argument_spec=argument_spec, |
499 | 499 |
supports_check_mode=True) |
... | ... |
@@ -543,7 +543,7 @@ def main(): |
543 | 543 |
msg='host_timeout must be an integer between 1 and 60') |
544 | 544 |
|
545 | 545 |
delta = dict( |
546 |
- set(proposed.items()).difference(existing.items())) |
|
546 |
+ set(proposed.items()).difference(existing.items())) |
|
547 | 547 |
if delta: |
548 | 548 |
union = existing.copy() |
549 | 549 |
union.update(delta) |
... | ... |
@@ -553,10 +553,10 @@ def main(): |
553 | 553 |
|
554 | 554 |
elif state == 'absent': |
555 | 555 |
intersect = dict( |
556 |
- set(proposed.items()).intersection(existing.items())) |
|
556 |
+ set(proposed.items()).intersection(existing.items())) |
|
557 | 557 |
if intersect.get('address') and intersect.get('server_type'): |
558 | 558 |
command = 'no {0}-server host {1}'.format( |
559 |
- intersect.get('server_type'), intersect.get('address')) |
|
559 |
+ intersect.get('server_type'), intersect.get('address')) |
|
560 | 560 |
commands.append(command) |
561 | 561 |
|
562 | 562 |
cmds = flatten_list(commands) |
... | ... |
@@ -641,49 +641,49 @@ def execute_config_command(commands, module): |
641 | 641 |
|
642 | 642 |
def main(): |
643 | 643 |
argument_spec = dict( |
644 |
- seq=dict(required=False, type='str'), |
|
645 |
- name=dict(required=True, type='str'), |
|
646 |
- action=dict(required=False, choices=['remark', 'permit', 'deny']), |
|
647 |
- remark=dict(required=False, type='str'), |
|
648 |
- proto=dict(required=False, type='str'), |
|
649 |
- src=dict(required=False, type='str'), |
|
650 |
- src_port_op=dict(required=False), |
|
651 |
- src_port1=dict(required=False, type='str'), |
|
652 |
- src_port2=dict(required=False, type='str'), |
|
653 |
- dest=dict(required=False, type='str'), |
|
654 |
- dest_port_op=dict(required=False), |
|
655 |
- dest_port1=dict(required=False, type='str'), |
|
656 |
- dest_port2=dict(required=False, type='str'), |
|
657 |
- log=dict(required=False, choices=['enable']), |
|
658 |
- urg=dict(required=False, choices=['enable']), |
|
659 |
- ack=dict(required=False, choices=['enable']), |
|
660 |
- psh=dict(required=False, choices=['enable']), |
|
661 |
- rst=dict(required=False, choices=['enable']), |
|
662 |
- syn=dict(required=False, choices=['enable']), |
|
663 |
- fragments=dict(required=False, choices=['enable']), |
|
664 |
- fin=dict(required=False, choices=['enable']), |
|
665 |
- established=dict(required=False, choices=['enable']), |
|
666 |
- time_range=dict(required=False), |
|
667 |
- precedence=dict(required=False, choices=['critical', 'flash', |
|
644 |
+ seq=dict(required=False, type='str'), |
|
645 |
+ name=dict(required=True, type='str'), |
|
646 |
+ action=dict(required=False, choices=['remark', 'permit', 'deny']), |
|
647 |
+ remark=dict(required=False, type='str'), |
|
648 |
+ proto=dict(required=False, type='str'), |
|
649 |
+ src=dict(required=False, type='str'), |
|
650 |
+ src_port_op=dict(required=False), |
|
651 |
+ src_port1=dict(required=False, type='str'), |
|
652 |
+ src_port2=dict(required=False, type='str'), |
|
653 |
+ dest=dict(required=False, type='str'), |
|
654 |
+ dest_port_op=dict(required=False), |
|
655 |
+ dest_port1=dict(required=False, type='str'), |
|
656 |
+ dest_port2=dict(required=False, type='str'), |
|
657 |
+ log=dict(required=False, choices=['enable']), |
|
658 |
+ urg=dict(required=False, choices=['enable']), |
|
659 |
+ ack=dict(required=False, choices=['enable']), |
|
660 |
+ psh=dict(required=False, choices=['enable']), |
|
661 |
+ rst=dict(required=False, choices=['enable']), |
|
662 |
+ syn=dict(required=False, choices=['enable']), |
|
663 |
+ fragments=dict(required=False, choices=['enable']), |
|
664 |
+ fin=dict(required=False, choices=['enable']), |
|
665 |
+ established=dict(required=False, choices=['enable']), |
|
666 |
+ time_range=dict(required=False), |
|
667 |
+ precedence=dict(required=False, choices=['critical', 'flash', |
|
668 | 668 |
'flash-override', |
669 | 669 |
'immediate', 'internet', |
670 | 670 |
'network', 'priority', |
671 | 671 |
'routine']), |
672 |
- dscp=dict(required=False, choices=['af11', 'af12', 'af13', 'af21', |
|
672 |
+ dscp=dict(required=False, choices=['af11', 'af12', 'af13', 'af21', |
|
673 | 673 |
'af22', 'af23', 'af31', 'af32', |
674 | 674 |
'af33', 'af41', 'af42', 'af43', |
675 | 675 |
'cs1', 'cs2', 'cs3', 'cs4', |
676 | 676 |
'cs5', 'cs6', 'cs7', 'default', |
677 | 677 |
'ef']), |
678 |
- state=dict(choices=['absent', 'present', 'delete_acl'], |
|
678 |
+ state=dict(choices=['absent', 'present', 'delete_acl'], |
|
679 | 679 |
default='present'), |
680 |
- protocol=dict(choices=['http', 'https'], default='http'), |
|
681 |
- host=dict(required=True), |
|
682 |
- username=dict(type='str'), |
|
683 |
- password=dict(no_log=True, type='str'), |
|
684 |
- include_defaults=dict(default=False), |
|
685 |
- config=dict(), |
|
686 |
- save=dict(type='bool', default=False) |
|
680 |
+ protocol=dict(choices=['http', 'https'], default='http'), |
|
681 |
+ host=dict(required=True), |
|
682 |
+ username=dict(type='str'), |
|
683 |
+ password=dict(no_log=True, type='str'), |
|
684 |
+ include_defaults=dict(default=False), |
|
685 |
+ config=dict(), |
|
686 |
+ save=dict(type='bool', default=False) |
|
687 | 687 |
) |
688 | 688 |
module = get_network_module(argument_spec=argument_spec, |
689 | 689 |
supports_check_mode=True) |
... | ... |
@@ -466,14 +466,14 @@ def execute_config_command(commands, module): |
466 | 466 |
|
467 | 467 |
def main(): |
468 | 468 |
argument_spec = dict( |
469 |
- name=dict(required=False, type='str'), |
|
470 |
- interface=dict(required=True), |
|
471 |
- direction=dict(required=True, choices=['egress', 'ingress']), |
|
472 |
- state=dict(choices=['absent', 'present'], |
|
469 |
+ name=dict(required=False, type='str'), |
|
470 |
+ interface=dict(required=True), |
|
471 |
+ direction=dict(required=True, choices=['egress', 'ingress']), |
|
472 |
+ state=dict(choices=['absent', 'present'], |
|
473 | 473 |
default='present'), |
474 |
- include_defaults=dict(default=True), |
|
475 |
- config=dict(), |
|
476 |
- save=dict(type='bool', default=False) |
|
474 |
+ include_defaults=dict(default=True), |
|
475 |
+ config=dict(), |
|
476 |
+ save=dict(type='bool', default=False) |
|
477 | 477 |
) |
478 | 478 |
module = get_network_module(argument_spec=argument_spec, |
479 | 479 |
supports_check_mode=True) |
... | ... |
@@ -787,8 +787,8 @@ def state_present(module, existing, proposed, candidate): |
787 | 787 |
commands.append('{0} {1}'.format(key, peer_string)) |
788 | 788 |
elif key.startswith('timers bgp'): |
789 | 789 |
command = 'timers bgp {0} {1}'.format( |
790 |
- proposed['timer_bgp_keepalive'], |
|
791 |
- proposed['timer_bgp_hold']) |
|
790 |
+ proposed['timer_bgp_keepalive'], |
|
791 |
+ proposed['timer_bgp_hold']) |
|
792 | 792 |
if command not in commands: |
793 | 793 |
commands.append(command) |
794 | 794 |
else: |
... | ... |
@@ -857,50 +857,50 @@ def fix_commands(commands): |
857 | 857 |
|
858 | 858 |
def main(): |
859 | 859 |
argument_spec = dict( |
860 |
- asn=dict(required=True, type='str'), |
|
861 |
- vrf=dict(required=False, type='str', default='default'), |
|
862 |
- bestpath_always_compare_med=dict(required=False, type='bool'), |
|
863 |
- bestpath_aspath_multipath_relax=dict(required=False, type='bool'), |
|
864 |
- bestpath_compare_neighborid=dict(required=False, type='bool'), |
|
865 |
- bestpath_compare_routerid=dict(required=False, type='bool'), |
|
866 |
- bestpath_cost_community_ignore=dict(required=False, type='bool'), |
|
867 |
- bestpath_med_confed=dict(required=False, type='bool'), |
|
868 |
- bestpath_med_missing_as_worst=dict(required=False, type='bool'), |
|
869 |
- bestpath_med_non_deterministic=dict(required=False, type='bool'), |
|
870 |
- cluster_id=dict(required=False, type='str'), |
|
871 |
- confederation_id=dict(required=False, type='str'), |
|
872 |
- confederation_peers=dict(required=False, type='str'), |
|
873 |
- disable_policy_batching=dict(required=False, type='bool'), |
|
874 |
- disable_policy_batching_ipv4_prefix_list=dict(required=False, type='str'), |
|
875 |
- disable_policy_batching_ipv6_prefix_list=dict(required=False, type='str'), |
|
876 |
- enforce_first_as=dict(required=False, type='bool'), |
|
877 |
- event_history_cli=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
878 |
- event_history_detail=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
879 |
- event_history_events=dict(required=False, choices=['true', 'false', 'default' 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
880 |
- event_history_periodic=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
881 |
- fast_external_fallover=dict(required=False, type='bool'), |
|
882 |
- flush_routes=dict(required=False, type='bool'), |
|
883 |
- graceful_restart=dict(required=False, type='bool'), |
|
884 |
- graceful_restart_helper=dict(required=False, type='bool'), |
|
885 |
- graceful_restart_timers_restart=dict(required=False, type='str'), |
|
886 |
- graceful_restart_timers_stalepath_time=dict(required=False, type='str'), |
|
887 |
- isolate=dict(required=False, type='bool'), |
|
888 |
- local_as=dict(required=False, type='str'), |
|
889 |
- log_neighbor_changes=dict(required=False, type='bool'), |
|
890 |
- maxas_limit=dict(required=False, type='str'), |
|
891 |
- neighbor_down_fib_accelerate=dict(required=False, type='bool'), |
|
892 |
- reconnect_interval=dict(required=False, type='str'), |
|
893 |
- router_id=dict(required=False, type='str'), |
|
894 |
- shutdown=dict(required=False, type='bool'), |
|
895 |
- suppress_fib_pending=dict(required=False, type='bool'), |
|
896 |
- timer_bestpath_limit=dict(required=False, type='str'), |
|
897 |
- timer_bgp_hold=dict(required=False, type='str'), |
|
898 |
- timer_bgp_keepalive=dict(required=False, type='str'), |
|
899 |
- state=dict(choices=['present', 'absent'], default='present', |
|
860 |
+ asn=dict(required=True, type='str'), |
|
861 |
+ vrf=dict(required=False, type='str', default='default'), |
|
862 |
+ bestpath_always_compare_med=dict(required=False, type='bool'), |
|
863 |
+ bestpath_aspath_multipath_relax=dict(required=False, type='bool'), |
|
864 |
+ bestpath_compare_neighborid=dict(required=False, type='bool'), |
|
865 |
+ bestpath_compare_routerid=dict(required=False, type='bool'), |
|
866 |
+ bestpath_cost_community_ignore=dict(required=False, type='bool'), |
|
867 |
+ bestpath_med_confed=dict(required=False, type='bool'), |
|
868 |
+ bestpath_med_missing_as_worst=dict(required=False, type='bool'), |
|
869 |
+ bestpath_med_non_deterministic=dict(required=False, type='bool'), |
|
870 |
+ cluster_id=dict(required=False, type='str'), |
|
871 |
+ confederation_id=dict(required=False, type='str'), |
|
872 |
+ confederation_peers=dict(required=False, type='str'), |
|
873 |
+ disable_policy_batching=dict(required=False, type='bool'), |
|
874 |
+ disable_policy_batching_ipv4_prefix_list=dict(required=False, type='str'), |
|
875 |
+ disable_policy_batching_ipv6_prefix_list=dict(required=False, type='str'), |
|
876 |
+ enforce_first_as=dict(required=False, type='bool'), |
|
877 |
+ event_history_cli=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
878 |
+ event_history_detail=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
879 |
+ event_history_events=dict(required=False, choices=['true', 'false', 'default' 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
880 |
+ event_history_periodic=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), |
|
881 |
+ fast_external_fallover=dict(required=False, type='bool'), |
|
882 |
+ flush_routes=dict(required=False, type='bool'), |
|
883 |
+ graceful_restart=dict(required=False, type='bool'), |
|
884 |
+ graceful_restart_helper=dict(required=False, type='bool'), |
|
885 |
+ graceful_restart_timers_restart=dict(required=False, type='str'), |
|
886 |
+ graceful_restart_timers_stalepath_time=dict(required=False, type='str'), |
|
887 |
+ isolate=dict(required=False, type='bool'), |
|
888 |
+ local_as=dict(required=False, type='str'), |
|
889 |
+ log_neighbor_changes=dict(required=False, type='bool'), |
|
890 |
+ maxas_limit=dict(required=False, type='str'), |
|
891 |
+ neighbor_down_fib_accelerate=dict(required=False, type='bool'), |
|
892 |
+ reconnect_interval=dict(required=False, type='str'), |
|
893 |
+ router_id=dict(required=False, type='str'), |
|
894 |
+ shutdown=dict(required=False, type='bool'), |
|
895 |
+ suppress_fib_pending=dict(required=False, type='bool'), |
|
896 |
+ timer_bestpath_limit=dict(required=False, type='str'), |
|
897 |
+ timer_bgp_hold=dict(required=False, type='str'), |
|
898 |
+ timer_bgp_keepalive=dict(required=False, type='str'), |
|
899 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
900 | 900 |
required=False), |
901 |
- include_defaults=dict(default=True), |
|
902 |
- config=dict(), |
|
903 |
- save=dict(type='bool', default=False) |
|
901 |
+ include_defaults=dict(default=True), |
|
902 |
+ config=dict(), |
|
903 |
+ save=dict(type='bool', default=False) |
|
904 | 904 |
) |
905 | 905 |
module = get_network_module(argument_spec=argument_spec, |
906 | 906 |
required_together=[['timer_bgp_hold', |
... | ... |
@@ -909,46 +909,46 @@ def main(): |
909 | 909 |
|
910 | 910 |
state = module.params['state'] |
911 | 911 |
args = [ |
912 |
- "asn", |
|
913 |
- "bestpath_always_compare_med", |
|
914 |
- "bestpath_aspath_multipath_relax", |
|
915 |
- "bestpath_compare_neighborid", |
|
916 |
- "bestpath_compare_routerid", |
|
917 |
- "bestpath_cost_community_ignore", |
|
918 |
- "bestpath_med_confed", |
|
919 |
- "bestpath_med_missing_as_worst", |
|
920 |
- "bestpath_med_non_deterministic", |
|
921 |
- "cluster_id", |
|
922 |
- "confederation_id", |
|
923 |
- "confederation_peers", |
|
924 |
- "disable_policy_batching", |
|
925 |
- "disable_policy_batching_ipv4_prefix_list", |
|
926 |
- "disable_policy_batching_ipv6_prefix_list", |
|
927 |
- "enforce_first_as", |
|
928 |
- "event_history_cli", |
|
929 |
- "event_history_detail", |
|
930 |
- "event_history_events", |
|
931 |
- "event_history_periodic", |
|
932 |
- "fast_external_fallover", |
|
933 |
- "flush_routes", |
|
934 |
- "graceful_restart", |
|
935 |
- "graceful_restart_helper", |
|
936 |
- "graceful_restart_timers_restart", |
|
937 |
- "graceful_restart_timers_stalepath_time", |
|
938 |
- "isolate", |
|
939 |
- "local_as", |
|
940 |
- "log_neighbor_changes", |
|
941 |
- "maxas_limit", |
|
942 |
- "neighbor_down_fib_accelerate", |
|
943 |
- "reconnect_interval", |
|
944 |
- "router_id", |
|
945 |
- "shutdown", |
|
946 |
- "suppress_fib_pending", |
|
947 |
- "timer_bestpath_limit", |
|
948 |
- "timer_bgp_hold", |
|
949 |
- "timer_bgp_keepalive", |
|
950 |
- "vrf" |
|
951 |
- ] |
|
912 |
+ "asn", |
|
913 |
+ "bestpath_always_compare_med", |
|
914 |
+ "bestpath_aspath_multipath_relax", |
|
915 |
+ "bestpath_compare_neighborid", |
|
916 |
+ "bestpath_compare_routerid", |
|
917 |
+ "bestpath_cost_community_ignore", |
|
918 |
+ "bestpath_med_confed", |
|
919 |
+ "bestpath_med_missing_as_worst", |
|
920 |
+ "bestpath_med_non_deterministic", |
|
921 |
+ "cluster_id", |
|
922 |
+ "confederation_id", |
|
923 |
+ "confederation_peers", |
|
924 |
+ "disable_policy_batching", |
|
925 |
+ "disable_policy_batching_ipv4_prefix_list", |
|
926 |
+ "disable_policy_batching_ipv6_prefix_list", |
|
927 |
+ "enforce_first_as", |
|
928 |
+ "event_history_cli", |
|
929 |
+ "event_history_detail", |
|
930 |
+ "event_history_events", |
|
931 |
+ "event_history_periodic", |
|
932 |
+ "fast_external_fallover", |
|
933 |
+ "flush_routes", |
|
934 |
+ "graceful_restart", |
|
935 |
+ "graceful_restart_helper", |
|
936 |
+ "graceful_restart_timers_restart", |
|
937 |
+ "graceful_restart_timers_stalepath_time", |
|
938 |
+ "isolate", |
|
939 |
+ "local_as", |
|
940 |
+ "log_neighbor_changes", |
|
941 |
+ "maxas_limit", |
|
942 |
+ "neighbor_down_fib_accelerate", |
|
943 |
+ "reconnect_interval", |
|
944 |
+ "router_id", |
|
945 |
+ "shutdown", |
|
946 |
+ "suppress_fib_pending", |
|
947 |
+ "timer_bestpath_limit", |
|
948 |
+ "timer_bgp_hold", |
|
949 |
+ "timer_bgp_keepalive", |
|
950 |
+ "vrf" |
|
951 |
+ ] |
|
952 | 952 |
|
953 | 953 |
if module.params['vrf'] != 'default': |
954 | 954 |
for param, inserted_value in module.params.items(): |
... | ... |
@@ -506,11 +506,11 @@ PARAM_TO_COMMAND_KEYMAP = { |
506 | 506 |
'vrf': 'vrf' |
507 | 507 |
} |
508 | 508 |
DAMPENING_PARAMS = [ |
509 |
- 'dampening_half_time', |
|
510 |
- 'dampening_suppress_time', |
|
511 |
- 'dampening_reuse_time', |
|
512 |
- 'dampening_max_suppress_time' |
|
513 |
- ] |
|
509 |
+ 'dampening_half_time', |
|
510 |
+ 'dampening_suppress_time', |
|
511 |
+ 'dampening_reuse_time', |
|
512 |
+ 'dampening_max_suppress_time' |
|
513 |
+ ] |
|
514 | 514 |
|
515 | 515 |
|
516 | 516 |
def invoke(name, *args, **kwargs): |
... | ... |
@@ -543,11 +543,11 @@ def get_custom_list_value(config, arg, module): |
543 | 543 |
copy_attributes = False |
544 | 544 |
inject_map_command = ('inject-map {0} exist-map {1} ' |
545 | 545 |
'copy-attributes'.format( |
546 |
- inject_group['inject_map'], |
|
547 |
- inject_group['exist_map'])) |
|
546 |
+ inject_group['inject_map'], |
|
547 |
+ inject_group['exist_map'])) |
|
548 | 548 |
|
549 | 549 |
REGEX = re.compile(r'\s+{0}\s*$'.format( |
550 |
- inject_map_command), re.M) |
|
550 |
+ inject_map_command), re.M) |
|
551 | 551 |
try: |
552 | 552 |
if REGEX.search(config): |
553 | 553 |
copy_attributes = True |
... | ... |
@@ -574,7 +574,7 @@ def get_custom_list_value(config, arg, module): |
574 | 574 |
|
575 | 575 |
elif arg == 'redistribute': |
576 | 576 |
RED_REGEX = re.compile(r'(?:{0}\s)(?P<value>.*)$'.format( |
577 |
- PARAM_TO_COMMAND_KEYMAP[arg]), re.M) |
|
577 |
+ PARAM_TO_COMMAND_KEYMAP[arg]), re.M) |
|
578 | 578 |
for line in splitted_config: |
579 | 579 |
value = [] |
580 | 580 |
redistribute_group = {} |
... | ... |
@@ -585,7 +585,7 @@ def get_custom_list_value(config, arg, module): |
585 | 585 |
value.pop(1) |
586 | 586 |
elif len(value) == 4: |
587 | 587 |
value = ['{0} {1}'.format( |
588 |
- value[0], value[1]), value[3]] |
|
588 |
+ value[0], value[1]), value[3]] |
|
589 | 589 |
value_list.append(value) |
590 | 590 |
return value_list |
591 | 591 |
|
... | ... |
@@ -611,7 +611,7 @@ def get_custom_string_value(config, arg, module): |
611 | 611 |
|
612 | 612 |
elif arg.startswith('dampening'): |
613 | 613 |
REGEX = re.compile(r'(?:{0}\s)(?P<value>.*)$'.format( |
614 |
- PARAM_TO_COMMAND_KEYMAP[arg]), re.M) |
|
614 |
+ PARAM_TO_COMMAND_KEYMAP[arg]), re.M) |
|
615 | 615 |
if arg == 'dampen_igp_metric' or arg == 'dampening_routemap': |
616 | 616 |
value = '' |
617 | 617 |
if PARAM_TO_COMMAND_KEYMAP[arg] in config: |
... | ... |
@@ -774,10 +774,10 @@ def default_existing(existing_value, key, value): |
774 | 774 |
for network in existing_value: |
775 | 775 |
if len(network) == 2: |
776 | 776 |
commands.append('no network {0} route-map {1}'.format( |
777 |
- network[0], network[1])) |
|
777 |
+ network[0], network[1])) |
|
778 | 778 |
elif len(network) == 1: |
779 | 779 |
commands.append('no network {0}'.format( |
780 |
- network[0])) |
|
780 |
+ network[0])) |
|
781 | 781 |
|
782 | 782 |
elif key == 'inject-map': |
783 | 783 |
for maps in existing_value: |
... | ... |
@@ -787,7 +787,7 @@ def default_existing(existing_value, key, value): |
787 | 787 |
elif len(maps) == 3: |
788 | 788 |
commands.append('no inject-map {0} exist-map {1} ' |
789 | 789 |
'copy-attributes'.format( |
790 |
- maps[0], maps[1])) |
|
790 |
+ maps[0], maps[1])) |
|
791 | 791 |
else: |
792 | 792 |
commands.append('no {0} {1}'.format(key, existing_value)) |
793 | 793 |
return commands |
... | ... |
@@ -818,7 +818,7 @@ def get_inject_map_command(existing, key, value): |
818 | 818 |
if maps not in existing_maps: |
819 | 819 |
if len(maps) == 2: |
820 | 820 |
command = ('inject-map {0} exist-map {1}'.format( |
821 |
- maps[0], maps[1])) |
|
821 |
+ maps[0], maps[1])) |
|
822 | 822 |
elif len(maps) == 3: |
823 | 823 |
command = ('inject-map {0} exist-map {1} ' |
824 | 824 |
'copy-attributes'.format(maps[0], |
... | ... |
@@ -835,7 +835,7 @@ def get_redistribute_command(existing, key, value): |
835 | 835 |
for each_rule in existing_rule: |
836 | 836 |
if rule[0] in each_rule: |
837 | 837 |
command = 'no {0} {1} route-map {2}'.format( |
838 |
- key, each_rule[0], each_rule[1]) |
|
838 |
+ key, each_rule[0], each_rule[1]) |
|
839 | 839 |
commands.append(command) |
840 | 840 |
else: |
841 | 841 |
command = '{0} {1} route-map {2}'.format(key, rule[0], rule[1]) |
... | ... |
@@ -877,7 +877,7 @@ def state_present(module, existing, proposed, candidate): |
877 | 877 |
for key, value in proposed_commands.items(): |
878 | 878 |
if key == 'address-family': |
879 | 879 |
addr_family_command = "address-family {0} {1}".format( |
880 |
- module.params['afi'], module.params['safi']) |
|
880 |
+ module.params['afi'], module.params['safi']) |
|
881 | 881 |
if addr_family_command not in commands: |
882 | 882 |
commands.append(addr_family_command) |
883 | 883 |
|
... | ... |
@@ -949,48 +949,48 @@ def state_absent(module, existing, proposed, candidate): |
949 | 949 |
parents.append('vrf {0}'.format(module.params['vrf'])) |
950 | 950 |
|
951 | 951 |
commands.append('no address-family {0} {1}'.format( |
952 |
- module.params['afi'], module.params['safi'])) |
|
952 |
+ module.params['afi'], module.params['safi'])) |
|
953 | 953 |
candidate.add(commands, parents=parents) |
954 | 954 |
|
955 | 955 |
|
956 | 956 |
def main(): |
957 | 957 |
argument_spec = dict( |
958 |
- asn=dict(required=True, type='str'), |
|
959 |
- vrf=dict(required=False, type='str', default='default'), |
|
960 |
- safi=dict(required=True, type='str', choices=['unicast','multicast', 'evpn']), |
|
961 |
- afi=dict(required=True, type='str', choices=['ipv4','ipv6', 'vpnv4', 'vpnv6', 'l2vpn']), |
|
962 |
- additional_paths_install=dict(required=False, type='bool'), |
|
963 |
- additional_paths_receive=dict(required=False, type='bool'), |
|
964 |
- additional_paths_selection=dict(required=False, type='str'), |
|
965 |
- additional_paths_send=dict(required=False, type='bool'), |
|
966 |
- advertise_l2vpn_evpn=dict(required=False, type='bool'), |
|
967 |
- client_to_client=dict(required=False, type='bool'), |
|
968 |
- dampen_igp_metric=dict(required=False, type='str'), |
|
969 |
- dampening_state=dict(required=False, type='bool'), |
|
970 |
- dampening_half_time=dict(required=False, type='str'), |
|
971 |
- dampening_max_suppress_time=dict(required=False, type='str'), |
|
972 |
- dampening_reuse_time=dict(required=False, type='str'), |
|
973 |
- dampening_routemap=dict(required=False, type='str'), |
|
974 |
- dampening_suppress_time=dict(required=False, type='str'), |
|
975 |
- default_information_originate=dict(required=False, type='bool'), |
|
976 |
- default_metric=dict(required=False, type='str'), |
|
977 |
- distance_ebgp=dict(required=False, type='str'), |
|
978 |
- distance_ibgp=dict(required=False, type='str'), |
|
979 |
- distance_local=dict(required=False, type='str'), |
|
980 |
- inject_map=dict(required=False, type='list'), |
|
981 |
- maximum_paths=dict(required=False, type='str'), |
|
982 |
- maximum_paths_ibgp=dict(required=False, type='str'), |
|
983 |
- networks=dict(required=False, type='list'), |
|
984 |
- next_hop_route_map=dict(required=False, type='str'), |
|
985 |
- redistribute=dict(required=False, type='list'), |
|
986 |
- suppress_inactive=dict(required=False, type='bool'), |
|
987 |
- table_map=dict(required=False, type='str'), |
|
988 |
- table_map_filter=dict(required=False, type='bool'), |
|
989 |
- state=dict(choices=['present', 'absent'], default='present', |
|
958 |
+ asn=dict(required=True, type='str'), |
|
959 |
+ vrf=dict(required=False, type='str', default='default'), |
|
960 |
+ safi=dict(required=True, type='str', choices=['unicast','multicast', 'evpn']), |
|
961 |
+ afi=dict(required=True, type='str', choices=['ipv4','ipv6', 'vpnv4', 'vpnv6', 'l2vpn']), |
|
962 |
+ additional_paths_install=dict(required=False, type='bool'), |
|
963 |
+ additional_paths_receive=dict(required=False, type='bool'), |
|
964 |
+ additional_paths_selection=dict(required=False, type='str'), |
|
965 |
+ additional_paths_send=dict(required=False, type='bool'), |
|
966 |
+ advertise_l2vpn_evpn=dict(required=False, type='bool'), |
|
967 |
+ client_to_client=dict(required=False, type='bool'), |
|
968 |
+ dampen_igp_metric=dict(required=False, type='str'), |
|
969 |
+ dampening_state=dict(required=False, type='bool'), |
|
970 |
+ dampening_half_time=dict(required=False, type='str'), |
|
971 |
+ dampening_max_suppress_time=dict(required=False, type='str'), |
|
972 |
+ dampening_reuse_time=dict(required=False, type='str'), |
|
973 |
+ dampening_routemap=dict(required=False, type='str'), |
|
974 |
+ dampening_suppress_time=dict(required=False, type='str'), |
|
975 |
+ default_information_originate=dict(required=False, type='bool'), |
|
976 |
+ default_metric=dict(required=False, type='str'), |
|
977 |
+ distance_ebgp=dict(required=False, type='str'), |
|
978 |
+ distance_ibgp=dict(required=False, type='str'), |
|
979 |
+ distance_local=dict(required=False, type='str'), |
|
980 |
+ inject_map=dict(required=False, type='list'), |
|
981 |
+ maximum_paths=dict(required=False, type='str'), |
|
982 |
+ maximum_paths_ibgp=dict(required=False, type='str'), |
|
983 |
+ networks=dict(required=False, type='list'), |
|
984 |
+ next_hop_route_map=dict(required=False, type='str'), |
|
985 |
+ redistribute=dict(required=False, type='list'), |
|
986 |
+ suppress_inactive=dict(required=False, type='bool'), |
|
987 |
+ table_map=dict(required=False, type='str'), |
|
988 |
+ table_map_filter=dict(required=False, type='bool'), |
|
989 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
990 | 990 |
required=False), |
991 |
- include_defaults=dict(default=True), |
|
992 |
- config=dict(), |
|
993 |
- save=dict(type='bool', default=False) |
|
991 |
+ include_defaults=dict(default=True), |
|
992 |
+ config=dict(), |
|
993 |
+ save=dict(type='bool', default=False) |
|
994 | 994 |
) |
995 | 995 |
module = get_network_module(argument_spec=argument_spec, |
996 | 996 |
required_together=[DAMPENING_PARAMS, |
... | ... |
@@ -1017,38 +1017,38 @@ def main(): |
1017 | 1017 |
' table_map_filter filter.') |
1018 | 1018 |
|
1019 | 1019 |
args = [ |
1020 |
- "additional_paths_install", |
|
1021 |
- "additional_paths_receive", |
|
1022 |
- "additional_paths_selection", |
|
1023 |
- "additional_paths_send", |
|
1024 |
- "advertise_l2vpn_evpn", |
|
1025 |
- "afi", |
|
1026 |
- "asn", |
|
1027 |
- "client_to_client", |
|
1028 |
- "dampen_igp_metric", |
|
1029 |
- "dampening_half_time", |
|
1030 |
- "dampening_max_suppress_time", |
|
1031 |
- "dampening_reuse_time", |
|
1032 |
- "dampening_suppress_time", |
|
1033 |
- "dampening_routemap", |
|
1034 |
- "dampening_state", |
|
1035 |
- "default_information_originate", |
|
1036 |
- "default_metric", |
|
1037 |
- "distance_ebgp", |
|
1038 |
- "distance_ibgp", |
|
1039 |
- "distance_local", |
|
1040 |
- "inject_map", |
|
1041 |
- "maximum_paths", |
|
1042 |
- "maximum_paths_ibgp", |
|
1043 |
- "networks", |
|
1044 |
- "next_hop_route_map", |
|
1045 |
- "redistribute", |
|
1046 |
- "safi", |
|
1047 |
- "suppress_inactive", |
|
1048 |
- "table_map", |
|
1049 |
- "table_map_filter", |
|
1050 |
- "vrf" |
|
1051 |
- ] |
|
1020 |
+ "additional_paths_install", |
|
1021 |
+ "additional_paths_receive", |
|
1022 |
+ "additional_paths_selection", |
|
1023 |
+ "additional_paths_send", |
|
1024 |
+ "advertise_l2vpn_evpn", |
|
1025 |
+ "afi", |
|
1026 |
+ "asn", |
|
1027 |
+ "client_to_client", |
|
1028 |
+ "dampen_igp_metric", |
|
1029 |
+ "dampening_half_time", |
|
1030 |
+ "dampening_max_suppress_time", |
|
1031 |
+ "dampening_reuse_time", |
|
1032 |
+ "dampening_suppress_time", |
|
1033 |
+ "dampening_routemap", |
|
1034 |
+ "dampening_state", |
|
1035 |
+ "default_information_originate", |
|
1036 |
+ "default_metric", |
|
1037 |
+ "distance_ebgp", |
|
1038 |
+ "distance_ibgp", |
|
1039 |
+ "distance_local", |
|
1040 |
+ "inject_map", |
|
1041 |
+ "maximum_paths", |
|
1042 |
+ "maximum_paths_ibgp", |
|
1043 |
+ "networks", |
|
1044 |
+ "next_hop_route_map", |
|
1045 |
+ "redistribute", |
|
1046 |
+ "safi", |
|
1047 |
+ "suppress_inactive", |
|
1048 |
+ "table_map", |
|
1049 |
+ "table_map_filter", |
|
1050 |
+ "vrf" |
|
1051 |
+ ] |
|
1052 | 1052 |
|
1053 | 1053 |
existing = invoke('get_existing', module, args) |
1054 | 1054 |
|
... | ... |
@@ -653,34 +653,34 @@ def state_absent(module, existing, proposed, candidate): |
653 | 653 |
|
654 | 654 |
def main(): |
655 | 655 |
argument_spec = dict( |
656 |
- asn=dict(required=True, type='str'), |
|
657 |
- vrf=dict(required=False, type='str', default='default'), |
|
658 |
- neighbor=dict(required=True, type='str'), |
|
659 |
- description=dict(required=False, type='str'), |
|
660 |
- capability_negotiation=dict(required=False, type='bool'), |
|
661 |
- connected_check=dict(required=False, type='bool'), |
|
662 |
- dynamic_capability=dict(required=False, type='bool'), |
|
663 |
- ebgp_multihop=dict(required=False, type='str'), |
|
664 |
- local_as=dict(required=False, type='str'), |
|
665 |
- log_neighbor_changes=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), |
|
666 |
- low_memory_exempt=dict(required=False, type='bool'), |
|
667 |
- maximum_peers=dict(required=False, type='str'), |
|
668 |
- pwd=dict(required=False, type='str'), |
|
669 |
- pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']), |
|
670 |
- remote_as=dict(required=False, type='str'), |
|
671 |
- remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']), |
|
672 |
- shutdown=dict(required=False, type='str'), |
|
673 |
- suppress_4_byte_as=dict(required=False, type='bool'), |
|
674 |
- timers_keepalive=dict(required=False, type='str'), |
|
675 |
- timers_holdtime=dict(required=False, type='str'), |
|
676 |
- transport_passive_only=dict(required=False, type='bool'), |
|
677 |
- update_source=dict(required=False, type='str'), |
|
678 |
- m_facts=dict(required=False, default=False, type='bool'), |
|
679 |
- state=dict(choices=['present', 'absent'], default='present', |
|
656 |
+ asn=dict(required=True, type='str'), |
|
657 |
+ vrf=dict(required=False, type='str', default='default'), |
|
658 |
+ neighbor=dict(required=True, type='str'), |
|
659 |
+ description=dict(required=False, type='str'), |
|
660 |
+ capability_negotiation=dict(required=False, type='bool'), |
|
661 |
+ connected_check=dict(required=False, type='bool'), |
|
662 |
+ dynamic_capability=dict(required=False, type='bool'), |
|
663 |
+ ebgp_multihop=dict(required=False, type='str'), |
|
664 |
+ local_as=dict(required=False, type='str'), |
|
665 |
+ log_neighbor_changes=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), |
|
666 |
+ low_memory_exempt=dict(required=False, type='bool'), |
|
667 |
+ maximum_peers=dict(required=False, type='str'), |
|
668 |
+ pwd=dict(required=False, type='str'), |
|
669 |
+ pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']), |
|
670 |
+ remote_as=dict(required=False, type='str'), |
|
671 |
+ remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']), |
|
672 |
+ shutdown=dict(required=False, type='str'), |
|
673 |
+ suppress_4_byte_as=dict(required=False, type='bool'), |
|
674 |
+ timers_keepalive=dict(required=False, type='str'), |
|
675 |
+ timers_holdtime=dict(required=False, type='str'), |
|
676 |
+ transport_passive_only=dict(required=False, type='bool'), |
|
677 |
+ update_source=dict(required=False, type='str'), |
|
678 |
+ m_facts=dict(required=False, default=False, type='bool'), |
|
679 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
680 | 680 |
required=False), |
681 |
- include_defaults=dict(default=True), |
|
682 |
- config=dict(), |
|
683 |
- save=dict(type='bool', default=False) |
|
681 |
+ include_defaults=dict(default=True), |
|
682 |
+ config=dict(), |
|
683 |
+ save=dict(type='bool', default=False) |
|
684 | 684 |
) |
685 | 685 |
module = get_network_module(argument_spec=argument_spec, |
686 | 686 |
required_together=[['timer_bgp_hold', |
... | ... |
@@ -692,29 +692,29 @@ def main(): |
692 | 692 |
module.params['pwd_type'] = '0' |
693 | 693 |
|
694 | 694 |
args = [ |
695 |
- 'asn', |
|
696 |
- 'capability_negotiation', |
|
697 |
- 'connected_check', |
|
698 |
- 'description', |
|
699 |
- 'dynamic_capability', |
|
700 |
- 'ebgp_multihop', |
|
701 |
- 'local_as', |
|
702 |
- 'log_neighbor_changes', |
|
703 |
- 'low_memory_exempt', |
|
704 |
- 'maximum_peers', |
|
705 |
- 'neighbor', |
|
706 |
- 'pwd', |
|
707 |
- 'pwd_type', |
|
708 |
- 'remote_as', |
|
709 |
- 'remove_private_as', |
|
710 |
- 'shutdown', |
|
711 |
- 'suppress_4_byte_as', |
|
712 |
- 'timers_keepalive', |
|
713 |
- 'timers_holdtime', |
|
714 |
- 'transport_passive_only', |
|
715 |
- 'update_source', |
|
716 |
- 'vrf' |
|
717 |
- ] |
|
695 |
+ 'asn', |
|
696 |
+ 'capability_negotiation', |
|
697 |
+ 'connected_check', |
|
698 |
+ 'description', |
|
699 |
+ 'dynamic_capability', |
|
700 |
+ 'ebgp_multihop', |
|
701 |
+ 'local_as', |
|
702 |
+ 'log_neighbor_changes', |
|
703 |
+ 'low_memory_exempt', |
|
704 |
+ 'maximum_peers', |
|
705 |
+ 'neighbor', |
|
706 |
+ 'pwd', |
|
707 |
+ 'pwd_type', |
|
708 |
+ 'remote_as', |
|
709 |
+ 'remove_private_as', |
|
710 |
+ 'shutdown', |
|
711 |
+ 'suppress_4_byte_as', |
|
712 |
+ 'timers_keepalive', |
|
713 |
+ 'timers_holdtime', |
|
714 |
+ 'transport_passive_only', |
|
715 |
+ 'update_source', |
|
716 |
+ 'vrf' |
|
717 |
+ ] |
|
718 | 718 |
|
719 | 719 |
existing = invoke('get_existing', module, args) |
720 | 720 |
if existing.get('asn'): |
... | ... |
@@ -684,7 +684,7 @@ def get_existing(module, args): |
684 | 684 |
|
685 | 685 |
parents.append('neighbor {0}'.format(module.params['neighbor'])) |
686 | 686 |
parents.append('address-family {0} {1}'.format( |
687 |
- module.params['afi'], module.params['safi'])) |
|
687 |
+ module.params['afi'], module.params['safi'])) |
|
688 | 688 |
config = netcfg.get_section(parents) |
689 | 689 |
|
690 | 690 |
if config: |
... | ... |
@@ -722,7 +722,7 @@ def apply_key_map(key_map, table): |
722 | 722 |
|
723 | 723 |
def get_address_family_command(key, value, module): |
724 | 724 |
command = "address-family {0} {1}".format( |
725 |
- module.params['afi'], module.params['safi']) |
|
725 |
+ module.params['afi'], module.params['safi']) |
|
726 | 726 |
return command |
727 | 727 |
|
728 | 728 |
|
... | ... |
@@ -746,13 +746,13 @@ def get_capability_additional_paths_send_command(key, value, module): |
746 | 746 |
|
747 | 747 |
def get_advertise_map_exist_command(key, value, module): |
748 | 748 |
command = 'advertise-map {0} exist-map {1}'.format( |
749 |
- value[0], value[1]) |
|
749 |
+ value[0], value[1]) |
|
750 | 750 |
return command |
751 | 751 |
|
752 | 752 |
|
753 | 753 |
def get_advertise_map_non_exist_command(key, value, module): |
754 | 754 |
command = 'advertise-map {0} non-exist-map {1}'.format( |
755 |
- value[0], value[1]) |
|
755 |
+ value[0], value[1]) |
|
756 | 756 |
return command |
757 | 757 |
|
758 | 758 |
|
... | ... |
@@ -846,7 +846,7 @@ def get_default_command(key, value, existing_commands): |
846 | 846 |
command = 'no route-map {0} out'.format(existing_value) |
847 | 847 |
elif key.startswith('maximum-prefix'): |
848 | 848 |
command = 'no maximum-prefix {0}'.format( |
849 |
- existing_commands.get('maximum-prefix')) |
|
849 |
+ existing_commands.get('maximum-prefix')) |
|
850 | 850 |
elif key == 'allowas-in max': |
851 | 851 |
command = ['no allowas-in {0}'.format(existing_value)] |
852 | 852 |
command.append('allowas-in') |
... | ... |
@@ -936,11 +936,11 @@ def state_present(module, existing, proposed, candidate): |
936 | 936 |
candidate.add(commands, parents=parents) |
937 | 937 |
elif len(commands) > 1: |
938 | 938 |
af_command = 'address-family {0} {1}'.format( |
939 |
- module.params['afi'], module.params['safi']) |
|
939 |
+ module.params['afi'], module.params['safi']) |
|
940 | 940 |
if af_command in commands: |
941 | 941 |
commands.remove(af_command) |
942 | 942 |
parents.append('address-family {0} {1}'.format( |
943 |
- module.params['afi'], module.params['safi'])) |
|
943 |
+ module.params['afi'], module.params['safi'])) |
|
944 | 944 |
candidate.add(commands, parents=parents) |
945 | 945 |
|
946 | 946 |
|
... | ... |
@@ -952,57 +952,57 @@ def state_absent(module, existing, proposed, candidate): |
952 | 952 |
|
953 | 953 |
parents.append('neighbor {0}'.format(module.params['neighbor'])) |
954 | 954 |
commands.append('no address-family {0} {1}'.format( |
955 |
- module.params['afi'], module.params['safi'])) |
|
955 |
+ module.params['afi'], module.params['safi'])) |
|
956 | 956 |
candidate.add(commands, parents=parents) |
957 | 957 |
|
958 | 958 |
|
959 | 959 |
def main(): |
960 | 960 |
argument_spec = dict( |
961 |
- asn=dict(required=True, type='str'), |
|
962 |
- vrf=dict(required=False, type='str', default='default'), |
|
963 |
- neighbor=dict(required=True, type='str'), |
|
964 |
- afi=dict(required=True, type='str'), |
|
965 |
- safi=dict(required=True, type='str'), |
|
966 |
- additional_paths_receive=dict(required=False, type='str', |
|
961 |
+ asn=dict(required=True, type='str'), |
|
962 |
+ vrf=dict(required=False, type='str', default='default'), |
|
963 |
+ neighbor=dict(required=True, type='str'), |
|
964 |
+ afi=dict(required=True, type='str'), |
|
965 |
+ safi=dict(required=True, type='str'), |
|
966 |
+ additional_paths_receive=dict(required=False, type='str', |
|
967 | 967 |
choices=['enable', 'disable', 'inherit']), |
968 |
- additional_paths_send=dict(required=False, type='str', |
|
968 |
+ additional_paths_send=dict(required=False, type='str', |
|
969 | 969 |
choices=['enable', 'disable', 'inherit']), |
970 |
- advertise_map_exist=dict(required=False, type='list'), |
|
971 |
- advertise_map_non_exist=dict(required=False, type='list'), |
|
972 |
- allowas_in=dict(required=False, type='bool'), |
|
973 |
- allowas_in_max=dict(required=False, type='str'), |
|
974 |
- as_override=dict(required=False, type='bool'), |
|
975 |
- default_originate=dict(required=False, type='bool'), |
|
976 |
- default_originate_route_map=dict(required=False, type='str'), |
|
977 |
- filter_list_in=dict(required=False, type='str'), |
|
978 |
- filter_list_out=dict(required=False, type='str'), |
|
979 |
- max_prefix_limit=dict(required=False, type='str'), |
|
980 |
- max_prefix_interval=dict(required=False, type='str'), |
|
981 |
- max_prefix_threshold=dict(required=False, type='str'), |
|
982 |
- max_prefix_warning=dict(required=False, type='bool'), |
|
983 |
- next_hop_self=dict(required=False, type='bool'), |
|
984 |
- next_hop_third_party=dict(required=False, type='bool'), |
|
985 |
- prefix_list_in=dict(required=False, type='str'), |
|
986 |
- prefix_list_out=dict(required=False, type='str'), |
|
987 |
- route_map_in=dict(required=False, type='str'), |
|
988 |
- route_map_out=dict(required=False, type='str'), |
|
989 |
- route_reflector_client=dict(required=False, type='bool'), |
|
990 |
- send_community=dict(required=False, choices=['none', |
|
970 |
+ advertise_map_exist=dict(required=False, type='list'), |
|
971 |
+ advertise_map_non_exist=dict(required=False, type='list'), |
|
972 |
+ allowas_in=dict(required=False, type='bool'), |
|
973 |
+ allowas_in_max=dict(required=False, type='str'), |
|
974 |
+ as_override=dict(required=False, type='bool'), |
|
975 |
+ default_originate=dict(required=False, type='bool'), |
|
976 |
+ default_originate_route_map=dict(required=False, type='str'), |
|
977 |
+ filter_list_in=dict(required=False, type='str'), |
|
978 |
+ filter_list_out=dict(required=False, type='str'), |
|
979 |
+ max_prefix_limit=dict(required=False, type='str'), |
|
980 |
+ max_prefix_interval=dict(required=False, type='str'), |
|
981 |
+ max_prefix_threshold=dict(required=False, type='str'), |
|
982 |
+ max_prefix_warning=dict(required=False, type='bool'), |
|
983 |
+ next_hop_self=dict(required=False, type='bool'), |
|
984 |
+ next_hop_third_party=dict(required=False, type='bool'), |
|
985 |
+ prefix_list_in=dict(required=False, type='str'), |
|
986 |
+ prefix_list_out=dict(required=False, type='str'), |
|
987 |
+ route_map_in=dict(required=False, type='str'), |
|
988 |
+ route_map_out=dict(required=False, type='str'), |
|
989 |
+ route_reflector_client=dict(required=False, type='bool'), |
|
990 |
+ send_community=dict(required=False, choices=['none', |
|
991 | 991 |
'both', |
992 | 992 |
'extended', |
993 | 993 |
'standard', |
994 | 994 |
'default']), |
995 |
- soft_reconfiguration_in=dict(required=False, type='str', |
|
995 |
+ soft_reconfiguration_in=dict(required=False, type='str', |
|
996 | 996 |
choices=['enable', 'always', 'inherit']), |
997 |
- soo=dict(required=False, type='str'), |
|
998 |
- suppress_inactive=dict(required=False, type='bool'), |
|
999 |
- unsuppress_map=dict(required=False, type='str'), |
|
1000 |
- weight=dict(required=False, type='str'), |
|
1001 |
- state=dict(choices=['present', 'absent'], default='present', |
|
997 |
+ soo=dict(required=False, type='str'), |
|
998 |
+ suppress_inactive=dict(required=False, type='bool'), |
|
999 |
+ unsuppress_map=dict(required=False, type='str'), |
|
1000 |
+ weight=dict(required=False, type='str'), |
|
1001 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
1002 | 1002 |
required=False), |
1003 |
- include_defaults=dict(default=True), |
|
1004 |
- config=dict(), |
|
1005 |
- save=dict(type='bool', default=False) |
|
1003 |
+ include_defaults=dict(default=True), |
|
1004 |
+ config=dict(), |
|
1005 |
+ save=dict(type='bool', default=False) |
|
1006 | 1006 |
) |
1007 | 1007 |
module = get_network_module(argument_spec=argument_spec, |
1008 | 1008 |
mutually_exclusive=[['advertise_map_exist', |
... | ... |
@@ -1021,40 +1021,40 @@ def main(): |
1021 | 1021 |
module.fail_json(msg='SOO is only allowed in non-default VRF') |
1022 | 1022 |
|
1023 | 1023 |
args = [ |
1024 |
- 'afi', |
|
1025 |
- 'asn', |
|
1026 |
- 'neighbor', |
|
1027 |
- 'additional_paths_receive', |
|
1028 |
- 'additional_paths_send', |
|
1029 |
- 'advertise_map_exist', |
|
1030 |
- 'advertise_map_non_exist', |
|
1031 |
- 'allowas_in', |
|
1032 |
- 'allowas_in_max', |
|
1033 |
- 'as_override', |
|
1034 |
- 'default_originate', |
|
1035 |
- 'default_originate_route_map', |
|
1036 |
- 'filter_list_in', |
|
1037 |
- 'filter_list_out', |
|
1038 |
- 'max_prefix_limit', |
|
1039 |
- 'max_prefix_interval', |
|
1040 |
- 'max_prefix_threshold', |
|
1041 |
- 'max_prefix_warning', |
|
1042 |
- 'next_hop_self', |
|
1043 |
- 'next_hop_third_party', |
|
1044 |
- 'prefix_list_in', |
|
1045 |
- 'prefix_list_out', |
|
1046 |
- 'route_map_in', |
|
1047 |
- 'route_map_out', |
|
1048 |
- 'soft_reconfiguration_in', |
|
1049 |
- 'soo', |
|
1050 |
- 'suppress_inactive', |
|
1051 |
- 'unsuppress_map', |
|
1052 |
- 'weight', |
|
1053 |
- 'route_reflector_client', |
|
1054 |
- 'safi', |
|
1055 |
- 'send_community', |
|
1056 |
- 'vrf' |
|
1057 |
- ] |
|
1024 |
+ 'afi', |
|
1025 |
+ 'asn', |
|
1026 |
+ 'neighbor', |
|
1027 |
+ 'additional_paths_receive', |
|
1028 |
+ 'additional_paths_send', |
|
1029 |
+ 'advertise_map_exist', |
|
1030 |
+ 'advertise_map_non_exist', |
|
1031 |
+ 'allowas_in', |
|
1032 |
+ 'allowas_in_max', |
|
1033 |
+ 'as_override', |
|
1034 |
+ 'default_originate', |
|
1035 |
+ 'default_originate_route_map', |
|
1036 |
+ 'filter_list_in', |
|
1037 |
+ 'filter_list_out', |
|
1038 |
+ 'max_prefix_limit', |
|
1039 |
+ 'max_prefix_interval', |
|
1040 |
+ 'max_prefix_threshold', |
|
1041 |
+ 'max_prefix_warning', |
|
1042 |
+ 'next_hop_self', |
|
1043 |
+ 'next_hop_third_party', |
|
1044 |
+ 'prefix_list_in', |
|
1045 |
+ 'prefix_list_out', |
|
1046 |
+ 'route_map_in', |
|
1047 |
+ 'route_map_out', |
|
1048 |
+ 'soft_reconfiguration_in', |
|
1049 |
+ 'soo', |
|
1050 |
+ 'suppress_inactive', |
|
1051 |
+ 'unsuppress_map', |
|
1052 |
+ 'weight', |
|
1053 |
+ 'route_reflector_client', |
|
1054 |
+ 'safi', |
|
1055 |
+ 'send_community', |
|
1056 |
+ 'vrf' |
|
1057 |
+ ] |
|
1058 | 1058 |
|
1059 | 1059 |
existing = invoke('get_existing', module, args) |
1060 | 1060 |
if existing.get('asn'): |
... | ... |
@@ -281,10 +281,10 @@ def get_commands(module, existing, proposed, candidate): |
281 | 281 |
|
282 | 282 |
def main(): |
283 | 283 |
argument_spec = dict( |
284 |
- nv_overlay_evpn=dict(required=True, type='bool'), |
|
285 |
- include_defaults=dict(default=True), |
|
286 |
- config=dict(), |
|
287 |
- save=dict(type='bool', default=False) |
|
284 |
+ nv_overlay_evpn=dict(required=True, type='bool'), |
|
285 |
+ include_defaults=dict(default=True), |
|
286 |
+ config=dict(), |
|
287 |
+ save=dict(type='bool', default=False) |
|
288 | 288 |
) |
289 | 289 |
module = get_network_module(argument_spec=argument_spec, |
290 | 290 |
supports_check_mode=True) |
... | ... |
@@ -409,28 +409,28 @@ def execute_config(module, candidate): |
409 | 409 |
|
410 | 410 |
def main(): |
411 | 411 |
argument_spec = dict( |
412 |
- vni=dict(required=True, type='str'), |
|
413 |
- route_distinguisher=dict(required=False, type='str'), |
|
414 |
- route_target_both=dict(required=False, type='list'), |
|
415 |
- route_target_import=dict(required=False, type='list'), |
|
416 |
- route_target_export=dict(required=False, type='list'), |
|
417 |
- state=dict(choices=['present', 'absent'], default='present', |
|
412 |
+ vni=dict(required=True, type='str'), |
|
413 |
+ route_distinguisher=dict(required=False, type='str'), |
|
414 |
+ route_target_both=dict(required=False, type='list'), |
|
415 |
+ route_target_import=dict(required=False, type='list'), |
|
416 |
+ route_target_export=dict(required=False, type='list'), |
|
417 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
418 | 418 |
required=False), |
419 |
- include_defaults=dict(default=True), |
|
420 |
- config=dict(), |
|
421 |
- save=dict(type='bool', default=False) |
|
419 |
+ include_defaults=dict(default=True), |
|
420 |
+ config=dict(), |
|
421 |
+ save=dict(type='bool', default=False) |
|
422 | 422 |
) |
423 | 423 |
module = get_network_module(argument_spec=argument_spec, |
424 | 424 |
supports_check_mode=True) |
425 | 425 |
|
426 | 426 |
state = module.params['state'] |
427 | 427 |
args = [ |
428 |
- 'vni', |
|
429 |
- 'route_distinguisher', |
|
430 |
- 'route_target_both', |
|
431 |
- 'route_target_import', |
|
432 |
- 'route_target_export' |
|
433 |
- ] |
|
428 |
+ 'vni', |
|
429 |
+ 'route_distinguisher', |
|
430 |
+ 'route_target_both', |
|
431 |
+ 'route_target_import', |
|
432 |
+ 'route_target_export' |
|
433 |
+ ] |
|
434 | 434 |
|
435 | 435 |
existing = invoke('get_existing', module, args) |
436 | 436 |
end_state = existing |
... | ... |
@@ -461,9 +461,9 @@ def main(): |
461 | 461 |
'It is highly recommended to use a task ' |
462 | 462 |
'(with default as value) to explicitly ' |
463 | 463 |
'unconfigure it.'.format( |
464 |
- existing['route_distinguisher'])) |
|
464 |
+ existing['route_distinguisher'])) |
|
465 | 465 |
remove_commands = ['no rd {0}'.format( |
466 |
- existing['route_distinguisher'])] |
|
466 |
+ existing['route_distinguisher'])] |
|
467 | 467 |
|
468 | 468 |
candidate.add(remove_commands, parents=parents) |
469 | 469 |
result = execute_config(module, candidate) |
... | ... |
@@ -405,36 +405,36 @@ def validate_feature(module, mode='show'): |
405 | 405 |
|
406 | 406 |
feature_to_be_mapped = { |
407 | 407 |
'show': { |
408 |
- 'nv overlay': 'nve', |
|
409 |
- 'vn-segment-vlan-based': 'vnseg_vlan', |
|
410 |
- 'hsrp': 'hsrp_engine', |
|
411 |
- 'fabric multicast': 'fabric_mcast', |
|
412 |
- 'scp-server': 'scpServer', |
|
413 |
- 'sftp-server': 'sftpServer', |
|
414 |
- 'sla responder': 'sla_responder', |
|
415 |
- 'sla sender': 'sla_sender', |
|
416 |
- 'ssh': 'sshServer', |
|
417 |
- 'tacacs+': 'tacacs', |
|
418 |
- 'telnet': 'telnetServer', |
|
419 |
- 'ethernet-link-oam': 'elo', |
|
420 |
- 'port-security': 'eth_port_sec' |
|
421 |
- }, |
|
408 |
+ 'nv overlay': 'nve', |
|
409 |
+ 'vn-segment-vlan-based': 'vnseg_vlan', |
|
410 |
+ 'hsrp': 'hsrp_engine', |
|
411 |
+ 'fabric multicast': 'fabric_mcast', |
|
412 |
+ 'scp-server': 'scpServer', |
|
413 |
+ 'sftp-server': 'sftpServer', |
|
414 |
+ 'sla responder': 'sla_responder', |
|
415 |
+ 'sla sender': 'sla_sender', |
|
416 |
+ 'ssh': 'sshServer', |
|
417 |
+ 'tacacs+': 'tacacs', |
|
418 |
+ 'telnet': 'telnetServer', |
|
419 |
+ 'ethernet-link-oam': 'elo', |
|
420 |
+ 'port-security': 'eth_port_sec' |
|
421 |
+ }, |
|
422 | 422 |
'config': { |
423 |
- 'nve': 'nv overlay', |
|
424 |
- 'vnseg_vlan': 'vn-segment-vlan-based', |
|
425 |
- 'hsrp_engine': 'hsrp', |
|
426 |
- 'fabric_mcast': 'fabric multicast', |
|
427 |
- 'scpServer': 'scp-server', |
|
428 |
- 'sftpServer': 'sftp-server', |
|
429 |
- 'sla_sender': 'sla sender', |
|
430 |
- 'sla_responder': 'sla responder', |
|
431 |
- 'sshServer': 'ssh', |
|
432 |
- 'tacacs': 'tacacs+', |
|
433 |
- 'telnetServer': 'telnet', |
|
434 |
- 'elo': 'ethernet-link-oam', |
|
435 |
- 'eth_port_sec': 'port-security' |
|
436 |
- } |
|
437 |
- } |
|
423 |
+ 'nve': 'nv overlay', |
|
424 |
+ 'vnseg_vlan': 'vn-segment-vlan-based', |
|
425 |
+ 'hsrp_engine': 'hsrp', |
|
426 |
+ 'fabric_mcast': 'fabric multicast', |
|
427 |
+ 'scpServer': 'scp-server', |
|
428 |
+ 'sftpServer': 'sftp-server', |
|
429 |
+ 'sla_sender': 'sla sender', |
|
430 |
+ 'sla_responder': 'sla responder', |
|
431 |
+ 'sshServer': 'ssh', |
|
432 |
+ 'tacacs': 'tacacs+', |
|
433 |
+ 'telnetServer': 'telnet', |
|
434 |
+ 'elo': 'ethernet-link-oam', |
|
435 |
+ 'eth_port_sec': 'port-security' |
|
436 |
+ } |
|
437 |
+ } |
|
438 | 438 |
|
439 | 439 |
if feature in feature_to_be_mapped[mode]: |
440 | 440 |
feature = feature_to_be_mapped[mode][feature] |
... | ... |
@@ -444,12 +444,12 @@ def validate_feature(module, mode='show'): |
444 | 444 |
|
445 | 445 |
def main(): |
446 | 446 |
argument_spec = dict( |
447 |
- feature=dict(type='str', required=True), |
|
448 |
- state=dict(choices=['enabled', 'disabled'], default='enabled', |
|
447 |
+ feature=dict(type='str', required=True), |
|
448 |
+ state=dict(choices=['enabled', 'disabled'], default='enabled', |
|
449 | 449 |
required=False), |
450 |
- include_defaults=dict(default=False), |
|
451 |
- config=dict(), |
|
452 |
- save=dict(type='bool', default=False) |
|
450 |
+ include_defaults=dict(default=False), |
|
451 |
+ config=dict(), |
|
452 |
+ save=dict(type='bool', default=False) |
|
453 | 453 |
) |
454 | 454 |
module = get_network_module(argument_spec=argument_spec, |
455 | 455 |
supports_check_mode=True) |
... | ... |
@@ -351,7 +351,7 @@ def transfer_file(module, dest): |
351 | 351 |
except: |
352 | 352 |
time.sleep(10) |
353 | 353 |
temp_size = verify_remote_file_exists( |
354 |
- module, dest, file_system=module.params['file_system']) |
|
354 |
+ module, dest, file_system=module.params['file_system']) |
|
355 | 355 |
if int(temp_size) == int(file_size): |
356 | 356 |
pass |
357 | 357 |
else: |
... | ... |
@@ -365,12 +365,12 @@ def transfer_file(module, dest): |
365 | 365 |
|
366 | 366 |
def main(): |
367 | 367 |
argument_spec = dict( |
368 |
- local_file=dict(required=True), |
|
369 |
- remote_file=dict(required=False), |
|
370 |
- file_system=dict(required=False, default='bootflash:'), |
|
371 |
- include_defaults=dict(default=True), |
|
372 |
- config=dict(), |
|
373 |
- save=dict(type='bool', default=False) |
|
368 |
+ local_file=dict(required=True), |
|
369 |
+ remote_file=dict(required=False), |
|
370 |
+ file_system=dict(required=False, default='bootflash:'), |
|
371 |
+ include_defaults=dict(default=True), |
|
372 |
+ config=dict(), |
|
373 |
+ save=dict(type='bool', default=False) |
|
374 | 374 |
) |
375 | 375 |
module = get_network_module(argument_spec=argument_spec, |
376 | 376 |
supports_check_mode=True) |
... | ... |
@@ -408,7 +408,7 @@ def get_commands(module, state, mode): |
408 | 408 |
commands.append('no system mode maintenance') |
409 | 409 |
|
410 | 410 |
elif (module.params[ |
411 |
- 'system_mode_maintenance_dont_generate_profile'] is True and |
|
411 |
+ 'system_mode_maintenance_dont_generate_profile'] is True and |
|
412 | 412 |
mode == 'normal'): |
413 | 413 |
commands.append('system mode maintenance dont-generate-profile') |
414 | 414 |
elif (module.params[ |
... | ... |
@@ -434,20 +434,20 @@ def get_commands(module, state, mode): |
434 | 434 |
reset_reasons = get_reset_reasons(module) |
435 | 435 |
if (state == 'present' and |
436 | 436 |
module.params[ |
437 |
- 'system_mode_maintenance_on_reload_reset_reason'].lower() not |
|
437 |
+ 'system_mode_maintenance_on_reload_reset_reason'].lower() not |
|
438 | 438 |
in reset_reasons.lower()): |
439 | 439 |
commands.append('system mode maintenance on-reload ' |
440 | 440 |
'reset-reason {0}'.format( |
441 |
- module.params[ |
|
442 |
- 'system_mode_maintenance_on_reload_reset_reason'])) |
|
441 |
+ module.params[ |
|
442 |
+ 'system_mode_maintenance_on_reload_reset_reason'])) |
|
443 | 443 |
elif (state == 'absent' and |
444 | 444 |
module.params[ |
445 |
- 'system_mode_maintenance_on_reload_reset_reason'].lower() in |
|
445 |
+ 'system_mode_maintenance_on_reload_reset_reason'].lower() in |
|
446 | 446 |
reset_reasons.lower()): |
447 | 447 |
commands.append('no system mode maintenance on-reload ' |
448 | 448 |
'reset-reason {0}'.format( |
449 |
- module.params[ |
|
450 |
- 'system_mode_maintenance_on_reload_reset_reason'])) |
|
449 |
+ module.params[ |
|
450 |
+ 'system_mode_maintenance_on_reload_reset_reason'])) |
|
451 | 451 |
|
452 | 452 |
if commands: |
453 | 453 |
commands.insert(0, 'terminal dont-ask') |
... | ... |
@@ -456,32 +456,32 @@ def get_commands(module, state, mode): |
456 | 456 |
|
457 | 457 |
def main(): |
458 | 458 |
argument_spec = dict( |
459 |
- system_mode_maintenance=dict(required=False, type='bool'), |
|
460 |
- system_mode_maintenance_dont_generate_profile=dict(required=False, |
|
459 |
+ system_mode_maintenance=dict(required=False, type='bool'), |
|
460 |
+ system_mode_maintenance_dont_generate_profile=dict(required=False, |
|
461 | 461 |
type='bool'), |
462 |
- system_mode_maintenance_timeout=dict(required=False, type='str'), |
|
463 |
- system_mode_maintenance_shutdown=dict(required=False, type='bool'), |
|
464 |
- system_mode_maintenance_on_reload_reset_reason=dict(required=False, |
|
462 |
+ system_mode_maintenance_timeout=dict(required=False, type='str'), |
|
463 |
+ system_mode_maintenance_shutdown=dict(required=False, type='bool'), |
|
464 |
+ system_mode_maintenance_on_reload_reset_reason=dict(required=False, |
|
465 | 465 |
choices=['hw_error','svc_failure','kern_failure', |
466 | 466 |
'wdog_timeout','fatal_error','lc_failure', |
467 | 467 |
'match_any','manual_reload']), |
468 |
- state=dict(choices=['absent', 'present', 'default'], |
|
468 |
+ state=dict(choices=['absent', 'present', 'default'], |
|
469 | 469 |
default='present', required=False) |
470 | 470 |
) |
471 | 471 |
module = get_network_module(argument_spec=argument_spec, |
472 | 472 |
mutually_exclusive=[[ |
473 |
- 'system_mode_maintenance', |
|
474 |
- 'system_mode_maintenance_dont_generate_profile', |
|
475 |
- 'system_mode_maintenance_timeout', |
|
476 |
- 'system_mode_maintenance_shutdown', |
|
477 |
- 'system_mode_maintenance_on_reload_reset_reason' |
|
473 |
+ 'system_mode_maintenance', |
|
474 |
+ 'system_mode_maintenance_dont_generate_profile', |
|
475 |
+ 'system_mode_maintenance_timeout', |
|
476 |
+ 'system_mode_maintenance_shutdown', |
|
477 |
+ 'system_mode_maintenance_on_reload_reset_reason' |
|
478 | 478 |
]], |
479 | 479 |
required_one_of=[[ |
480 |
- 'system_mode_maintenance', |
|
481 |
- 'system_mode_maintenance_dont_generate_profile', |
|
482 |
- 'system_mode_maintenance_timeout', |
|
483 |
- 'system_mode_maintenance_shutdown', |
|
484 |
- 'system_mode_maintenance_on_reload_reset_reason' |
|
480 |
+ 'system_mode_maintenance', |
|
481 |
+ 'system_mode_maintenance_dont_generate_profile', |
|
482 |
+ 'system_mode_maintenance_timeout', |
|
483 |
+ 'system_mode_maintenance_shutdown', |
|
484 |
+ 'system_mode_maintenance_on_reload_reset_reason' |
|
485 | 485 |
]], |
486 | 486 |
supports_check_mode=True) |
487 | 487 |
|
... | ... |
@@ -335,12 +335,12 @@ def execute_config_command(commands, module): |
335 | 335 |
|
336 | 336 |
def main(): |
337 | 337 |
argument_spec = dict( |
338 |
- commands=dict(required=False, type='list'), |
|
339 |
- mode=dict(required=True, choices=['maintenance', 'normal']), |
|
340 |
- state=dict(choices=['absent', 'present'], |
|
338 |
+ commands=dict(required=False, type='list'), |
|
339 |
+ mode=dict(required=True, choices=['maintenance', 'normal']), |
|
340 |
+ state=dict(choices=['absent', 'present'], |
|
341 | 341 |
default='present'), |
342 |
- include_defaults=dict(default=False), |
|
343 |
- config=dict() |
|
342 |
+ include_defaults=dict(default=False), |
|
343 |
+ config=dict() |
|
344 | 344 |
) |
345 | 345 |
module = get_network_module(argument_spec=argument_spec, |
346 | 346 |
supports_check_mode=True) |
... | ... |
@@ -604,20 +604,20 @@ def validate_params(param, module): |
604 | 604 |
|
605 | 605 |
def main(): |
606 | 606 |
argument_spec = dict( |
607 |
- group=dict(required=True, type='str'), |
|
608 |
- interface=dict(required=True), |
|
609 |
- version=dict(choices=['1', '2'], default='2', required=False), |
|
610 |
- priority=dict(type='str', required=False), |
|
611 |
- preempt=dict(type='str', choices=['disabled', 'enabled'], |
|
607 |
+ group=dict(required=True, type='str'), |
|
608 |
+ interface=dict(required=True), |
|
609 |
+ version=dict(choices=['1', '2'], default='2', required=False), |
|
610 |
+ priority=dict(type='str', required=False), |
|
611 |
+ preempt=dict(type='str', choices=['disabled', 'enabled'], |
|
612 | 612 |
required=False), |
613 |
- vip=dict(type='str', required=False), |
|
614 |
- auth_type=dict(choices=['text', 'md5'], required=False), |
|
615 |
- auth_string=dict(type='str', required=False), |
|
616 |
- state=dict(choices=['absent', 'present'], required=False, |
|
613 |
+ vip=dict(type='str', required=False), |
|
614 |
+ auth_type=dict(choices=['text', 'md5'], required=False), |
|
615 |
+ auth_string=dict(type='str', required=False), |
|
616 |
+ state=dict(choices=['absent', 'present'], required=False, |
|
617 | 617 |
default='present'), |
618 |
- include_defaults=dict(default=True), |
|
619 |
- config=dict(), |
|
620 |
- save=dict(type='bool', default=False) |
|
618 |
+ include_defaults=dict(default=True), |
|
619 |
+ config=dict(), |
|
620 |
+ save=dict(type='bool', default=False) |
|
621 | 621 |
) |
622 | 622 |
module = get_network_module(argument_spec=argument_spec, |
623 | 623 |
supports_check_mode=True) |
... | ... |
@@ -685,7 +685,7 @@ def main(): |
685 | 685 |
commands = [] |
686 | 686 |
if state == 'present': |
687 | 687 |
delta = dict( |
688 |
- set(proposed.items()).difference(existing.items())) |
|
688 |
+ set(proposed.items()).difference(existing.items())) |
|
689 | 689 |
if delta: |
690 | 690 |
command = get_commands_config_hsrp(delta, interface, args) |
691 | 691 |
commands.extend(command) |
... | ... |
@@ -335,13 +335,13 @@ def apply_key_map(key_map, table): |
335 | 335 |
|
336 | 336 |
def main(): |
337 | 337 |
argument_spec = dict( |
338 |
- flush_routes=dict(type='bool'), |
|
339 |
- enforce_rtr_alert=dict(type='bool'), |
|
340 |
- restart=dict(type='bool', default=False), |
|
341 |
- state=dict(choices=['present', 'default'], default='present'), |
|
342 |
- include_defaults=dict(default=False), |
|
343 |
- config=dict(), |
|
344 |
- save=dict(type='bool', default=False) |
|
338 |
+ flush_routes=dict(type='bool'), |
|
339 |
+ enforce_rtr_alert=dict(type='bool'), |
|
340 |
+ restart=dict(type='bool', default=False), |
|
341 |
+ state=dict(choices=['present', 'default'], default='present'), |
|
342 |
+ include_defaults=dict(default=False), |
|
343 |
+ config=dict(), |
|
344 |
+ save=dict(type='bool', default=False) |
|
345 | 345 |
) |
346 | 346 |
module = get_network_module(argument_spec=argument_spec, |
347 | 347 |
supports_check_mode=True) |
... | ... |
@@ -354,9 +354,9 @@ def main(): |
354 | 354 |
module.fail_json(msg='When state=default other params have no effect.') |
355 | 355 |
|
356 | 356 |
args = [ |
357 |
- "flush_routes", |
|
358 |
- "enforce_rtr_alert", |
|
359 |
- ] |
|
357 |
+ "flush_routes", |
|
358 |
+ "enforce_rtr_alert", |
|
359 |
+ ] |
|
360 | 360 |
|
361 | 361 |
existing = invoke('get_existing', module, args) |
362 | 362 |
end_state = existing |
... | ... |
@@ -552,7 +552,7 @@ def get_igmp_interface(module, interface): |
552 | 552 |
command = 'show run interface {0} | inc oif'.format(interface) |
553 | 553 |
|
554 | 554 |
body = execute_show_command( |
555 |
- command, module, command_type='cli_show_ascii')[0] |
|
555 |
+ command, module, command_type='cli_show_ascii')[0] |
|
556 | 556 |
|
557 | 557 |
staticoif = [] |
558 | 558 |
if body: |
... | ... |
@@ -573,7 +573,7 @@ def get_igmp_interface(module, interface): |
573 | 573 |
|
574 | 574 |
try: |
575 | 575 |
match_prefix_source = re.match( |
576 |
- prefix_source_regex, line, re.DOTALL) |
|
576 |
+ prefix_source_regex, line, re.DOTALL) |
|
577 | 577 |
prefix_source_group = match_prefix_source.groupdict() |
578 | 578 |
prefix = prefix_source_group['prefix'] |
579 | 579 |
source = prefix_source_group['source'] |
... | ... |
@@ -694,7 +694,7 @@ def config_remove_oif(existing, existing_oif_prefix_source): |
694 | 694 |
command = None |
695 | 695 |
if existing.get('routemap'): |
696 | 696 |
command = 'no ip igmp static-oif route-map {0}'.format( |
697 |
- existing.get('routemap')) |
|
697 |
+ existing.get('routemap')) |
|
698 | 698 |
if existing_oif_prefix_source: |
699 | 699 |
for each in existing_oif_prefix_source: |
700 | 700 |
if each.get('prefix') and each.get('source'): |
... | ... |
@@ -732,28 +732,28 @@ def execute_config_command(commands, module): |
732 | 732 |
|
733 | 733 |
def main(): |
734 | 734 |
argument_spec = dict( |
735 |
- interface=dict(required=True, type='str'), |
|
736 |
- version=dict(required=False, type='str'), |
|
737 |
- startup_query_interval=dict(required=False, type='str'), |
|
738 |
- startup_query_count=dict(required=False, type='str'), |
|
739 |
- robustness=dict(required=False, type='str'), |
|
740 |
- querier_timeout=dict(required=False, type='str'), |
|
741 |
- query_mrt=dict(required=False, type='str'), |
|
742 |
- query_interval=dict(required=False, type='str'), |
|
743 |
- last_member_qrt=dict(required=False, type='str'), |
|
744 |
- last_member_query_count=dict(required=False, type='str'), |
|
745 |
- group_timeout=dict(required=False, type='str'), |
|
746 |
- report_llg=dict(type='bool'), |
|
747 |
- immediate_leave=dict(type='bool'), |
|
748 |
- oif_routemap=dict(required=False, type='str'), |
|
749 |
- oif_prefix=dict(required=False, type='str'), |
|
750 |
- oif_source=dict(required=False, type='str'), |
|
751 |
- restart=dict(type='bool', default=False), |
|
752 |
- state=dict(choices=['present', 'absent', 'default'], |
|
735 |
+ interface=dict(required=True, type='str'), |
|
736 |
+ version=dict(required=False, type='str'), |
|
737 |
+ startup_query_interval=dict(required=False, type='str'), |
|
738 |
+ startup_query_count=dict(required=False, type='str'), |
|
739 |
+ robustness=dict(required=False, type='str'), |
|
740 |
+ querier_timeout=dict(required=False, type='str'), |
|
741 |
+ query_mrt=dict(required=False, type='str'), |
|
742 |
+ query_interval=dict(required=False, type='str'), |
|
743 |
+ last_member_qrt=dict(required=False, type='str'), |
|
744 |
+ last_member_query_count=dict(required=False, type='str'), |
|
745 |
+ group_timeout=dict(required=False, type='str'), |
|
746 |
+ report_llg=dict(type='bool'), |
|
747 |
+ immediate_leave=dict(type='bool'), |
|
748 |
+ oif_routemap=dict(required=False, type='str'), |
|
749 |
+ oif_prefix=dict(required=False, type='str'), |
|
750 |
+ oif_source=dict(required=False, type='str'), |
|
751 |
+ restart=dict(type='bool', default=False), |
|
752 |
+ state=dict(choices=['present', 'absent', 'default'], |
|
753 | 753 |
default='present'), |
754 |
- include_defaults=dict(default=True), |
|
755 |
- config=dict(), |
|
756 |
- save=dict(type='bool', default=False) |
|
754 |
+ include_defaults=dict(default=True), |
|
755 |
+ config=dict(), |
|
756 |
+ save=dict(type='bool', default=False) |
|
757 | 757 |
) |
758 | 758 |
module = get_network_module(argument_spec=argument_spec, |
759 | 759 |
supports_check_mode=True) |
... | ... |
@@ -408,7 +408,7 @@ def get_igmp_snooping(module): |
408 | 408 |
command = 'show run all | include igmp.snooping' |
409 | 409 |
existing = {} |
410 | 410 |
body = execute_show_command( |
411 |
- command, module, command_type='cli_show_ascii')[0] |
|
411 |
+ command, module, command_type='cli_show_ascii')[0] |
|
412 | 412 |
|
413 | 413 |
if body: |
414 | 414 |
split_body = body.splitlines() |
... | ... |
@@ -485,12 +485,12 @@ def get_igmp_snooping_defaults(): |
485 | 485 |
|
486 | 486 |
def main(): |
487 | 487 |
argument_spec = dict( |
488 |
- snooping=dict(required=False, type='bool'), |
|
489 |
- group_timeout=dict(required=False, type='str'), |
|
490 |
- link_local_grp_supp=dict(required=False, type='bool'), |
|
491 |
- report_supp=dict(required=False, type='bool'), |
|
492 |
- v3_report_supp=dict(required=False, type='bool'), |
|
493 |
- state=dict(choices=['present', 'default'], default='present'), |
|
488 |
+ snooping=dict(required=False, type='bool'), |
|
489 |
+ group_timeout=dict(required=False, type='str'), |
|
490 |
+ link_local_grp_supp=dict(required=False, type='bool'), |
|
491 |
+ report_supp=dict(required=False, type='bool'), |
|
492 |
+ v3_report_supp=dict(required=False, type='bool'), |
|
493 |
+ state=dict(choices=['present', 'default'], default='present'), |
|
494 | 494 |
) |
495 | 495 |
module = get_network_module(argument_spec=argument_spec, |
496 | 496 |
supports_check_mode=True) |
... | ... |
@@ -516,8 +516,8 @@ def main(): |
516 | 516 |
commands = [] |
517 | 517 |
if state == 'present': |
518 | 518 |
delta = dict( |
519 |
- set(proposed.items()).difference(existing.items()) |
|
520 |
- ) |
|
519 |
+ set(proposed.items()).difference(existing.items()) |
|
520 |
+ ) |
|
521 | 521 |
if delta: |
522 | 522 |
command = config_igmp_snooping(delta, existing) |
523 | 523 |
if command: |
... | ... |
@@ -525,8 +525,8 @@ def main(): |
525 | 525 |
elif state == 'default': |
526 | 526 |
proposed = get_igmp_snooping_defaults() |
527 | 527 |
delta = dict( |
528 |
- set(proposed.items()).difference(existing.items()) |
|
529 |
- ) |
|
528 |
+ set(proposed.items()).difference(existing.items()) |
|
529 |
+ ) |
|
530 | 530 |
if delta: |
531 | 531 |
command = config_igmp_snooping(delta, existing, default=True) |
532 | 532 |
if command: |
... | ... |
@@ -381,8 +381,8 @@ def set_boot_options(module, image_name, kickstart=None): |
381 | 381 |
|
382 | 382 |
def main(): |
383 | 383 |
argument_spec = dict( |
384 |
- system_image_file=dict(required=True), |
|
385 |
- kickstart_image_file=dict(required=False), |
|
384 |
+ system_image_file=dict(required=True), |
|
385 |
+ kickstart_image_file=dict(required=False), |
|
386 | 386 |
) |
387 | 387 |
module = get_network_module(argument_spec=argument_spec, |
388 | 388 |
supports_check_mode=True) |
... | ... |
@@ -655,7 +655,7 @@ def get_interface_config_commands(interface, intf, existing): |
655 | 655 |
commands.append('no ip forward') |
656 | 656 |
|
657 | 657 |
fabric_forwarding_anycast_gateway = interface.get( |
658 |
- 'fabric_forwarding_anycast_gateway') |
|
658 |
+ 'fabric_forwarding_anycast_gateway') |
|
659 | 659 |
if fabric_forwarding_anycast_gateway is not None: |
660 | 660 |
if fabric_forwarding_anycast_gateway is True: |
661 | 661 |
commands.append('fabric forwarding mode anycast-gateway') |
... | ... |
@@ -465,11 +465,11 @@ def get_default_commands(existing, proposed, existing_commands, key, module): |
465 | 465 |
elif existing['message_digest_encryption_type'] == 'cisco_type_7': |
466 | 466 |
encryption_type = '7' |
467 | 467 |
command = 'no {0} {1} {2} {3} {4}'.format( |
468 |
- key, |
|
469 |
- existing['message_digest_key_id'], |
|
470 |
- existing['message_digest_algorithm_type'], |
|
471 |
- encryption_type, |
|
472 |
- existing['message_digest_password']) |
|
468 |
+ key, |
|
469 |
+ existing['message_digest_key_id'], |
|
470 |
+ existing['message_digest_algorithm_type'], |
|
471 |
+ encryption_type, |
|
472 |
+ existing['message_digest_password']) |
|
473 | 473 |
commands.append(command) |
474 | 474 |
else: |
475 | 475 |
commands.append('no {0} {1}'.format(key, existing_value)) |
... | ... |
@@ -493,11 +493,11 @@ def get_custom_command(existing_cmd, proposed, key, module): |
493 | 493 |
elif proposed['message_digest_encryption_type'] == 'cisco_type_7': |
494 | 494 |
encryption_type = '7' |
495 | 495 |
command = '{0} {1} {2} {3} {4}'.format( |
496 |
- key, |
|
497 |
- proposed['message_digest_key_id'], |
|
498 |
- proposed['message_digest_algorithm_type'], |
|
499 |
- encryption_type, |
|
500 |
- proposed['message_digest_password']) |
|
496 |
+ key, |
|
497 |
+ proposed['message_digest_key_id'], |
|
498 |
+ proposed['message_digest_algorithm_type'], |
|
499 |
+ encryption_type, |
|
500 |
+ proposed['message_digest_password']) |
|
501 | 501 |
commands.append(command) |
502 | 502 |
return commands |
503 | 503 |
|
... | ... |
@@ -545,11 +545,11 @@ def state_absent(module, existing, proposed, candidate): |
545 | 545 |
elif existing['message_digest_encryption_type'] == 'cisco_type_7': |
546 | 546 |
encryption_type = '7' |
547 | 547 |
command = 'no {0} {1} {2} {3} {4}'.format( |
548 |
- key, |
|
549 |
- existing['message_digest_key_id'], |
|
550 |
- existing['message_digest_algorithm_type'], |
|
551 |
- encryption_type, |
|
552 |
- existing['message_digest_password']) |
|
548 |
+ key, |
|
549 |
+ existing['message_digest_key_id'], |
|
550 |
+ existing['message_digest_algorithm_type'], |
|
551 |
+ encryption_type, |
|
552 |
+ existing['message_digest_password']) |
|
553 | 553 |
commands.append(command) |
554 | 554 |
elif key in ['ip ospf authentication message-digest', |
555 | 555 |
'ip ospf passive-interface']: |
... | ... |
@@ -580,25 +580,25 @@ def normalize_area(area, module): |
580 | 580 |
|
581 | 581 |
def main(): |
582 | 582 |
argument_spec = dict( |
583 |
- interface=dict(required=True, type='str'), |
|
584 |
- ospf=dict(required=True, type='str'), |
|
585 |
- area=dict(required=True, type='str'), |
|
586 |
- cost=dict(required=False, type='str'), |
|
587 |
- hello_interval=dict(required=False, type='str'), |
|
588 |
- dead_interval=dict(required=False, type='str'), |
|
589 |
- passive_interface=dict(required=False, type='bool'), |
|
590 |
- message_digest=dict(required=False, type='bool'), |
|
591 |
- message_digest_key_id=dict(required=False, type='str'), |
|
592 |
- message_digest_algorithm_type=dict(required=False, type='str', |
|
583 |
+ interface=dict(required=True, type='str'), |
|
584 |
+ ospf=dict(required=True, type='str'), |
|
585 |
+ area=dict(required=True, type='str'), |
|
586 |
+ cost=dict(required=False, type='str'), |
|
587 |
+ hello_interval=dict(required=False, type='str'), |
|
588 |
+ dead_interval=dict(required=False, type='str'), |
|
589 |
+ passive_interface=dict(required=False, type='bool'), |
|
590 |
+ message_digest=dict(required=False, type='bool'), |
|
591 |
+ message_digest_key_id=dict(required=False, type='str'), |
|
592 |
+ message_digest_algorithm_type=dict(required=False, type='str', |
|
593 | 593 |
choices=['md5']), |
594 |
- message_digest_encryption_type=dict(required=False, type='str', |
|
594 |
+ message_digest_encryption_type=dict(required=False, type='str', |
|
595 | 595 |
choices=['cisco_type_7','3des']), |
596 |
- message_digest_password=dict(required=False, type='str'), |
|
597 |
- state=dict(choices=['present', 'absent'], default='present', |
|
596 |
+ message_digest_password=dict(required=False, type='str'), |
|
597 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
598 | 598 |
required=False), |
599 |
- include_defaults=dict(default=True), |
|
600 |
- config=dict(), |
|
601 |
- save=dict(type='bool', default=False) |
|
599 |
+ include_defaults=dict(default=True), |
|
600 |
+ config=dict(), |
|
601 |
+ save=dict(type='bool', default=False) |
|
602 | 602 |
) |
603 | 603 |
module = get_network_module(argument_spec=argument_spec, |
604 | 604 |
required_together=[['message_digest_key_id', |
... | ... |
@@ -616,19 +616,19 @@ def main(): |
616 | 616 |
|
617 | 617 |
state = module.params['state'] |
618 | 618 |
args = [ |
619 |
- 'interface', |
|
620 |
- 'ospf', |
|
621 |
- 'area', |
|
622 |
- 'cost', |
|
623 |
- 'hello_interval', |
|
624 |
- 'dead_interval', |
|
625 |
- 'passive_interface', |
|
626 |
- 'message_digest', |
|
627 |
- 'message_digest_key_id', |
|
628 |
- 'message_digest_algorithm_type', |
|
629 |
- 'message_digest_encryption_type', |
|
630 |
- 'message_digest_password' |
|
631 |
- ] |
|
619 |
+ 'interface', |
|
620 |
+ 'ospf', |
|
621 |
+ 'area', |
|
622 |
+ 'cost', |
|
623 |
+ 'hello_interval', |
|
624 |
+ 'dead_interval', |
|
625 |
+ 'passive_interface', |
|
626 |
+ 'message_digest', |
|
627 |
+ 'message_digest_key_id', |
|
628 |
+ 'message_digest_algorithm_type', |
|
629 |
+ 'message_digest_encryption_type', |
|
630 |
+ 'message_digest_password' |
|
631 |
+ ] |
|
632 | 632 |
|
633 | 633 |
existing = invoke('get_existing', module, args) |
634 | 634 |
end_state = existing |
... | ... |
@@ -508,7 +508,7 @@ def parse_unstructured_data(body, interface_name, module): |
508 | 508 |
interface['prefix'] = prefix |
509 | 509 |
|
510 | 510 |
interface_list_table = splitted_body[ |
511 |
- first_reference_point:last_reference_point] |
|
511 |
+ first_reference_point:last_reference_point] |
|
512 | 512 |
|
513 | 513 |
for each_line in interface_list_table: |
514 | 514 |
address = each_line.strip().split(' ')[0] |
... | ... |
@@ -551,10 +551,10 @@ def get_ip_interface(interface_name, version, module): |
551 | 551 |
# and manually parse it. |
552 | 552 |
if module.params['transport'] == 'nxapi' and version == 'v6': |
553 | 553 |
interface, address_list = parse_unstructured_data( |
554 |
- body, interface_name, module) |
|
554 |
+ body, interface_name, module) |
|
555 | 555 |
else: |
556 | 556 |
interface, address_list = parse_structured_data( |
557 |
- body, interface_name, version, module) |
|
557 |
+ body, interface_name, version, module) |
|
558 | 558 |
|
559 | 559 |
return interface, address_list |
560 | 560 |
|
... | ... |
@@ -629,16 +629,16 @@ def validate_params(addr, interface, mask, version, state, intf_type, module): |
629 | 629 |
|
630 | 630 |
def main(): |
631 | 631 |
argument_spec = dict( |
632 |
- interface=dict(required=True), |
|
633 |
- addr=dict(required=False), |
|
634 |
- version=dict(required=False, choices=['v4', 'v6'], |
|
632 |
+ interface=dict(required=True), |
|
633 |
+ addr=dict(required=False), |
|
634 |
+ version=dict(required=False, choices=['v4', 'v6'], |
|
635 | 635 |
default='v4'), |
636 |
- mask=dict(type='str', required=False), |
|
637 |
- state=dict(required=False, default='present', |
|
636 |
+ mask=dict(type='str', required=False), |
|
637 |
+ state=dict(required=False, default='present', |
|
638 | 638 |
choices=['present', 'absent']), |
639 |
- include_defaults=dict(default=True), |
|
640 |
- config=dict(), |
|
641 |
- save=dict(type='bool', default=False) |
|
639 |
+ include_defaults=dict(default=True), |
|
640 |
+ config=dict(), |
|
641 |
+ save=dict(type='bool', default=False) |
|
642 | 642 |
) |
643 | 643 |
module = get_network_module(argument_spec=argument_spec, |
644 | 644 |
supports_check_mode=True) |
... | ... |
@@ -461,7 +461,7 @@ def is_default(interface, module): |
461 | 461 |
|
462 | 462 |
try: |
463 | 463 |
body = execute_show_command( |
464 |
- command, module, command_type='cli_show_ascii')[0] |
|
464 |
+ command, module, command_type='cli_show_ascii')[0] |
|
465 | 465 |
if body == 'DNE': |
466 | 466 |
return 'DNE' |
467 | 467 |
else: |
... | ... |
@@ -498,10 +498,10 @@ def get_interface_mode(interface, intf_type, module): |
498 | 498 |
|
499 | 499 |
def main(): |
500 | 500 |
argument_spec = dict( |
501 |
- mtu=dict(type='str'), |
|
502 |
- interface=dict(type='str'), |
|
503 |
- sysmtu=dict(type='str'), |
|
504 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
501 |
+ mtu=dict(type='str'), |
|
502 |
+ interface=dict(type='str'), |
|
503 |
+ sysmtu=dict(type='str'), |
|
504 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
505 | 505 |
) |
506 | 506 |
module = get_network_module(argument_spec=argument_spec, |
507 | 507 |
required_together=[['mtu', 'interface']], |
... | ... |
@@ -400,15 +400,15 @@ def get_ntp_peer(module): |
400 | 400 |
command = 'show run | inc ntp.(server|peer)' |
401 | 401 |
ntp_peer_list = [] |
402 | 402 |
ntp = execute_show_command( |
403 |
- command, module, command_type='cli_show_ascii') |
|
403 |
+ command, module, command_type='cli_show_ascii') |
|
404 | 404 |
if ntp: |
405 | 405 |
ntp = ntp[0] |
406 | 406 |
|
407 | 407 |
ntp_regex = ( |
408 |
- ".*ntp\s(server\s(?P<address>\S+)|peer\s(?P<peer_address>\S+))" |
|
409 |
- "\s*((?P<prefer>prefer)\s*)?(use-vrf\s(?P<vrf_name>\S+)\s*)?" |
|
410 |
- "(key\s(?P<key_id>\d+))?.*" |
|
411 |
- ) |
|
408 |
+ ".*ntp\s(server\s(?P<address>\S+)|peer\s(?P<peer_address>\S+))" |
|
409 |
+ "\s*((?P<prefer>prefer)\s*)?(use-vrf\s(?P<vrf_name>\S+)\s*)?" |
|
410 |
+ "(key\s(?P<key_id>\d+))?.*" |
|
411 |
+ ) |
|
412 | 412 |
|
413 | 413 |
split_ntp = ntp.splitlines() |
414 | 414 |
for peer_line in split_ntp: |
... | ... |
@@ -521,14 +521,14 @@ def config_ntp(delta, existing): |
521 | 521 |
|
522 | 522 |
def main(): |
523 | 523 |
argument_spec = dict( |
524 |
- server=dict(type='str'), |
|
525 |
- peer=dict(type='str'), |
|
526 |
- key_id=dict(type='str'), |
|
527 |
- prefer=dict(type='str', choices=['enabled', 'disabled']), |
|
528 |
- vrf_name=dict(type='str'), |
|
529 |
- source_addr=dict(type='str'), |
|
530 |
- source_int=dict(type='str'), |
|
531 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
524 |
+ server=dict(type='str'), |
|
525 |
+ peer=dict(type='str'), |
|
526 |
+ key_id=dict(type='str'), |
|
527 |
+ prefer=dict(type='str', choices=['enabled', 'disabled']), |
|
528 |
+ vrf_name=dict(type='str'), |
|
529 |
+ source_addr=dict(type='str'), |
|
530 |
+ source_int=dict(type='str'), |
|
531 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
532 | 532 |
) |
533 | 533 |
module = get_network_module(argument_spec=argument_spec, |
534 | 534 |
mutually_exclusive=[ |
... | ... |
@@ -606,7 +606,7 @@ def main(): |
606 | 606 |
if proposed_source_type == existing_source_type: |
607 | 607 |
if proposed_source == existing_source: |
608 | 608 |
command = 'no ntp {0} {1}'.format( |
609 |
- existing_source_type, existing_source) |
|
609 |
+ existing_source_type, existing_source) |
|
610 | 610 |
if command: |
611 | 611 |
commands.append([command]) |
612 | 612 |
|
... | ... |
@@ -393,7 +393,7 @@ def get_ntp_trusted_key(module): |
393 | 393 |
command = 'show run | inc ntp.trusted-key' |
394 | 394 |
|
395 | 395 |
trusted_key_str = execute_show_command( |
396 |
- command, module, command_type='cli_show_ascii')[0] |
|
396 |
+ command, module, command_type='cli_show_ascii')[0] |
|
397 | 397 |
if trusted_key_str: |
398 | 398 |
trusted_keys = trusted_key_str.splitlines() |
399 | 399 |
|
... | ... |
@@ -496,12 +496,12 @@ def remove_ntp_auth_key(key_id, md5string, auth_type, trusted_key, authenticatio |
496 | 496 |
|
497 | 497 |
def main(): |
498 | 498 |
argument_spec = dict( |
499 |
- key_id=dict(required=True, type='str'), |
|
500 |
- md5string=dict(required=True, type='str'), |
|
501 |
- auth_type=dict(choices=['text', 'encrypt'], default='text'), |
|
502 |
- trusted_key=dict(choices=['true', 'false'], default='false'), |
|
503 |
- authentication=dict(choices=['on', 'off']), |
|
504 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
499 |
+ key_id=dict(required=True, type='str'), |
|
500 |
+ md5string=dict(required=True, type='str'), |
|
501 |
+ auth_type=dict(choices=['text', 'encrypt'], default='text'), |
|
502 |
+ trusted_key=dict(choices=['true', 'false'], default='false'), |
|
503 |
+ authentication=dict(choices=['on', 'off']), |
|
504 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
505 | 505 |
) |
506 | 506 |
module = get_network_module(argument_spec=argument_spec, |
507 | 507 |
supports_check_mode=True) |
... | ... |
@@ -437,10 +437,10 @@ def config_ntp_options(delta, flip=False): |
437 | 437 |
|
438 | 438 |
def main(): |
439 | 439 |
argument_spec = dict( |
440 |
- master=dict(required=False, type='bool'), |
|
441 |
- stratum=dict(type='str'), |
|
442 |
- logging=dict(required=False, type='bool'), |
|
443 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
440 |
+ master=dict(required=False, type='bool'), |
|
441 |
+ stratum=dict(type='str'), |
|
442 |
+ logging=dict(required=False, type='bool'), |
|
443 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
444 | 444 |
) |
445 | 445 |
module = get_network_module(argument_spec=argument_spec, |
446 | 446 |
required_one_of=[['master', 'logging']], |
... | ... |
@@ -297,12 +297,12 @@ def state_absent(module, proposed, candidate): |
297 | 297 |
|
298 | 298 |
def main(): |
299 | 299 |
argument_spec = dict( |
300 |
- ospf=dict(required=True, type='str'), |
|
301 |
- state=dict(choices=['present', 'absent'], default='present', |
|
300 |
+ ospf=dict(required=True, type='str'), |
|
301 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
302 | 302 |
required=False), |
303 |
- include_defaults=dict(default=True), |
|
304 |
- config=dict(), |
|
305 |
- save=dict(type='bool', default=False) |
|
303 |
+ include_defaults=dict(default=True), |
|
304 |
+ config=dict(), |
|
305 |
+ save=dict(type='bool', default=False) |
|
306 | 306 |
) |
307 | 307 |
module = get_network_module(argument_spec=argument_spec, |
308 | 308 |
supports_check_mode=True) |
... | ... |
@@ -441,16 +441,16 @@ def state_present(module, existing, proposed, candidate): |
441 | 441 |
else: |
442 | 442 |
if key == 'timers throttle lsa': |
443 | 443 |
command = '{0} {1} {2} {3}'.format( |
444 |
- key, |
|
445 |
- proposed['timer_throttle_lsa_start'], |
|
446 |
- proposed['timer_throttle_lsa_hold'], |
|
447 |
- proposed['timer_throttle_lsa_max']) |
|
444 |
+ key, |
|
445 |
+ proposed['timer_throttle_lsa_start'], |
|
446 |
+ proposed['timer_throttle_lsa_hold'], |
|
447 |
+ proposed['timer_throttle_lsa_max']) |
|
448 | 448 |
elif key == 'timers throttle spf': |
449 | 449 |
command = '{0} {1} {2} {3}'.format( |
450 |
- key, |
|
451 |
- proposed['timer_throttle_spf_start'], |
|
452 |
- proposed['timer_throttle_spf_hold'], |
|
453 |
- proposed['timer_throttle_spf_max']) |
|
450 |
+ key, |
|
451 |
+ proposed['timer_throttle_spf_start'], |
|
452 |
+ proposed['timer_throttle_spf_hold'], |
|
453 |
+ proposed['timer_throttle_spf_max']) |
|
454 | 454 |
elif key == 'log-adjacency-changes': |
455 | 455 |
if value == 'log': |
456 | 456 |
command = key |
... | ... |
@@ -485,16 +485,16 @@ def state_absent(module, existing, proposed, candidate): |
485 | 485 |
if value: |
486 | 486 |
if key == 'timers throttle lsa': |
487 | 487 |
command = 'no {0} {1} {2} {3}'.format( |
488 |
- key, |
|
489 |
- existing['timer_throttle_lsa_start'], |
|
490 |
- existing['timer_throttle_lsa_hold'], |
|
491 |
- existing['timer_throttle_lsa_max']) |
|
488 |
+ key, |
|
489 |
+ existing['timer_throttle_lsa_start'], |
|
490 |
+ existing['timer_throttle_lsa_hold'], |
|
491 |
+ existing['timer_throttle_lsa_max']) |
|
492 | 492 |
elif key == 'timers throttle spf': |
493 | 493 |
command = 'no {0} {1} {2} {3}'.format( |
494 |
- key, |
|
495 |
- existing['timer_throttle_spf_start'], |
|
496 |
- existing['timer_throttle_spf_hold'], |
|
497 |
- existing['timer_throttle_spf_max']) |
|
494 |
+ key, |
|
495 |
+ existing['timer_throttle_spf_start'], |
|
496 |
+ existing['timer_throttle_spf_hold'], |
|
497 |
+ existing['timer_throttle_spf_max']) |
|
498 | 498 |
else: |
499 | 499 |
existing_value = existing_commands.get(key) |
500 | 500 |
command = 'no {0} {1}'.format(key, existing_value) |
... | ... |
@@ -508,43 +508,43 @@ def state_absent(module, existing, proposed, candidate): |
508 | 508 |
|
509 | 509 |
def main(): |
510 | 510 |
argument_spec = dict( |
511 |
- vrf=dict(required=False, type='str', default='default'), |
|
512 |
- ospf=dict(required=True, type='str'), |
|
513 |
- router_id=dict(required=False, type='str'), |
|
514 |
- default_metric=dict(required=False, type='str'), |
|
515 |
- log_adjacency=dict(required=False, type='str', |
|
511 |
+ vrf=dict(required=False, type='str', default='default'), |
|
512 |
+ ospf=dict(required=True, type='str'), |
|
513 |
+ router_id=dict(required=False, type='str'), |
|
514 |
+ default_metric=dict(required=False, type='str'), |
|
515 |
+ log_adjacency=dict(required=False, type='str', |
|
516 | 516 |
choices=['log', 'detail', 'default']), |
517 |
- timer_throttle_lsa_start=dict(required=False, type='str'), |
|
518 |
- timer_throttle_lsa_hold=dict(required=False, type='str'), |
|
519 |
- timer_throttle_lsa_max=dict(required=False, type='str'), |
|
520 |
- timer_throttle_spf_start=dict(required=False, type='str'), |
|
521 |
- timer_throttle_spf_hold=dict(required=False, type='str'), |
|
522 |
- timer_throttle_spf_max=dict(required=False, type='str'), |
|
523 |
- auto_cost=dict(required=False, type='str'), |
|
524 |
- state=dict(choices=['present', 'absent'], default='present', |
|
517 |
+ timer_throttle_lsa_start=dict(required=False, type='str'), |
|
518 |
+ timer_throttle_lsa_hold=dict(required=False, type='str'), |
|
519 |
+ timer_throttle_lsa_max=dict(required=False, type='str'), |
|
520 |
+ timer_throttle_spf_start=dict(required=False, type='str'), |
|
521 |
+ timer_throttle_spf_hold=dict(required=False, type='str'), |
|
522 |
+ timer_throttle_spf_max=dict(required=False, type='str'), |
|
523 |
+ auto_cost=dict(required=False, type='str'), |
|
524 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
525 | 525 |
required=False), |
526 |
- include_defaults=dict(default=True), |
|
527 |
- config=dict(), |
|
528 |
- save=dict(type='bool', default=False) |
|
526 |
+ include_defaults=dict(default=True), |
|
527 |
+ config=dict(), |
|
528 |
+ save=dict(type='bool', default=False) |
|
529 | 529 |
) |
530 | 530 |
module = get_network_module(argument_spec=argument_spec, |
531 | 531 |
supports_check_mode=True) |
532 | 532 |
|
533 | 533 |
state = module.params['state'] |
534 | 534 |
args = [ |
535 |
- 'vrf', |
|
536 |
- 'ospf', |
|
537 |
- 'router_id', |
|
538 |
- 'default_metric', |
|
539 |
- 'log_adjacency', |
|
540 |
- 'timer_throttle_lsa_start', |
|
541 |
- 'timer_throttle_lsa_hold', |
|
542 |
- 'timer_throttle_lsa_max', |
|
543 |
- 'timer_throttle_spf_start', |
|
544 |
- 'timer_throttle_spf_hold', |
|
545 |
- 'timer_throttle_spf_max', |
|
546 |
- 'auto_cost' |
|
547 |
- ] |
|
535 |
+ 'vrf', |
|
536 |
+ 'ospf', |
|
537 |
+ 'router_id', |
|
538 |
+ 'default_metric', |
|
539 |
+ 'log_adjacency', |
|
540 |
+ 'timer_throttle_lsa_start', |
|
541 |
+ 'timer_throttle_lsa_hold', |
|
542 |
+ 'timer_throttle_lsa_max', |
|
543 |
+ 'timer_throttle_spf_start', |
|
544 |
+ 'timer_throttle_spf_hold', |
|
545 |
+ 'timer_throttle_spf_max', |
|
546 |
+ 'auto_cost' |
|
547 |
+ ] |
|
548 | 548 |
|
549 | 549 |
existing = invoke('get_existing', module, args) |
550 | 550 |
end_state = existing |
... | ... |
@@ -370,18 +370,18 @@ def normalize_mac(proposed_mac, module): |
370 | 370 |
|
371 | 371 |
def main(): |
372 | 372 |
argument_spec = dict( |
373 |
- anycast_gateway_mac=dict(required=True, type='str'), |
|
374 |
- m_facts=dict(required=False, default=False, type='bool'), |
|
375 |
- include_defaults=dict(default=True), |
|
376 |
- config=dict(), |
|
377 |
- save=dict(type='bool', default=False) |
|
373 |
+ anycast_gateway_mac=dict(required=True, type='str'), |
|
374 |
+ m_facts=dict(required=False, default=False, type='bool'), |
|
375 |
+ include_defaults=dict(default=True), |
|
376 |
+ config=dict(), |
|
377 |
+ save=dict(type='bool', default=False) |
|
378 | 378 |
) |
379 | 379 |
module = get_network_module(argument_spec=argument_spec, |
380 | 380 |
supports_check_mode=True) |
381 | 381 |
|
382 | 382 |
args = [ |
383 |
- 'anycast_gateway_mac' |
|
384 |
- ] |
|
383 |
+ 'anycast_gateway_mac' |
|
384 |
+ ] |
|
385 | 385 |
|
386 | 386 |
existing = invoke('get_existing', module, args) |
387 | 387 |
end_state = existing |
... | ... |
@@ -285,11 +285,11 @@ def get_commands(module, existing, proposed, candidate): |
285 | 285 |
|
286 | 286 |
def main(): |
287 | 287 |
argument_spec = dict( |
288 |
- ssm_range=dict(required=True, type='str'), |
|
289 |
- m_facts=dict(required=False, default=False, type='bool'), |
|
290 |
- include_defaults=dict(default=False), |
|
291 |
- config=dict(), |
|
292 |
- save=dict(type='bool', default=False) |
|
288 |
+ ssm_range=dict(required=True, type='str'), |
|
289 |
+ m_facts=dict(required=False, default=False, type='bool'), |
|
290 |
+ include_defaults=dict(default=False), |
|
291 |
+ config=dict(), |
|
292 |
+ save=dict(type='bool', default=False) |
|
293 | 293 |
) |
294 | 294 |
module = get_network_module(argument_spec=argument_spec, |
295 | 295 |
supports_check_mode=True) |
... | ... |
@@ -300,8 +300,8 @@ def main(): |
300 | 300 |
"or the keyword 'none'.") |
301 | 301 |
|
302 | 302 |
args = [ |
303 |
- 'ssm_range' |
|
304 |
- ] |
|
303 |
+ 'ssm_range' |
|
304 |
+ ] |
|
305 | 305 |
|
306 | 306 |
existing = invoke('get_existing', module, args) |
307 | 307 |
end_state = existing |
... | ... |
@@ -784,7 +784,7 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth): |
784 | 784 |
# returns a dict |
785 | 785 |
defaults = get_pim_interface_defaults() |
786 | 786 |
delta = dict(set(defaults.items()).difference( |
787 |
- existing.items())) |
|
787 |
+ existing.items())) |
|
788 | 788 |
if delta: |
789 | 789 |
# returns a list |
790 | 790 |
command = config_pim_interface(delta, existing, |
... | ... |
@@ -799,19 +799,19 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth): |
799 | 799 |
|
800 | 800 |
def main(): |
801 | 801 |
argument_spec=dict( |
802 |
- interface=dict(required=True), |
|
803 |
- sparse=dict(type='bool', default=True), |
|
804 |
- dr_prio=dict(type='str'), |
|
805 |
- hello_auth_key=dict(type='str'), |
|
806 |
- hello_interval=dict(type='int'), |
|
807 |
- jp_policy_out=dict(type='str'), |
|
808 |
- jp_policy_in=dict(type='str'), |
|
809 |
- jp_type_out=dict(choices=['prefix', 'routemap']), |
|
810 |
- jp_type_in=dict(choices=['prefix', 'routemap']), |
|
811 |
- border=dict(type='bool'), |
|
812 |
- neighbor_policy=dict(type='str'), |
|
813 |
- neighbor_type=dict(choices=['prefix', 'routemap']), |
|
814 |
- state=dict(choices=['present', 'absent', 'default'], |
|
802 |
+ interface=dict(required=True), |
|
803 |
+ sparse=dict(type='bool', default=True), |
|
804 |
+ dr_prio=dict(type='str'), |
|
805 |
+ hello_auth_key=dict(type='str'), |
|
806 |
+ hello_interval=dict(type='int'), |
|
807 |
+ jp_policy_out=dict(type='str'), |
|
808 |
+ jp_policy_in=dict(type='str'), |
|
809 |
+ jp_type_out=dict(choices=['prefix', 'routemap']), |
|
810 |
+ jp_type_in=dict(choices=['prefix', 'routemap']), |
|
811 |
+ border=dict(type='bool'), |
|
812 |
+ neighbor_policy=dict(type='str'), |
|
813 |
+ neighbor_type=dict(choices=['prefix', 'routemap']), |
|
814 |
+ state=dict(choices=['present', 'absent', 'default'], |
|
815 | 815 |
default='present'), |
816 | 816 |
) |
817 | 817 |
module = get_network_module(argument_spec=argument_spec, |
... | ... |
@@ -325,7 +325,7 @@ def build_command(param_dict, command): |
325 | 325 |
for param in ['group_list', 'prefix_list', 'route_map']: |
326 | 326 |
if param_dict.get(param): |
327 | 327 |
command += ' {0} {1}'.format( |
328 |
- param.replace('_', '-'), param_dict.get(param)) |
|
328 |
+ param.replace('_', '-'), param_dict.get(param)) |
|
329 | 329 |
if param_dict.get('bidir'): |
330 | 330 |
command += ' bidir' |
331 | 331 |
return [command] |
... | ... |
@@ -346,16 +346,16 @@ def state_absent(module, existing, proposed, candidate): |
346 | 346 |
|
347 | 347 |
def main(): |
348 | 348 |
argument_spec = dict( |
349 |
- rp_address=dict(required=True, type='str'), |
|
350 |
- group_list=dict(required=False, type='str'), |
|
351 |
- prefix_list=dict(required=False, type='str'), |
|
352 |
- route_map=dict(required=False, type='str'), |
|
353 |
- bidir=dict(required=False, type='bool'), |
|
354 |
- state=dict(choices=['present', 'absent'], default='present', |
|
349 |
+ rp_address=dict(required=True, type='str'), |
|
350 |
+ group_list=dict(required=False, type='str'), |
|
351 |
+ prefix_list=dict(required=False, type='str'), |
|
352 |
+ route_map=dict(required=False, type='str'), |
|
353 |
+ bidir=dict(required=False, type='bool'), |
|
354 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
355 | 355 |
required=False), |
356 |
- include_defaults=dict(default=False), |
|
357 |
- config=dict(), |
|
358 |
- save=dict(type='bool', default=False) |
|
356 |
+ include_defaults=dict(default=False), |
|
357 |
+ config=dict(), |
|
358 |
+ save=dict(type='bool', default=False) |
|
359 | 359 |
) |
360 | 360 |
module = get_network_module(argument_spec=argument_spec, |
361 | 361 |
mutually_exclusive=[['group_list', 'route_map'], |
... | ... |
@@ -366,12 +366,12 @@ def main(): |
366 | 366 |
state = module.params['state'] |
367 | 367 |
|
368 | 368 |
args = [ |
369 |
- 'rp_address', |
|
370 |
- 'group_list', |
|
371 |
- 'prefix_list', |
|
372 |
- 'route_map', |
|
373 |
- 'bidir' |
|
374 |
- ] |
|
369 |
+ 'rp_address', |
|
370 |
+ 'group_list', |
|
371 |
+ 'prefix_list', |
|
372 |
+ 'route_map', |
|
373 |
+ 'bidir' |
|
374 |
+ ] |
|
375 | 375 |
|
376 | 376 |
existing = invoke('get_existing', module, args) |
377 | 377 |
end_state = existing |
... | ... |
@@ -378,15 +378,15 @@ def get_ping_results(command, module, transport): |
378 | 378 |
|
379 | 379 |
def main(): |
380 | 380 |
argument_spec = dict( |
381 |
- dest=dict(required=True), |
|
382 |
- count=dict(required=False, default=2), |
|
383 |
- vrf=dict(required=False), |
|
384 |
- source=dict(required=False), |
|
385 |
- state=dict(required=False, choices=['present', 'absent'], |
|
381 |
+ dest=dict(required=True), |
|
382 |
+ count=dict(required=False, default=2), |
|
383 |
+ vrf=dict(required=False), |
|
384 |
+ source=dict(required=False), |
|
385 |
+ state=dict(required=False, choices=['present', 'absent'], |
|
386 | 386 |
default='present'), |
387 |
- include_defaults=dict(default=False), |
|
388 |
- config=dict(), |
|
389 |
- save=dict(type='bool', default=False) |
|
387 |
+ include_defaults=dict(default=False), |
|
388 |
+ config=dict(), |
|
389 |
+ save=dict(type='bool', default=False) |
|
390 | 390 |
) |
391 | 391 |
module = get_network_module(argument_spec=argument_spec, |
392 | 392 |
supports_check_mode=True) |
... | ... |
@@ -417,7 +417,7 @@ def main(): |
417 | 417 |
ping_command += ' {0} {1}'.format(command, arg) |
418 | 418 |
|
419 | 419 |
ping_results, summary, rtt, ping_pass = get_ping_results( |
420 |
- ping_command, module, module.params['transport']) |
|
420 |
+ ping_command, module, module.params['transport']) |
|
421 | 421 |
|
422 | 422 |
packet_loss = summary['packet_loss'] |
423 | 423 |
packets_rx = summary['packets_rx'] |
... | ... |
@@ -316,7 +316,7 @@ def check_interface(module, netcfg): |
316 | 316 |
|
317 | 317 |
def get_custom_value(arg, config, module): |
318 | 318 |
REGEX = re.compile(r'\s+member vni {0} associate-vrf\s*$'.format( |
319 |
- module.params['vni']), re.M) |
|
319 |
+ module.params['vni']), re.M) |
|
320 | 320 |
value = False |
321 | 321 |
try: |
322 | 322 |
if REGEX.search(config): |
... | ... |
@@ -529,7 +529,7 @@ def config_portchannel(proposed, mode, group): |
529 | 529 |
command = 'interface port-channel {0}'.format(group) |
530 | 530 |
commands.append(command) |
531 | 531 |
commands.append(config_args.get('min_links').format( |
532 |
- min_links=min_links)) |
|
532 |
+ min_links=min_links)) |
|
533 | 533 |
|
534 | 534 |
return commands |
535 | 535 |
|
... | ... |
@@ -641,18 +641,18 @@ def flatten_list(command_lists): |
641 | 641 |
|
642 | 642 |
def main(): |
643 | 643 |
argument_spec = dict( |
644 |
- group=dict(required=True, type='str'), |
|
645 |
- mode=dict(required=False, choices=['on', 'active', 'passive'], |
|
644 |
+ group=dict(required=True, type='str'), |
|
645 |
+ mode=dict(required=False, choices=['on', 'active', 'passive'], |
|
646 | 646 |
default='on', type='str'), |
647 |
- min_links=dict(required=False, default=None, type='str'), |
|
648 |
- members=dict(required=False, default=None, type='list'), |
|
649 |
- force=dict(required=False, default='false', type='str', |
|
647 |
+ min_links=dict(required=False, default=None, type='str'), |
|
648 |
+ members=dict(required=False, default=None, type='list'), |
|
649 |
+ force=dict(required=False, default='false', type='str', |
|
650 | 650 |
choices=['true', 'false']), |
651 |
- state=dict(required=False, choices=['absent', 'present'], |
|
651 |
+ state=dict(required=False, choices=['absent', 'present'], |
|
652 | 652 |
default='present'), |
653 |
- include_defaults=dict(default=False), |
|
654 |
- config=dict(), |
|
655 |
- save=dict(type='bool', default=False) |
|
653 |
+ include_defaults=dict(default=False), |
|
654 |
+ config=dict(), |
|
655 |
+ save=dict(type='bool', default=False) |
|
656 | 656 |
) |
657 | 657 |
module = get_network_module(argument_spec=argument_spec, |
658 | 658 |
supports_check_mode=True) |
... | ... |
@@ -675,11 +675,11 @@ def main(): |
675 | 675 |
|
676 | 676 |
changed = False |
677 | 677 |
args = [ |
678 |
- 'group', |
|
679 |
- 'members', |
|
680 |
- 'min_links', |
|
681 |
- 'mode' |
|
682 |
- ] |
|
678 |
+ 'group', |
|
679 |
+ 'members', |
|
680 |
+ 'min_links', |
|
681 |
+ 'mode' |
|
682 |
+ ] |
|
683 | 683 |
|
684 | 684 |
existing, interface_exist = invoke('get_existing', module, args) |
685 | 685 |
end_state = existing |
... | ... |
@@ -269,10 +269,10 @@ def disable_confirmation(module): |
269 | 269 |
|
270 | 270 |
def main(): |
271 | 271 |
argument_spec = dict( |
272 |
- confirm=dict(required=True, type='bool'), |
|
273 |
- include_defaults=dict(default=False), |
|
274 |
- config=dict(), |
|
275 |
- save=dict(type='bool', default=False) |
|
272 |
+ confirm=dict(required=True, type='bool'), |
|
273 |
+ include_defaults=dict(default=False), |
|
274 |
+ config=dict(), |
|
275 |
+ save=dict(type='bool', default=False) |
|
276 | 276 |
) |
277 | 277 |
module = get_network_module(argument_spec=argument_spec, |
278 | 278 |
supports_check_mode=True) |
... | ... |
@@ -291,11 +291,11 @@ def rollback(filename, module): |
291 | 291 |
|
292 | 292 |
def main(): |
293 | 293 |
argument_spec = dict( |
294 |
- checkpoint_file=dict(required=False), |
|
295 |
- rollback_to=dict(required=False), |
|
296 |
- include_defaults=dict(default=True), |
|
297 |
- config=dict(), |
|
298 |
- save=dict(type='bool', default=False) |
|
294 |
+ checkpoint_file=dict(required=False), |
|
295 |
+ rollback_to=dict(required=False), |
|
296 |
+ include_defaults=dict(default=True), |
|
297 |
+ config=dict(), |
|
298 |
+ save=dict(type='bool', default=False) |
|
299 | 299 |
) |
300 | 300 |
module = get_network_module(argument_spec=argument_spec, |
301 | 301 |
mutually_exclusive=[['checkpoint_file', |
... | ... |
@@ -332,7 +332,7 @@ def get_commands(module, pkg, file_system): |
332 | 332 |
|
333 | 333 |
if fixed_pkg not in active_body[0]: |
334 | 334 |
commands.append('install activate {0}{1} force'.format( |
335 |
- file_system, pkg)) |
|
335 |
+ file_system, pkg)) |
|
336 | 336 |
command = 'show install committed' |
337 | 337 |
install_body = execute_show_command(command, module, |
338 | 338 |
command_type='cli_show_ascii') |
... | ... |
@@ -344,11 +344,11 @@ def get_commands(module, pkg, file_system): |
344 | 344 |
|
345 | 345 |
def main(): |
346 | 346 |
argument_spec = dict( |
347 |
- pkg=dict(required=True), |
|
348 |
- file_system=dict(required=False, default='bootflash:'), |
|
349 |
- include_defaults=dict(default=False), |
|
350 |
- config=dict(), |
|
351 |
- save=dict(type='bool', default=False) |
|
347 |
+ pkg=dict(required=True), |
|
348 |
+ file_system=dict(required=False, default='bootflash:'), |
|
349 |
+ include_defaults=dict(default=False), |
|
350 |
+ config=dict(), |
|
351 |
+ save=dict(type='bool', default=False) |
|
352 | 352 |
) |
353 | 353 |
module = get_network_module(argument_spec=argument_spec, |
354 | 354 |
supports_check_mode=True) |
... | ... |
@@ -485,13 +485,13 @@ def action_add(module, existing_snapshots): |
485 | 485 |
if proposed not in sections: |
486 | 486 |
if module.params['element_key2']: |
487 | 487 |
commands.append('snapshot section add {0} "{1}" {2} {3} {4}'.format( |
488 |
- module.params['section'], module.params['show_command'], |
|
489 |
- module.params['row_id'], module.params['element_key1'], |
|
490 |
- module.params['element_key2'])) |
|
488 |
+ module.params['section'], module.params['show_command'], |
|
489 |
+ module.params['row_id'], module.params['element_key1'], |
|
490 |
+ module.params['element_key2'])) |
|
491 | 491 |
else: |
492 | 492 |
commands.append('snapshot section add {0} "{1}" {2} {3}'.format( |
493 |
- module.params['section'], module.params['show_command'], |
|
494 |
- module.params['row_id'], module.params['element_key1'])) |
|
493 |
+ module.params['section'], module.params['show_command'], |
|
494 |
+ module.params['row_id'], module.params['element_key1'])) |
|
495 | 495 |
|
496 | 496 |
return commands |
497 | 497 |
|
... | ... |
@@ -575,24 +575,24 @@ def write_on_file(content, filename, module): |
575 | 575 |
|
576 | 576 |
def main(): |
577 | 577 |
argument_spec = dict( |
578 |
- action=dict(required=True, choices=['create', 'add', |
|
578 |
+ action=dict(required=True, choices=['create', 'add', |
|
579 | 579 |
'compare', 'delete', |
580 | 580 |
'delete_all']), |
581 |
- snapshot_name=dict(required=False, type='str'), |
|
582 |
- description=dict(required=False, type='str'), |
|
583 |
- snapshot1=dict(required=False, type='str'), |
|
584 |
- snapshot2=dict(required=False, type='str'), |
|
585 |
- compare_option=dict(required=False, |
|
581 |
+ snapshot_name=dict(required=False, type='str'), |
|
582 |
+ description=dict(required=False, type='str'), |
|
583 |
+ snapshot1=dict(required=False, type='str'), |
|
584 |
+ snapshot2=dict(required=False, type='str'), |
|
585 |
+ compare_option=dict(required=False, |
|
586 | 586 |
choices=['summary', 'ipv4routes', 'ipv6routes']), |
587 |
- comparison_results_file=dict(required=False, type='str'), |
|
588 |
- section=dict(required=False, type='str'), |
|
589 |
- show_command=dict(required=False, type='str'), |
|
590 |
- row_id=dict(required=False, type='str'), |
|
591 |
- element_key1=dict(required=False, type='str'), |
|
592 |
- element_key2=dict(required=False, type='str'), |
|
593 |
- save_snapshot_locally=dict(required=False, type='bool', |
|
587 |
+ comparison_results_file=dict(required=False, type='str'), |
|
588 |
+ section=dict(required=False, type='str'), |
|
589 |
+ show_command=dict(required=False, type='str'), |
|
590 |
+ row_id=dict(required=False, type='str'), |
|
591 |
+ element_key1=dict(required=False, type='str'), |
|
592 |
+ element_key2=dict(required=False, type='str'), |
|
593 |
+ save_snapshot_locally=dict(required=False, type='bool', |
|
594 | 594 |
default=False), |
595 |
- path=dict(required=False, type='str', default='./') |
|
595 |
+ path=dict(required=False, type='str', default='./') |
|
596 | 596 |
) |
597 | 597 |
module = get_network_module(argument_spec=argument_spec, |
598 | 598 |
mutually_exclusive=[['delete_all', |
... | ... |
@@ -608,7 +608,7 @@ def main(): |
608 | 608 |
|
609 | 609 |
if not os.path.isdir(module.params['path']): |
610 | 610 |
module.fail_json(msg='{0} is not a valid directory name.'.format( |
611 |
- module.params['path'])) |
|
611 |
+ module.params['path'])) |
|
612 | 612 |
|
613 | 613 |
if action == 'create': |
614 | 614 |
for param in CREATE_PARAMS: |
... | ... |
@@ -643,7 +643,7 @@ def main(): |
643 | 643 |
if action == 'compare': |
644 | 644 |
written_file = write_on_file(action_results, |
645 | 645 |
module.params['comparison_results_file'], |
646 |
- module) |
|
646 |
+ module) |
|
647 | 647 |
result['updates'] = [] |
648 | 648 |
else: |
649 | 649 |
if action_results: |
... | ... |
@@ -429,11 +429,11 @@ def config_snmp_community(delta, community): |
429 | 429 |
|
430 | 430 |
def main(): |
431 | 431 |
argument_spec = dict( |
432 |
- community=dict(required=True, type='str'), |
|
433 |
- access=dict(choices=['ro', 'rw']), |
|
434 |
- group=dict(type='str'), |
|
435 |
- acl=dict(type='str'), |
|
436 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
432 |
+ community=dict(required=True, type='str'), |
|
433 |
+ access=dict(choices=['ro', 'rw']), |
|
434 |
+ group=dict(type='str'), |
|
435 |
+ acl=dict(type='str'), |
|
436 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
437 | 437 |
) |
438 | 438 |
module = get_network_module(argument_spec=argument_spec, |
439 | 439 |
required_one_of=[['access', 'group']], |
... | ... |
@@ -353,8 +353,8 @@ def get_snmp_contact(module): |
353 | 353 |
|
354 | 354 |
def main(): |
355 | 355 |
argument_spec = dict( |
356 |
- contact=dict(required=True, type='str'), |
|
357 |
- state=dict(choices=['absent', 'present'], |
|
356 |
+ contact=dict(required=True, type='str'), |
|
357 |
+ state=dict(choices=['absent', 'present'], |
|
358 | 358 |
default='present') |
359 | 359 |
) |
360 | 360 |
module = get_network_module(argument_spec=argument_spec, |
... | ... |
@@ -529,16 +529,16 @@ def flatten_list(command_lists): |
529 | 529 |
|
530 | 530 |
def main(): |
531 | 531 |
argument_spec = dict( |
532 |
- snmp_host=dict(required=True, type='str'), |
|
533 |
- community=dict(type='str'), |
|
534 |
- udp=dict(type='str'), |
|
535 |
- version=dict(choices=['v2c', 'v3'], default='v2c'), |
|
536 |
- src_intf=dict(type='str'), |
|
537 |
- v3=dict(choices=['noauth', 'auth', 'priv']), |
|
538 |
- vrf_filter=dict(type='str'), |
|
539 |
- vrf=dict(type='str'), |
|
540 |
- snmp_type=dict(choices=['trap', 'inform'], default='trap'), |
|
541 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
532 |
+ snmp_host=dict(required=True, type='str'), |
|
533 |
+ community=dict(type='str'), |
|
534 |
+ udp=dict(type='str'), |
|
535 |
+ version=dict(choices=['v2c', 'v3'], default='v2c'), |
|
536 |
+ src_intf=dict(type='str'), |
|
537 |
+ v3=dict(choices=['noauth', 'auth', 'priv']), |
|
538 |
+ vrf_filter=dict(type='str'), |
|
539 |
+ vrf=dict(type='str'), |
|
540 |
+ snmp_type=dict(choices=['trap', 'inform'], default='trap'), |
|
541 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
542 | 542 |
) |
543 | 543 |
module = get_network_module(argument_spec=argument_spec, |
544 | 544 |
supports_check_mode=True) |
... | ... |
@@ -586,16 +586,16 @@ def main(): |
586 | 586 |
existing['vrf_filter'] = vrf_filter |
587 | 587 |
|
588 | 588 |
args = dict( |
589 |
- community=community, |
|
590 |
- snmp_host=snmp_host, |
|
591 |
- udp=udp, |
|
592 |
- version=version, |
|
593 |
- src_intf=src_intf, |
|
594 |
- vrf_filter=vrf_filter, |
|
595 |
- v3=v3, |
|
596 |
- vrf=vrf, |
|
597 |
- snmp_type=snmp_type |
|
598 |
- ) |
|
589 |
+ community=community, |
|
590 |
+ snmp_host=snmp_host, |
|
591 |
+ udp=udp, |
|
592 |
+ version=version, |
|
593 |
+ src_intf=src_intf, |
|
594 |
+ vrf_filter=vrf_filter, |
|
595 |
+ v3=v3, |
|
596 |
+ vrf=vrf, |
|
597 |
+ snmp_type=snmp_type |
|
598 |
+ ) |
|
599 | 599 |
|
600 | 600 |
proposed = dict((k, v) for k, v in args.items() if v is not None) |
601 | 601 |
|
... | ... |
@@ -372,8 +372,8 @@ def get_snmp_location(module): |
372 | 372 |
|
373 | 373 |
def main(): |
374 | 374 |
argument_spec = dict( |
375 |
- location=dict(required=True, type='str'), |
|
376 |
- state=dict(choices=['absent', 'present'], |
|
375 |
+ location=dict(required=True, type='str'), |
|
376 |
+ state=dict(choices=['absent', 'present'], |
|
377 | 377 |
default='present') |
378 | 378 |
) |
379 | 379 |
module = get_network_module(argument_spec=argument_spec, |
... | ... |
@@ -453,8 +453,8 @@ def get_trap_commands(group, state, existing, module): |
453 | 453 |
|
454 | 454 |
def main(): |
455 | 455 |
argument_spec = dict( |
456 |
- state=dict(choices=['enabled', 'disabled'], default='enabled'), |
|
457 |
- group=dict(choices=['aaa', 'bridge', 'callhome', 'cfs', 'config', |
|
456 |
+ state=dict(choices=['enabled', 'disabled'], default='enabled'), |
|
457 |
+ group=dict(choices=['aaa', 'bridge', 'callhome', 'cfs', 'config', |
|
458 | 458 |
'entity', 'feature-control', 'hsrp', |
459 | 459 |
'license', 'link', 'lldp', 'ospf', 'pim', 'rf', |
460 | 460 |
'rmon', 'snmp', 'storm-control', 'stpx', |
... | ... |
@@ -454,13 +454,13 @@ def config_snmp_user(proposed, user, reset, new): |
454 | 454 |
|
455 | 455 |
def main(): |
456 | 456 |
argument_spec = dict( |
457 |
- user=dict(required=True, type='str'), |
|
458 |
- group=dict(type='str', required=True), |
|
459 |
- pwd=dict(type='str'), |
|
460 |
- privacy=dict(type='str'), |
|
461 |
- authentication=dict(choices=['md5', 'sha']), |
|
462 |
- encrypt=dict(type='bool'), |
|
463 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
457 |
+ user=dict(required=True, type='str'), |
|
458 |
+ group=dict(type='str', required=True), |
|
459 |
+ pwd=dict(type='str'), |
|
460 |
+ privacy=dict(type='str'), |
|
461 |
+ authentication=dict(choices=['md5', 'sha']), |
|
462 |
+ encrypt=dict(type='bool'), |
|
463 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
464 | 464 |
) |
465 | 465 |
module = get_network_module(argument_spec=argument_spec, |
466 | 466 |
required_together=[['authentication', 'pwd'], |
... | ... |
@@ -522,7 +522,7 @@ def main(): |
522 | 522 |
proposed['encrypt'] = 'aes-128' |
523 | 523 |
|
524 | 524 |
delta = dict( |
525 |
- set(proposed.items()).difference(existing.items())) |
|
525 |
+ set(proposed.items()).difference(existing.items())) |
|
526 | 526 |
|
527 | 527 |
if delta.get('pwd'): |
528 | 528 |
delta['authentication'] = authentication |
... | ... |
@@ -430,10 +430,10 @@ def get_udld_global(module): |
430 | 430 |
|
431 | 431 |
def main(): |
432 | 432 |
argument_spec = dict( |
433 |
- aggressive=dict(required=False, choices=['enabled', 'disabled']), |
|
434 |
- msg_time=dict(required=False, type='str'), |
|
435 |
- reset=dict(required=False, type='bool'), |
|
436 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
433 |
+ aggressive=dict(required=False, choices=['enabled', 'disabled']), |
|
434 |
+ msg_time=dict(required=False, type='str'), |
|
435 |
+ reset=dict(required=False, type='bool'), |
|
436 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
437 | 437 |
) |
438 | 438 |
module = get_network_module(argument_spec=argument_spec, |
439 | 439 |
required_one_of=[['aggressive', 'msg_time', 'reset']], |
... | ... |
@@ -461,10 +461,10 @@ def get_commands_remove_udld_interface(delta, interface, module, existing): |
461 | 461 |
|
462 | 462 |
def main(): |
463 | 463 |
argument_spec = dict( |
464 |
- mode=dict(choices=['enabled', 'disabled', 'aggressive'], |
|
464 |
+ mode=dict(choices=['enabled', 'disabled', 'aggressive'], |
|
465 | 465 |
required=True), |
466 |
- interface=dict(type='str', required=True), |
|
467 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
466 |
+ interface=dict(type='str', required=True), |
|
467 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
468 | 468 |
) |
469 | 469 |
module = get_network_module(argument_spec=argument_spec, |
470 | 470 |
supports_check_mode=True) |
... | ... |
@@ -555,17 +555,17 @@ def execute_show_command(command, module, command_type='cli_show'): |
555 | 555 |
|
556 | 556 |
def main(): |
557 | 557 |
argument_spec = dict( |
558 |
- vlan_id=dict(required=False, type='str'), |
|
559 |
- vlan_range=dict(required=False), |
|
560 |
- name=dict(required=False), |
|
561 |
- vlan_state=dict(choices=['active', 'suspend'], required=False), |
|
562 |
- mapped_vni=dict(required=False, type='str'), |
|
563 |
- state=dict(choices=['present', 'absent'], default='present', |
|
558 |
+ vlan_id=dict(required=False, type='str'), |
|
559 |
+ vlan_range=dict(required=False), |
|
560 |
+ name=dict(required=False), |
|
561 |
+ vlan_state=dict(choices=['active', 'suspend'], required=False), |
|
562 |
+ mapped_vni=dict(required=False, type='str'), |
|
563 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
564 | 564 |
required=False), |
565 |
- admin_state=dict(choices=['up', 'down'], required=False), |
|
566 |
- include_defaults=dict(default=False), |
|
567 |
- config=dict(), |
|
568 |
- save=dict(type='bool', default=False) |
|
565 |
+ admin_state=dict(choices=['up', 'down'], required=False), |
|
566 |
+ include_defaults=dict(default=False), |
|
567 |
+ config=dict(), |
|
568 |
+ save=dict(type='bool', default=False) |
|
569 | 569 |
) |
570 | 570 |
module = get_network_module(argument_spec=argument_spec, |
571 | 571 |
mutually_exclusive=[['vlan_range', 'name'], |
... | ... |
@@ -436,7 +436,7 @@ def get_vpc(module): |
436 | 436 |
body = execute_show_command(command, module)[0] |
437 | 437 |
domain = str(body['vpc-domain-id']) |
438 | 438 |
auto_recovery = get_autorecovery(str( |
439 |
- body['vpc-auto-recovery-status'])) |
|
439 |
+ body['vpc-auto-recovery-status'])) |
|
440 | 440 |
|
441 | 441 |
if domain != 'not configured': |
442 | 442 |
delay_restore = None |
... | ... |
@@ -563,19 +563,19 @@ def get_commands_to_remove_vpc_interface(portchannel, config_value): |
563 | 563 |
|
564 | 564 |
def main(): |
565 | 565 |
argument_spec = dict( |
566 |
- domain=dict(required=True, type='str'), |
|
567 |
- role_priority=dict(required=False, type='str'), |
|
568 |
- system_priority=dict(required=False, type='str'), |
|
569 |
- pkl_src=dict(required=False), |
|
570 |
- pkl_dest=dict(required=False), |
|
571 |
- pkl_vrf=dict(required=False, default='management'), |
|
572 |
- peer_gw=dict(required=True, type='bool'), |
|
573 |
- auto_recovery=dict(required=True, type='bool'), |
|
574 |
- delay_restore=dict(required=False, type='str'), |
|
575 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
576 |
- include_defaults=dict(default=False), |
|
577 |
- config=dict(), |
|
578 |
- save=dict(type='bool', default=False) |
|
566 |
+ domain=dict(required=True, type='str'), |
|
567 |
+ role_priority=dict(required=False, type='str'), |
|
568 |
+ system_priority=dict(required=False, type='str'), |
|
569 |
+ pkl_src=dict(required=False), |
|
570 |
+ pkl_dest=dict(required=False), |
|
571 |
+ pkl_vrf=dict(required=False, default='management'), |
|
572 |
+ peer_gw=dict(required=True, type='bool'), |
|
573 |
+ auto_recovery=dict(required=True, type='bool'), |
|
574 |
+ delay_restore=dict(required=False, type='str'), |
|
575 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
576 |
+ include_defaults=dict(default=False), |
|
577 |
+ config=dict(), |
|
578 |
+ save=dict(type='bool', default=False) |
|
579 | 579 |
) |
580 | 580 |
module = get_network_module(argument_spec=argument_spec, |
581 | 581 |
supports_check_mode=True) |
... | ... |
@@ -477,13 +477,13 @@ def get_commands_to_config_vpc_interface(portchannel, delta, config_value, exist |
477 | 477 |
|
478 | 478 |
def main(): |
479 | 479 |
argument_spec = dict( |
480 |
- portchannel=dict(required=True, type='str'), |
|
481 |
- vpc=dict(required=False, type='str'), |
|
482 |
- peer_link=dict(required=False, type='bool'), |
|
483 |
- state=dict(choices=['absent', 'present'], default='present'), |
|
484 |
- include_defaults=dict(default=False), |
|
485 |
- config=dict(), |
|
486 |
- save=dict(type='bool', default=False) |
|
480 |
+ portchannel=dict(required=True, type='str'), |
|
481 |
+ vpc=dict(required=False, type='str'), |
|
482 |
+ peer_link=dict(required=False, type='bool'), |
|
483 |
+ state=dict(choices=['absent', 'present'], default='present'), |
|
484 |
+ include_defaults=dict(default=False), |
|
485 |
+ config=dict(), |
|
486 |
+ save=dict(type='bool', default=False) |
|
487 | 487 |
) |
488 | 488 |
module = get_network_module(argument_spec=argument_spec, |
489 | 489 |
mutually_exclusive=[['vpc', 'peer_link']], |
... | ... |
@@ -534,7 +534,7 @@ def main(): |
534 | 534 |
module.fail_json(msg="A peer link already exists on" |
535 | 535 |
" the device. Remove it first", |
536 | 536 |
current_peer_link='Po{0}'.format( |
537 |
- active_peer_link)) |
|
537 |
+ active_peer_link)) |
|
538 | 538 |
config_value = 'peer-link' |
539 | 539 |
|
540 | 540 |
|
... | ... |
@@ -445,17 +445,17 @@ def get_vrf(vrf, module): |
445 | 445 |
|
446 | 446 |
def main(): |
447 | 447 |
argument_spec = dict( |
448 |
- vrf=dict(required=True), |
|
449 |
- description=dict(default=None, required=False), |
|
450 |
- vni=dict(required=False, type='str'), |
|
451 |
- rd=dict(required=False, type='str'), |
|
452 |
- admin_state=dict(default='up', choices=['up', 'down'], |
|
448 |
+ vrf=dict(required=True), |
|
449 |
+ description=dict(default=None, required=False), |
|
450 |
+ vni=dict(required=False, type='str'), |
|
451 |
+ rd=dict(required=False, type='str'), |
|
452 |
+ admin_state=dict(default='up', choices=['up', 'down'], |
|
453 | 453 |
required=False), |
454 |
- state=dict(default='present', choices=['present', 'absent'], |
|
454 |
+ state=dict(default='present', choices=['present', 'absent'], |
|
455 | 455 |
required=False), |
456 |
- include_defaults=dict(default=False), |
|
457 |
- config=dict(), |
|
458 |
- save=dict(type='bool', default=False) |
|
456 |
+ include_defaults=dict(default=False), |
|
457 |
+ config=dict(), |
|
458 |
+ save=dict(type='bool', default=False) |
|
459 | 459 |
) |
460 | 460 |
module = get_network_module(argument_spec=argument_spec, |
461 | 461 |
supports_check_mode=True) |
... | ... |
@@ -367,16 +367,16 @@ def state_absent(module, existing, proposed, candidate): |
367 | 367 |
|
368 | 368 |
def main(): |
369 | 369 |
argument_spec = dict( |
370 |
- vrf=dict(required=True, type='str'), |
|
371 |
- safi=dict(required=True, type='str', choices=['unicast','multicast']), |
|
372 |
- afi=dict(required=True, type='str', choices=['ipv4','ipv6']), |
|
373 |
- route_target_both_auto_evpn=dict(required=False, type='bool'), |
|
374 |
- m_facts=dict(required=False, default=False, type='bool'), |
|
375 |
- state=dict(choices=['present', 'absent'], default='present', |
|
370 |
+ vrf=dict(required=True, type='str'), |
|
371 |
+ safi=dict(required=True, type='str', choices=['unicast','multicast']), |
|
372 |
+ afi=dict(required=True, type='str', choices=['ipv4','ipv6']), |
|
373 |
+ route_target_both_auto_evpn=dict(required=False, type='bool'), |
|
374 |
+ m_facts=dict(required=False, default=False, type='bool'), |
|
375 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
376 | 376 |
required=False), |
377 |
- include_defaults=dict(default=False), |
|
378 |
- config=dict(), |
|
379 |
- save=dict(type='bool', default=False) |
|
377 |
+ include_defaults=dict(default=False), |
|
378 |
+ config=dict(), |
|
379 |
+ save=dict(type='bool', default=False) |
|
380 | 380 |
) |
381 | 381 |
module = get_network_module(argument_spec=argument_spec, |
382 | 382 |
supports_check_mode=True) |
... | ... |
@@ -384,11 +384,11 @@ def main(): |
384 | 384 |
state = module.params['state'] |
385 | 385 |
|
386 | 386 |
args = [ |
387 |
- 'vrf', |
|
388 |
- 'safi', |
|
389 |
- 'afi', |
|
390 |
- 'route_target_both_auto_evpn' |
|
391 |
- ] |
|
387 |
+ 'vrf', |
|
388 |
+ 'safi', |
|
389 |
+ 'afi', |
|
390 |
+ 'route_target_both_auto_evpn' |
|
391 |
+ ] |
|
392 | 392 |
|
393 | 393 |
existing = invoke('get_existing', module, args) |
394 | 394 |
end_state = existing |
... | ... |
@@ -418,13 +418,13 @@ def is_default(interface, module): |
418 | 418 |
|
419 | 419 |
def main(): |
420 | 420 |
argument_spec = dict( |
421 |
- vrf=dict(required=True), |
|
422 |
- interface=dict(type='str', required=True), |
|
423 |
- state=dict(default='present', choices=['present', 'absent'], |
|
421 |
+ vrf=dict(required=True), |
|
422 |
+ interface=dict(type='str', required=True), |
|
423 |
+ state=dict(default='present', choices=['present', 'absent'], |
|
424 | 424 |
required=False), |
425 |
- include_defaults=dict(default=False), |
|
426 |
- config=dict(), |
|
427 |
- save=dict(type='bool', default=False) |
|
425 |
+ include_defaults=dict(default=False), |
|
426 |
+ config=dict(), |
|
427 |
+ save=dict(type='bool', default=False) |
|
428 | 428 |
) |
429 | 429 |
module = get_network_module(argument_spec=argument_spec, |
430 | 430 |
supports_check_mode=True) |
... | ... |
@@ -572,20 +572,20 @@ def validate_params(param, module): |
572 | 572 |
|
573 | 573 |
def main(): |
574 | 574 |
argument_spec = dict( |
575 |
- group=dict(required=True, type='str'), |
|
576 |
- interface=dict(required=True), |
|
577 |
- priority=dict(required=False, type='str'), |
|
578 |
- preempt=dict(required=False, type='bool'), |
|
579 |
- vip=dict(required=False, type='str'), |
|
580 |
- admin_state=dict(required=False, type='str', |
|
575 |
+ group=dict(required=True, type='str'), |
|
576 |
+ interface=dict(required=True), |
|
577 |
+ priority=dict(required=False, type='str'), |
|
578 |
+ preempt=dict(required=False, type='bool'), |
|
579 |
+ vip=dict(required=False, type='str'), |
|
580 |
+ admin_state=dict(required=False, type='str', |
|
581 | 581 |
choices=['shutdown', 'no shutdown'], |
582 | 582 |
default='no shutdown'), |
583 |
- authentication=dict(required=False, type='str'), |
|
584 |
- state=dict(choices=['absent', 'present'], |
|
583 |
+ authentication=dict(required=False, type='str'), |
|
584 |
+ state=dict(choices=['absent', 'present'], |
|
585 | 585 |
required=False, default='present'), |
586 |
- include_defaults=dict(default=False), |
|
587 |
- config=dict(), |
|
588 |
- save=dict(type='bool', default=False) |
|
586 |
+ include_defaults=dict(default=False), |
|
587 |
+ config=dict(), |
|
588 |
+ save=dict(type='bool', default=False) |
|
589 | 589 |
) |
590 | 590 |
module = get_network_module(argument_spec=argument_spec, |
591 | 591 |
supports_check_mode=True) |
... | ... |
@@ -339,7 +339,7 @@ def get_vtp_config(module): |
339 | 339 |
command = 'show vtp status' |
340 | 340 |
|
341 | 341 |
body = execute_show_command( |
342 |
- command, module, command_type='cli_show_ascii')[0] |
|
342 |
+ command, module, command_type='cli_show_ascii')[0] |
|
343 | 343 |
vtp_parsed = {} |
344 | 344 |
|
345 | 345 |
if body: |
... | ... |
@@ -378,7 +378,7 @@ def get_vtp_password(module): |
378 | 378 |
|
379 | 379 |
def main(): |
380 | 380 |
argument_spec = dict( |
381 |
- domain=dict(type='str', required=True), |
|
381 |
+ domain=dict(type='str', required=True), |
|
382 | 382 |
) |
383 | 383 |
module = get_network_module(argument_spec=argument_spec, |
384 | 384 |
supports_check_mode=True) |
... | ... |
@@ -369,7 +369,7 @@ def get_vtp_config(module): |
369 | 369 |
command = 'show vtp status' |
370 | 370 |
|
371 | 371 |
body = execute_show_command( |
372 |
- command, module, command_type='cli_show_ascii')[0] |
|
372 |
+ command, module, command_type='cli_show_ascii')[0] |
|
373 | 373 |
vtp_parsed = {} |
374 | 374 |
|
375 | 375 |
if body: |
... | ... |
@@ -408,8 +408,8 @@ def get_vtp_password(module): |
408 | 408 |
|
409 | 409 |
def main(): |
410 | 410 |
argument_spec = dict( |
411 |
- vtp_password=dict(type='str', no_log=True), |
|
412 |
- state=dict(choices=['absent', 'present'], |
|
411 |
+ vtp_password=dict(type='str', no_log=True), |
|
412 |
+ state=dict(choices=['absent', 'present'], |
|
413 | 413 |
default='present'), |
414 | 414 |
) |
415 | 415 |
module = get_network_module(argument_spec=argument_spec, |
... | ... |
@@ -334,7 +334,7 @@ def get_vtp_config(module): |
334 | 334 |
command = 'show vtp status' |
335 | 335 |
|
336 | 336 |
body = execute_show_command( |
337 |
- command, module, command_type='cli_show_ascii')[0] |
|
337 |
+ command, module, command_type='cli_show_ascii')[0] |
|
338 | 338 |
vtp_parsed = {} |
339 | 339 |
|
340 | 340 |
if body: |
... | ... |
@@ -373,7 +373,7 @@ def get_vtp_password(module): |
373 | 373 |
|
374 | 374 |
def main(): |
375 | 375 |
argument_spec = dict( |
376 |
- version=dict(type='str', choices=['1', '2'], required=True), |
|
376 |
+ version=dict(type='str', choices=['1', '2'], required=True), |
|
377 | 377 |
) |
378 | 378 |
module = get_network_module(argument_spec=argument_spec, |
379 | 379 |
supports_check_mode=True) |
... | ... |
@@ -445,18 +445,18 @@ def state_absent(module, existing, proposed, candidate): |
445 | 445 |
|
446 | 446 |
def main(): |
447 | 447 |
argument_spec = dict( |
448 |
- interface=dict(required=True, type='str'), |
|
449 |
- description=dict(required=False, type='str'), |
|
450 |
- host_reachability=dict(required=False, type='bool'), |
|
451 |
- shutdown=dict(required=False, type='bool'), |
|
452 |
- source_interface=dict(required=False, type='str'), |
|
453 |
- source_interface_hold_down_time=dict(required=False, type='str'), |
|
454 |
- m_facts=dict(required=False, default=False, type='bool'), |
|
455 |
- state=dict(choices=['present', 'absent'], default='present', |
|
448 |
+ interface=dict(required=True, type='str'), |
|
449 |
+ description=dict(required=False, type='str'), |
|
450 |
+ host_reachability=dict(required=False, type='bool'), |
|
451 |
+ shutdown=dict(required=False, type='bool'), |
|
452 |
+ source_interface=dict(required=False, type='str'), |
|
453 |
+ source_interface_hold_down_time=dict(required=False, type='str'), |
|
454 |
+ m_facts=dict(required=False, default=False, type='bool'), |
|
455 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
456 | 456 |
required=False), |
457 |
- include_defaults=dict(default=True), |
|
458 |
- config=dict(), |
|
459 |
- save=dict(type='bool', default=False) |
|
457 |
+ include_defaults=dict(default=True), |
|
458 |
+ config=dict(), |
|
459 |
+ save=dict(type='bool', default=False) |
|
460 | 460 |
) |
461 | 461 |
module = get_network_module(argument_spec=argument_spec, |
462 | 462 |
supports_check_mode=True) |
... | ... |
@@ -465,13 +465,13 @@ def main(): |
465 | 465 |
interface = module.params['interface'].lower() |
466 | 466 |
|
467 | 467 |
args = [ |
468 |
- 'interface', |
|
469 |
- 'description', |
|
470 |
- 'host_reachability', |
|
471 |
- 'shutdown', |
|
472 |
- 'source_interface', |
|
473 |
- 'source_interface_hold_down_time' |
|
474 |
- ] |
|
468 |
+ 'interface', |
|
469 |
+ 'description', |
|
470 |
+ 'host_reachability', |
|
471 |
+ 'shutdown', |
|
472 |
+ 'source_interface', |
|
473 |
+ 'source_interface_hold_down_time' |
|
474 |
+ ] |
|
475 | 475 |
|
476 | 476 |
existing = invoke('get_existing', module, args) |
477 | 477 |
end_state = existing |
... | ... |
@@ -378,7 +378,7 @@ def get_existing(module, args): |
378 | 378 |
|
379 | 379 |
if 'member vni {0} associate-vrf'.format(module.params['vni']) in temp_config: |
380 | 380 |
parents.append('member vni {0} associate-vrf'.format( |
381 |
- module.params['vni'])) |
|
381 |
+ module.params['vni'])) |
|
382 | 382 |
config = netcfg.get_section(parents) |
383 | 383 |
elif "member vni {0}".format(module.params['vni']) in temp_config: |
384 | 384 |
parents.append('member vni {0}'.format(module.params['vni'])) |
... | ... |
@@ -473,7 +473,7 @@ def state_present(module, existing, proposed, candidate): |
473 | 473 |
def state_absent(module, existing, proposed, candidate): |
474 | 474 |
if existing['assoc_vrf']: |
475 | 475 |
commands = ['no member vni {0} associate-vrf'.format( |
476 |
- module.params['vni'])] |
|
476 |
+ module.params['vni'])] |
|
477 | 477 |
else: |
478 | 478 |
commands = ['no member vni {0}'.format(module.params['vni'])] |
479 | 479 |
parents = ['interface {0}'.format(module.params['interface'])] |
... | ... |
@@ -482,19 +482,19 @@ def state_absent(module, existing, proposed, candidate): |
482 | 482 |
|
483 | 483 |
def main(): |
484 | 484 |
argument_spec = dict( |
485 |
- interface=dict(required=True, type='str'), |
|
486 |
- vni=dict(required=True, type='str'), |
|
487 |
- assoc_vrf=dict(required=False, type='bool'), |
|
488 |
- multicast_group=dict(required=False, type='str'), |
|
489 |
- peer_list=dict(required=False, type='list'), |
|
490 |
- suppress_arp=dict(required=False, type='bool'), |
|
491 |
- ingress_replication=dict(required=False, type='str', |
|
485 |
+ interface=dict(required=True, type='str'), |
|
486 |
+ vni=dict(required=True, type='str'), |
|
487 |
+ assoc_vrf=dict(required=False, type='bool'), |
|
488 |
+ multicast_group=dict(required=False, type='str'), |
|
489 |
+ peer_list=dict(required=False, type='list'), |
|
490 |
+ suppress_arp=dict(required=False, type='bool'), |
|
491 |
+ ingress_replication=dict(required=False, type='str', |
|
492 | 492 |
choices=['bgp', 'static', 'default']), |
493 |
- state=dict(choices=['present', 'absent'], default='present', |
|
493 |
+ state=dict(choices=['present', 'absent'], default='present', |
|
494 | 494 |
required=False), |
495 |
- include_defaults=dict(default=True), |
|
496 |
- config=dict(), |
|
497 |
- save=dict(type='bool', default=False) |
|
495 |
+ include_defaults=dict(default=True), |
|
496 |
+ config=dict(), |
|
497 |
+ save=dict(type='bool', default=False) |
|
498 | 498 |
) |
499 | 499 |
module = get_network_module(argument_spec=argument_spec, |
500 | 500 |
supports_check_mode=True) |
... | ... |
@@ -521,14 +521,14 @@ def main(): |
521 | 521 |
|
522 | 522 |
state = module.params['state'] |
523 | 523 |
args = [ |
524 |
- 'assoc_vrf', |
|
525 |
- 'interface', |
|
526 |
- 'vni', |
|
527 |
- 'ingress_replication', |
|
528 |
- 'multicast_group', |
|
529 |
- 'peer_list', |
|
530 |
- 'suppress_arp' |
|
531 |
- ] |
|
524 |
+ 'assoc_vrf', |
|
525 |
+ 'interface', |
|
526 |
+ 'vni', |
|
527 |
+ 'ingress_replication', |
|
528 |
+ 'multicast_group', |
|
529 |
+ 'peer_list', |
|
530 |
+ 'suppress_arp' |
|
531 |
+ ] |
|
532 | 532 |
|
533 | 533 |
existing, interface_exist = invoke('get_existing', module, args) |
534 | 534 |
end_state = existing |
... | ... |
@@ -557,7 +557,7 @@ def main(): |
557 | 557 |
existing['vni'] != module.params['vni']): |
558 | 558 |
module.fail_json(msg="ERROR: VNI delete failed: Could not find" |
559 | 559 |
" vni node for {0}".format( |
560 |
- module.params['vni']), |
|
560 |
+ module.params['vni']), |
|
561 | 561 |
existing_vni=existing['vni']) |
562 | 562 |
else: |
563 | 563 |
candidate = CustomNetworkConfig(indent=3) |
... | ... |
@@ -156,10 +156,10 @@ def decode_mac(hexstring): |
156 | 156 |
|
157 | 157 |
def lookup_adminstatus(int_adminstatus): |
158 | 158 |
adminstatus_options = { |
159 |
- 1: 'up', |
|
160 |
- 2: 'down', |
|
161 |
- 3: 'testing' |
|
162 |
- } |
|
159 |
+ 1: 'up', |
|
160 |
+ 2: 'down', |
|
161 |
+ 3: 'testing' |
|
162 |
+ } |
|
163 | 163 |
if int_adminstatus in adminstatus_options: |
164 | 164 |
return adminstatus_options[int_adminstatus] |
165 | 165 |
else: |
... | ... |
@@ -167,14 +167,14 @@ def lookup_adminstatus(int_adminstatus): |
167 | 167 |
|
168 | 168 |
def lookup_operstatus(int_operstatus): |
169 | 169 |
operstatus_options = { |
170 |
- 1: 'up', |
|
171 |
- 2: 'down', |
|
172 |
- 3: 'testing', |
|
173 |
- 4: 'unknown', |
|
174 |
- 5: 'dormant', |
|
175 |
- 6: 'notPresent', |
|
176 |
- 7: 'lowerLayerDown' |
|
177 |
- } |
|
170 |
+ 1: 'up', |
|
171 |
+ 2: 'down', |
|
172 |
+ 3: 'testing', |
|
173 |
+ 4: 'unknown', |
|
174 |
+ 5: 'dormant', |
|
175 |
+ 6: 'notPresent', |
|
176 |
+ 7: 'lowerLayerDown' |
|
177 |
+ } |
|
178 | 178 |
if int_operstatus in operstatus_options: |
179 | 179 |
return operstatus_options[int_operstatus] |
180 | 180 |
else: |
... | ... |
@@ -354,9 +354,9 @@ def main(): |
354 | 354 |
for ipv4_network in ipv4_networks: |
355 | 355 |
current_interface = ipv4_networks[ipv4_network]['interface'] |
356 | 356 |
current_network = { |
357 |
- 'address': ipv4_networks[ipv4_network]['address'], |
|
358 |
- 'netmask': ipv4_networks[ipv4_network]['netmask'] |
|
359 |
- } |
|
357 |
+ 'address': ipv4_networks[ipv4_network]['address'], |
|
358 |
+ 'netmask': ipv4_networks[ipv4_network]['netmask'] |
|
359 |
+ } |
|
360 | 360 |
if not current_interface in interface_to_ipv4: |
361 | 361 |
interface_to_ipv4[current_interface] = [] |
362 | 362 |
interface_to_ipv4[current_interface].append(current_network) |
... | ... |
@@ -230,9 +230,9 @@ def main(): |
230 | 230 |
), |
231 | 231 |
supports_check_mode=True, |
232 | 232 |
mutually_exclusive = [ |
233 |
- ['api_key', 'password'], |
|
234 |
- ['api_key', 'username'] |
|
235 |
- ], |
|
233 |
+ ['api_key', 'password'], |
|
234 |
+ ['api_key', 'username'] |
|
235 |
+ ], |
|
236 | 236 |
required_together = [['username', 'password']], |
237 | 237 |
) |
238 | 238 |
|
... | ... |
@@ -152,19 +152,19 @@ def get_bundler_executable(module): |
152 | 152 |
def main(): |
153 | 153 |
module = AnsibleModule( |
154 | 154 |
argument_spec=dict( |
155 |
- executable=dict(default=None, required=False), |
|
156 |
- state=dict(default='present', required=False, choices=['present', 'latest']), |
|
157 |
- chdir=dict(default=None, required=False, type='path'), |
|
158 |
- exclude_groups=dict(default=None, required=False, type='list'), |
|
159 |
- clean=dict(default=False, required=False, type='bool'), |
|
160 |
- gemfile=dict(default=None, required=False, type='path'), |
|
161 |
- local=dict(default=False, required=False, type='bool'), |
|
162 |
- deployment_mode=dict(default=False, required=False, type='bool'), |
|
163 |
- user_install=dict(default=True, required=False, type='bool'), |
|
164 |
- gem_path=dict(default=None, required=False, type='path'), |
|
165 |
- binstub_directory=dict(default=None, required=False, type='path'), |
|
166 |
- extra_args=dict(default=None, required=False), |
|
167 |
- ), |
|
155 |
+ executable=dict(default=None, required=False), |
|
156 |
+ state=dict(default='present', required=False, choices=['present', 'latest']), |
|
157 |
+ chdir=dict(default=None, required=False, type='path'), |
|
158 |
+ exclude_groups=dict(default=None, required=False, type='list'), |
|
159 |
+ clean=dict(default=False, required=False, type='bool'), |
|
160 |
+ gemfile=dict(default=None, required=False, type='path'), |
|
161 |
+ local=dict(default=False, required=False, type='bool'), |
|
162 |
+ deployment_mode=dict(default=False, required=False, type='bool'), |
|
163 |
+ user_install=dict(default=True, required=False, type='bool'), |
|
164 |
+ gem_path=dict(default=None, required=False, type='path'), |
|
165 |
+ binstub_directory=dict(default=None, required=False, type='path'), |
|
166 |
+ extra_args=dict(default=None, required=False), |
|
167 |
+ ), |
|
168 | 168 |
supports_check_mode=True |
169 | 169 |
) |
170 | 170 |
|
... | ... |
@@ -239,14 +239,14 @@ from ansible.module_utils.urls import fetch_url |
239 | 239 |
|
240 | 240 |
# APT related constants |
241 | 241 |
APT_ENV_VARS = dict( |
242 |
- DEBIAN_FRONTEND = 'noninteractive', |
|
243 |
- DEBIAN_PRIORITY = 'critical', |
|
244 |
- # We screenscrape apt-get and aptitude output for information so we need |
|
245 |
- # to make sure we use the C locale when running commands |
|
246 |
- LANG = 'C', |
|
247 |
- LC_ALL = 'C', |
|
248 |
- LC_MESSAGES = 'C', |
|
249 |
- LC_CTYPE = 'C', |
|
242 |
+ DEBIAN_FRONTEND = 'noninteractive', |
|
243 |
+ DEBIAN_PRIORITY = 'critical', |
|
244 |
+ # We screenscrape apt-get and aptitude output for information so we need |
|
245 |
+ # to make sure we use the C locale when running commands |
|
246 |
+ LANG = 'C', |
|
247 |
+ LC_ALL = 'C', |
|
248 |
+ LC_MESSAGES = 'C', |
|
249 |
+ LC_CTYPE = 'C', |
|
250 | 250 |
) |
251 | 251 |
|
252 | 252 |
DPKG_OPTIONS = 'force-confdef,force-confold' |
... | ... |
@@ -158,10 +158,10 @@ def install_packages(module, pkgspec): |
158 | 158 |
|
159 | 159 |
def main(): |
160 | 160 |
module = AnsibleModule( |
161 |
- argument_spec = dict( |
|
162 |
- state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), |
|
163 |
- update_cache = dict(default=False, aliases=['update-cache'], type='bool'), |
|
164 |
- package = dict(aliases=['pkg', 'name'], required=True))) |
|
161 |
+ argument_spec = dict( |
|
162 |
+ state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), |
|
163 |
+ update_cache = dict(default=False, aliases=['update-cache'], type='bool'), |
|
164 |
+ package = dict(aliases=['pkg', 'name'], required=True))) |
|
165 | 165 |
|
166 | 166 |
|
167 | 167 |
if not os.path.exists(APT_PATH) or not os.path.exists(RPM_PATH): |
... | ... |
@@ -336,16 +336,16 @@ def clean_cache(module): |
336 | 336 |
|
337 | 337 |
def main(): |
338 | 338 |
module = AnsibleModule( |
339 |
- argument_spec = dict( |
|
340 |
- state = dict(default="present", choices=["present","absent"]), |
|
341 |
- name = dict(aliases=["pkg"], type='list'), |
|
342 |
- update_cache = dict(default='no', type='bool'), |
|
343 |
- upgrade = dict(default='no', type='bool'), |
|
344 |
- full_upgrade = dict(default='no', type='bool'), |
|
345 |
- clean = dict(default='no', type='bool'), |
|
346 |
- force = dict(default='no', type='bool')), |
|
347 |
- required_one_of = [['name', 'update_cache', 'upgrade', 'full_upgrade', 'clean']], |
|
348 |
- supports_check_mode = True) |
|
339 |
+ argument_spec = dict( |
|
340 |
+ state = dict(default="present", choices=["present","absent"]), |
|
341 |
+ name = dict(aliases=["pkg"], type='list'), |
|
342 |
+ update_cache = dict(default='no', type='bool'), |
|
343 |
+ upgrade = dict(default='no', type='bool'), |
|
344 |
+ full_upgrade = dict(default='no', type='bool'), |
|
345 |
+ clean = dict(default='no', type='bool'), |
|
346 |
+ force = dict(default='no', type='bool')), |
|
347 |
+ required_one_of = [['name', 'update_cache', 'upgrade', 'full_upgrade', 'clean']], |
|
348 |
+ supports_check_mode = True) |
|
349 | 349 |
|
350 | 350 |
global PKGIN_PATH |
351 | 351 |
PKGIN_PATH = module.get_bin_path('pkgin', True, ['/opt/local/bin']) |
... | ... |
@@ -305,17 +305,17 @@ def autoremove_packages(module, pkgng_path, dir_arg): |
305 | 305 |
|
306 | 306 |
def main(): |
307 | 307 |
module = AnsibleModule( |
308 |
- argument_spec = dict( |
|
309 |
- state = dict(default="present", choices=["present","absent"], required=False), |
|
310 |
- name = dict(aliases=["pkg"], required=True, type='list'), |
|
311 |
- cached = dict(default=False, type='bool'), |
|
312 |
- annotation = dict(default="", required=False), |
|
313 |
- pkgsite = dict(default="", required=False), |
|
314 |
- rootdir = dict(default="", required=False, type='path'), |
|
315 |
- chroot = dict(default="", required=False, type='path'), |
|
316 |
- autoremove = dict(default=False, type='bool')), |
|
317 |
- supports_check_mode = True, |
|
318 |
- mutually_exclusive =[["rootdir", "chroot"]]) |
|
308 |
+ argument_spec = dict( |
|
309 |
+ state = dict(default="present", choices=["present","absent"], required=False), |
|
310 |
+ name = dict(aliases=["pkg"], required=True, type='list'), |
|
311 |
+ cached = dict(default=False, type='bool'), |
|
312 |
+ annotation = dict(default="", required=False), |
|
313 |
+ pkgsite = dict(default="", required=False), |
|
314 |
+ rootdir = dict(default="", required=False, type='path'), |
|
315 |
+ chroot = dict(default="", required=False, type='path'), |
|
316 |
+ autoremove = dict(default=False, type='bool')), |
|
317 |
+ supports_check_mode = True, |
|
318 |
+ mutually_exclusive =[["rootdir", "chroot"]]) |
|
319 | 319 |
|
320 | 320 |
pkgng_path = module.get_bin_path('pkg', True) |
321 | 321 |
|
... | ... |
@@ -195,10 +195,10 @@ def install_packages(module, packages, use_packages): |
195 | 195 |
|
196 | 196 |
def main(): |
197 | 197 |
module = AnsibleModule( |
198 |
- argument_spec = dict( |
|
199 |
- state = dict(default="present", choices=["present","absent"]), |
|
200 |
- name = dict(aliases=["pkg"], required=True), |
|
201 |
- use_packages = dict(type='bool', default='yes'))) |
|
198 |
+ argument_spec = dict( |
|
199 |
+ state = dict(default="present", choices=["present","absent"]), |
|
200 |
+ name = dict(aliases=["pkg"], required=True), |
|
201 |
+ use_packages = dict(type='bool', default='yes'))) |
|
202 | 202 |
|
203 | 203 |
p = module.params |
204 | 204 |
|
... | ... |
@@ -273,7 +273,7 @@ class Rhsm(RegistrationBase): |
273 | 273 |
# Quick version... |
274 | 274 |
if False: |
275 | 275 |
return os.path.isfile('/etc/pki/consumer/cert.pem') and \ |
276 |
- os.path.isfile('/etc/pki/consumer/key.pem') |
|
276 |
+ os.path.isfile('/etc/pki/consumer/key.pem') |
|
277 | 277 |
|
278 | 278 |
args = [SUBMAN_CMD, 'identity'] |
279 | 279 |
rc, stdout, stderr = self.module.run_command(args, check_rc=False) |
... | ... |
@@ -469,26 +469,26 @@ def main(): |
469 | 469 |
rhsm = Rhsm(None) |
470 | 470 |
|
471 | 471 |
module = AnsibleModule( |
472 |
- argument_spec = dict( |
|
473 |
- state = dict(default='present', choices=['present', 'absent']), |
|
474 |
- username = dict(default=None, required=False), |
|
475 |
- password = dict(default=None, required=False, no_log=True), |
|
476 |
- server_hostname = dict(default=rhsm.config.get_option('server.hostname'), required=False), |
|
477 |
- server_insecure = dict(default=rhsm.config.get_option('server.insecure'), required=False), |
|
478 |
- rhsm_baseurl = dict(default=rhsm.config.get_option('rhsm.baseurl'), required=False), |
|
479 |
- autosubscribe = dict(default=False, type='bool'), |
|
480 |
- activationkey = dict(default=None, required=False), |
|
481 |
- org_id = dict(default=None, required=False), |
|
482 |
- environment = dict(default=None, required=False, type='str'), |
|
483 |
- pool = dict(default='^$', required=False, type='str'), |
|
484 |
- consumer_type = dict(default=None, required=False), |
|
485 |
- consumer_name = dict(default=None, required=False), |
|
486 |
- consumer_id = dict(default=None, required=False), |
|
487 |
- force_register = dict(default=False, type='bool'), |
|
488 |
- ), |
|
489 |
- required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ], |
|
490 |
- mutually_exclusive = [ ['username', 'activationkey'] ], |
|
491 |
- ) |
|
472 |
+ argument_spec = dict( |
|
473 |
+ state = dict(default='present', choices=['present', 'absent']), |
|
474 |
+ username = dict(default=None, required=False), |
|
475 |
+ password = dict(default=None, required=False, no_log=True), |
|
476 |
+ server_hostname = dict(default=rhsm.config.get_option('server.hostname'), required=False), |
|
477 |
+ server_insecure = dict(default=rhsm.config.get_option('server.insecure'), required=False), |
|
478 |
+ rhsm_baseurl = dict(default=rhsm.config.get_option('rhsm.baseurl'), required=False), |
|
479 |
+ autosubscribe = dict(default=False, type='bool'), |
|
480 |
+ activationkey = dict(default=None, required=False), |
|
481 |
+ org_id = dict(default=None, required=False), |
|
482 |
+ environment = dict(default=None, required=False, type='str'), |
|
483 |
+ pool = dict(default='^$', required=False, type='str'), |
|
484 |
+ consumer_type = dict(default=None, required=False), |
|
485 |
+ consumer_name = dict(default=None, required=False), |
|
486 |
+ consumer_id = dict(default=None, required=False), |
|
487 |
+ force_register = dict(default=False, type='bool'), |
|
488 |
+ ), |
|
489 |
+ required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ], |
|
490 |
+ mutually_exclusive = [ ['username', 'activationkey'] ], |
|
491 |
+ ) |
|
492 | 492 |
|
493 | 493 |
rhsm.module = module |
494 | 494 |
state = module.params['state'] |
... | ... |
@@ -358,19 +358,19 @@ def main(): |
358 | 358 |
rhn = Rhn() |
359 | 359 |
|
360 | 360 |
module = AnsibleModule( |
361 |
- argument_spec = dict( |
|
362 |
- state = dict(default='present', choices=['present', 'absent']), |
|
363 |
- username = dict(default=None, required=False), |
|
364 |
- password = dict(default=None, required=False, no_log=True), |
|
365 |
- server_url = dict(default=None, required=False), |
|
366 |
- activationkey = dict(default=None, required=False, no_log=True), |
|
367 |
- profilename = dict(default=None, required=False), |
|
368 |
- sslcacert = dict(default=None, required=False, type='path'), |
|
369 |
- systemorgid = dict(default=None, required=False), |
|
370 |
- enable_eus = dict(default=False, type='bool'), |
|
371 |
- channels = dict(default=[], type='list'), |
|
372 |
- ) |
|
361 |
+ argument_spec = dict( |
|
362 |
+ state = dict(default='present', choices=['present', 'absent']), |
|
363 |
+ username = dict(default=None, required=False), |
|
364 |
+ password = dict(default=None, required=False, no_log=True), |
|
365 |
+ server_url = dict(default=None, required=False), |
|
366 |
+ activationkey = dict(default=None, required=False, no_log=True), |
|
367 |
+ profilename = dict(default=None, required=False), |
|
368 |
+ sslcacert = dict(default=None, required=False, type='path'), |
|
369 |
+ systemorgid = dict(default=None, required=False), |
|
370 |
+ enable_eus = dict(default=False, type='bool'), |
|
371 |
+ channels = dict(default=[], type='list'), |
|
373 | 372 |
) |
373 |
+ ) |
|
374 | 374 |
|
375 | 375 |
if not HAS_UP2DATE_CLIENT: |
376 | 376 |
module.fail_json(msg="Unable to import up2date_client. Is 'rhn-client-tools' installed?") |
... | ... |
@@ -200,13 +200,13 @@ class RpmKey: |
200 | 200 |
|
201 | 201 |
def main(): |
202 | 202 |
module = AnsibleModule( |
203 |
- argument_spec = dict( |
|
204 |
- state=dict(default='present', choices=['present', 'absent'], type='str'), |
|
205 |
- key=dict(required=True, type='str'), |
|
206 |
- validate_certs=dict(default='yes', type='bool'), |
|
207 |
- ), |
|
208 |
- supports_check_mode=True |
|
209 |
- ) |
|
203 |
+ argument_spec = dict( |
|
204 |
+ state=dict(default='present', choices=['present', 'absent'], type='str'), |
|
205 |
+ key=dict(required=True, type='str'), |
|
206 |
+ validate_certs=dict(default='yes', type='bool'), |
|
207 |
+ ), |
|
208 |
+ supports_check_mode=True |
|
209 |
+ ) |
|
210 | 210 |
|
211 | 211 |
RpmKey(module) |
212 | 212 |
|
... | ... |
@@ -183,12 +183,12 @@ def install_packages(module, pkgspec, force=True, no_recommends=True): |
183 | 183 |
|
184 | 184 |
def main(): |
185 | 185 |
module = AnsibleModule( |
186 |
- argument_spec = dict( |
|
187 |
- state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), |
|
188 |
- update_cache = dict(default=False, aliases=['update-cache'], type='bool'), |
|
189 |
- force = dict(default=True, type='bool'), |
|
190 |
- no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'), |
|
191 |
- package = dict(aliases=['pkg', 'name'], required=True))) |
|
186 |
+ argument_spec = dict( |
|
187 |
+ state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), |
|
188 |
+ update_cache = dict(default=False, aliases=['update-cache'], type='bool'), |
|
189 |
+ force = dict(default=True, type='bool'), |
|
190 |
+ no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'), |
|
191 |
+ package = dict(aliases=['pkg', 'name'], required=True))) |
|
192 | 192 |
|
193 | 193 |
|
194 | 194 |
if not os.path.exists(URPMI_PATH): |
... | ... |
@@ -166,13 +166,13 @@ def _delete(module, hookurl, oauthkey, repo, user, hookid): |
166 | 166 |
def main(): |
167 | 167 |
module = AnsibleModule( |
168 | 168 |
argument_spec=dict( |
169 |
- action=dict(required=True, choices=['list','clean504','cleanall','create']), |
|
170 |
- hookurl=dict(required=False), |
|
171 |
- oauthkey=dict(required=True, no_log=True), |
|
172 |
- repo=dict(required=True), |
|
173 |
- user=dict(required=True), |
|
174 |
- validate_certs=dict(default='yes', type='bool'), |
|
175 |
- content_type=dict(default='json', choices=['json', 'form']), |
|
169 |
+ action=dict(required=True, choices=['list','clean504','cleanall','create']), |
|
170 |
+ hookurl=dict(required=False), |
|
171 |
+ oauthkey=dict(required=True, no_log=True), |
|
172 |
+ repo=dict(required=True), |
|
173 |
+ user=dict(required=True), |
|
174 |
+ validate_certs=dict(default='yes', type='bool'), |
|
175 |
+ content_type=dict(default='json', choices=['json', 'form']), |
|
176 | 176 |
) |
177 | 177 |
) |
178 | 178 |
|
... | ... |
@@ -639,15 +639,15 @@ def enforce_state(module, params): |
639 | 639 |
def main(): |
640 | 640 |
module = AnsibleModule( |
641 | 641 |
argument_spec = dict( |
642 |
- user = dict(required=True, type='str'), |
|
643 |
- key = dict(required=True, type='str'), |
|
644 |
- path = dict(required=False, type='str'), |
|
645 |
- manage_dir = dict(required=False, type='bool', default=True), |
|
646 |
- state = dict(default='present', choices=['absent','present']), |
|
647 |
- key_options = dict(required=False, type='str'), |
|
648 |
- unique = dict(default=False, type='bool'), |
|
649 |
- exclusive = dict(default=False, type='bool'), |
|
650 |
- validate_certs = dict(default=True, type='bool'), |
|
642 |
+ user = dict(required=True, type='str'), |
|
643 |
+ key = dict(required=True, type='str'), |
|
644 |
+ path = dict(required=False, type='str'), |
|
645 |
+ manage_dir = dict(required=False, type='bool', default=True), |
|
646 |
+ state = dict(default='present', choices=['absent','present']), |
|
647 |
+ key_options = dict(required=False, type='str'), |
|
648 |
+ unique = dict(default=False, type='bool'), |
|
649 |
+ exclusive = dict(default=False, type='bool'), |
|
650 |
+ validate_certs = dict(default=True, type='bool'), |
|
651 | 651 |
), |
652 | 652 |
supports_check_mode=True |
653 | 653 |
) |
... | ... |
@@ -605,9 +605,9 @@ def main(): |
605 | 605 |
), |
606 | 606 |
supports_check_mode = True, |
607 | 607 |
mutually_exclusive=[ |
608 |
- ['reboot', 'special_time'], |
|
609 |
- ['insertafter', 'insertbefore'], |
|
610 |
- ] |
|
608 |
+ ['reboot', 'special_time'], |
|
609 |
+ ['insertafter', 'insertbefore'], |
|
610 |
+ ] |
|
611 | 611 |
) |
612 | 612 |
|
613 | 613 |
name = module.params['name'] |
... | ... |
@@ -138,11 +138,11 @@ def main(): |
138 | 138 |
|
139 | 139 |
module = AnsibleModule( |
140 | 140 |
argument_spec = dict( |
141 |
- name = dict(required=True, aliases=['pkg'], type='str'), |
|
142 |
- question = dict(required=False, aliases=['setting', 'selection'], type='str'), |
|
143 |
- vtype = dict(required=False, type='str', choices=['string', 'password', 'boolean', 'select', 'multiselect', 'note', 'error', 'title', 'text', 'seen']), |
|
144 |
- value = dict(required=False, type='str', aliases=['answer']), |
|
145 |
- unseen = dict(required=False, type='bool'), |
|
141 |
+ name = dict(required=True, aliases=['pkg'], type='str'), |
|
142 |
+ question = dict(required=False, aliases=['setting', 'selection'], type='str'), |
|
143 |
+ vtype = dict(required=False, type='str', choices=['string', 'password', 'boolean', 'select', 'multiselect', 'note', 'error', 'title', 'text', 'seen']), |
|
144 |
+ value = dict(required=False, type='str', aliases=['answer']), |
|
145 |
+ unseen = dict(required=False, type='bool'), |
|
146 | 146 |
), |
147 | 147 |
required_together = ( ['question','vtype', 'value'],), |
148 | 148 |
supports_check_mode=True, |
... | ... |
@@ -166,21 +166,21 @@ def main(): |
166 | 166 |
# Setup the Ansible module |
167 | 167 |
module = AnsibleModule( |
168 | 168 |
argument_spec=dict( |
169 |
- key=dict(required=True, default=None, type='str'), |
|
170 |
- value_type=dict(required=False, |
|
169 |
+ key=dict(required=True, default=None, type='str'), |
|
170 |
+ value_type=dict(required=False, |
|
171 | 171 |
choices=['int', 'bool', |
172 | 172 |
'float', 'string'], |
173 | 173 |
type='str'), |
174 |
- value=dict(required=False, default=None, |
|
174 |
+ value=dict(required=False, default=None, |
|
175 | 175 |
type='str'), |
176 |
- state=dict(required=True, default=None, |
|
176 |
+ state=dict(required=True, default=None, |
|
177 | 177 |
choices=['present', 'get', 'absent'], |
178 | 178 |
type='str'), |
179 |
- direct=dict(required=False, |
|
179 |
+ direct=dict(required=False, |
|
180 | 180 |
default=False, type='bool'), |
181 |
- config_source=dict(required=False, |
|
181 |
+ config_source=dict(required=False, |
|
182 | 182 |
default=None, type='str') |
183 |
- ), |
|
183 |
+ ), |
|
184 | 184 |
supports_check_mode=True |
185 | 185 |
) |
186 | 186 |
|
... | ... |
@@ -110,11 +110,11 @@ def main(): |
110 | 110 |
# init |
111 | 111 |
module = AnsibleModule( |
112 | 112 |
argument_spec = dict( |
113 |
- name = dict(required=True, type='str', aliases=['service']), |
|
114 |
- state = dict(choices=['started', 'stopped', 'restarted', 'reloaded'], type='str'), |
|
115 |
- enabled = dict(type='bool'), |
|
116 |
- pattern = dict(required=False, default=None), |
|
117 |
- ), |
|
113 |
+ name = dict(required=True, type='str', aliases=['service']), |
|
114 |
+ state = dict(choices=['started', 'stopped', 'restarted', 'reloaded'], type='str'), |
|
115 |
+ enabled = dict(type='bool'), |
|
116 |
+ pattern = dict(required=False, default=None), |
|
117 |
+ ), |
|
118 | 118 |
supports_check_mode=True, |
119 | 119 |
required_one_of=[['state', 'enabled']], |
120 | 120 |
) |
... | ... |
@@ -117,14 +117,14 @@ if HAVE_SEOBJECT: |
117 | 117 |
|
118 | 118 |
### Make backward compatible |
119 | 119 |
option_to_file_type_str = dict( |
120 |
- a = 'all files', |
|
121 |
- b = 'block device', |
|
122 |
- c = 'character device', |
|
123 |
- d = 'directory', |
|
124 |
- f = 'regular file', |
|
125 |
- l = 'symbolic link', |
|
126 |
- p = 'named pipe', |
|
127 |
- s = 'socket file', |
|
120 |
+ a = 'all files', |
|
121 |
+ b = 'block device', |
|
122 |
+ c = 'character device', |
|
123 |
+ d = 'directory', |
|
124 |
+ f = 'regular file', |
|
125 |
+ l = 'symbolic link', |
|
126 |
+ p = 'named pipe', |
|
127 |
+ s = 'socket file', |
|
128 | 128 |
) |
129 | 129 |
|
130 | 130 |
def semanage_fcontext_exists(sefcontext, target, ftype): |
... | ... |
@@ -225,14 +225,14 @@ def semanage_fcontext_delete(module, result, target, ftype, do_reload, sestore=' |
225 | 225 |
def main(): |
226 | 226 |
module = AnsibleModule( |
227 | 227 |
argument_spec = dict( |
228 |
- target = dict(required=True, aliases=['path']), |
|
229 |
- ftype = dict(required=False, choices=option_to_file_type_str.keys(), default='a'), |
|
230 |
- setype = dict(required=True), |
|
231 |
- seuser = dict(required=False, default=None), |
|
232 |
- selevel = dict(required=False, default=None, aliases=['serange']), |
|
233 |
- state = dict(required=False, choices=['present', 'absent'], default='present'), |
|
234 |
- reload = dict(required=False, type='bool', default='yes'), |
|
235 |
- ), |
|
228 |
+ target = dict(required=True, aliases=['path']), |
|
229 |
+ ftype = dict(required=False, choices=option_to_file_type_str.keys(), default='a'), |
|
230 |
+ setype = dict(required=True), |
|
231 |
+ seuser = dict(required=False, default=None), |
|
232 |
+ selevel = dict(required=False, default=None, aliases=['serange']), |
|
233 |
+ state = dict(required=False, choices=['present', 'absent'], default='present'), |
|
234 |
+ reload = dict(required=False, type='bool', default='yes'), |
|
235 |
+ ), |
|
236 | 236 |
supports_check_mode = True, |
237 | 237 |
) |
238 | 238 |
if not HAVE_SELINUX: |
... | ... |
@@ -266,26 +266,26 @@ def semanage_port_del(module, ports, proto, setype, do_reload, sestore=''): |
266 | 266 |
def main(): |
267 | 267 |
module = AnsibleModule( |
268 | 268 |
argument_spec={ |
269 |
- 'ports': { |
|
270 |
- 'required': True, |
|
269 |
+ 'ports': { |
|
270 |
+ 'required': True, |
|
271 | 271 |
}, |
272 |
- 'proto': { |
|
273 |
- 'required': True, |
|
274 |
- 'choices': ['tcp', 'udp'], |
|
272 |
+ 'proto': { |
|
273 |
+ 'required': True, |
|
274 |
+ 'choices': ['tcp', 'udp'], |
|
275 | 275 |
}, |
276 |
- 'setype': { |
|
277 |
- 'required': True, |
|
276 |
+ 'setype': { |
|
277 |
+ 'required': True, |
|
278 | 278 |
}, |
279 |
- 'state': { |
|
280 |
- 'required': True, |
|
281 |
- 'choices': ['present', 'absent'], |
|
279 |
+ 'state': { |
|
280 |
+ 'required': True, |
|
281 |
+ 'choices': ['present', 'absent'], |
|
282 | 282 |
}, |
283 |
- 'reload': { |
|
284 |
- 'required': False, |
|
285 |
- 'type': 'bool', |
|
286 |
- 'default': 'yes', |
|
283 |
+ 'reload': { |
|
284 |
+ 'required': False, |
|
285 |
+ 'type': 'bool', |
|
286 |
+ 'default': 'yes', |
|
287 | 287 |
}, |
288 |
- }, |
|
288 |
+ }, |
|
289 | 289 |
supports_check_mode=True |
290 | 290 |
) |
291 | 291 |
if not HAVE_SELINUX: |
... | ... |
@@ -259,14 +259,14 @@ def main(): |
259 | 259 |
# initialize |
260 | 260 |
module = AnsibleModule( |
261 | 261 |
argument_spec = dict( |
262 |
- name = dict(required=True, type='str', aliases=['unit', 'service']), |
|
263 |
- state = dict(choices=[ 'started', 'stopped', 'restarted', 'reloaded'], type='str'), |
|
264 |
- enabled = dict(type='bool'), |
|
265 |
- masked = dict(type='bool'), |
|
266 |
- daemon_reload = dict(type='bool', default=False, aliases=['daemon-reload']), |
|
267 |
- user = dict(type='bool', default=False), |
|
268 |
- no_block = dict(type='bool', default=False), |
|
269 |
- ), |
|
262 |
+ name = dict(required=True, type='str', aliases=['unit', 'service']), |
|
263 |
+ state = dict(choices=[ 'started', 'stopped', 'restarted', 'reloaded'], type='str'), |
|
264 |
+ enabled = dict(type='bool'), |
|
265 |
+ masked = dict(type='bool'), |
|
266 |
+ daemon_reload = dict(type='bool', default=False, aliases=['daemon-reload']), |
|
267 |
+ user = dict(type='bool', default=False), |
|
268 |
+ no_block = dict(type='bool', default=False), |
|
269 |
+ ), |
|
270 | 270 |
supports_check_mode=True, |
271 | 271 |
required_one_of=[['state', 'enabled', 'masked', 'daemon_reload']], |
272 | 272 |
) |
... | ... |
@@ -2112,10 +2112,10 @@ class HPUX(User): |
2112 | 2112 |
|
2113 | 2113 |
def main(): |
2114 | 2114 |
ssh_defaults = { |
2115 |
- 'bits': 0, |
|
2116 |
- 'type': 'rsa', |
|
2117 |
- 'passphrase': None, |
|
2118 |
- 'comment': 'ansible-generated on %s' % socket.gethostname() |
|
2115 |
+ 'bits': 0, |
|
2116 |
+ 'type': 'rsa', |
|
2117 |
+ 'passphrase': None, |
|
2118 |
+ 'comment': 'ansible-generated on %s' % socket.gethostname() |
|
2119 | 2119 |
} |
2120 | 2120 |
module = AnsibleModule( |
2121 | 2121 |
argument_spec = dict( |
... | ... |
@@ -382,12 +382,12 @@ def _timedelta_total_seconds(timedelta): |
382 | 382 |
|
383 | 383 |
def get_connection_state_id(state): |
384 | 384 |
connection_state_id = { |
385 |
- 'ESTABLISHED': '01', |
|
386 |
- 'SYN_SENT': '02', |
|
387 |
- 'SYN_RECV': '03', |
|
388 |
- 'FIN_WAIT1': '04', |
|
389 |
- 'FIN_WAIT2': '05', |
|
390 |
- 'TIME_WAIT': '06', |
|
385 |
+ 'ESTABLISHED': '01', |
|
386 |
+ 'SYN_SENT': '02', |
|
387 |
+ 'SYN_RECV': '03', |
|
388 |
+ 'FIN_WAIT1': '04', |
|
389 |
+ 'FIN_WAIT2': '05', |
|
390 |
+ 'TIME_WAIT': '06', |
|
391 | 391 |
} |
392 | 392 |
return connection_state_id[state] |
393 | 393 |
|
... | ... |
@@ -120,8 +120,8 @@ def _get_ctl_binary(module): |
120 | 120 |
return ctl_binary |
121 | 121 |
|
122 | 122 |
module.fail_json( |
123 |
- msg="Neither of apache2ctl nor apachctl found." |
|
124 |
- " At least one apache control binary is necessary." |
|
123 |
+ msg="Neither of apache2ctl nor apachctl found." |
|
124 |
+ " At least one apache control binary is necessary." |
|
125 | 125 |
) |
126 | 126 |
|
127 | 127 |
def _module_is_enabled(module): |
... | ... |
@@ -193,15 +193,15 @@ def manage_issue(module, taiga_host, project_name, issue_subject, issue_priority |
193 | 193 |
severity_id = severity_list[0].id |
194 | 194 |
|
195 | 195 |
issue = { |
196 |
- "project": project_name, |
|
197 |
- "subject": issue_subject, |
|
198 |
- "priority": issue_priority, |
|
199 |
- "status": issue_status, |
|
200 |
- "type": issue_type, |
|
201 |
- "severity": issue_severity, |
|
202 |
- "description": issue_description, |
|
203 |
- "tags": issue_tags, |
|
204 |
- } |
|
196 |
+ "project": project_name, |
|
197 |
+ "subject": issue_subject, |
|
198 |
+ "priority": issue_priority, |
|
199 |
+ "status": issue_status, |
|
200 |
+ "type": issue_type, |
|
201 |
+ "severity": issue_severity, |
|
202 |
+ "description": issue_description, |
|
203 |
+ "tags": issue_tags, |
|
204 |
+ } |
|
205 | 205 |
|
206 | 206 |
# An issue is identified by the project_name, the issue_subject and the issue_type |
207 | 207 |
matching_issue_list = filter(lambda x: x.subject == issue_subject and x.type == type_id, project.list_issues()) |
... | ... |
@@ -288,21 +288,21 @@ def main(): |
288 | 288 |
state = module.params['state'] |
289 | 289 |
|
290 | 290 |
return_status, changed, msg, issue_attr_dict = manage_issue( |
291 |
- module, |
|
292 |
- taiga_host, |
|
293 |
- project_name, |
|
294 |
- issue_subject, |
|
295 |
- issue_priority, |
|
296 |
- issue_status, |
|
297 |
- issue_type, |
|
298 |
- issue_severity, |
|
299 |
- issue_description, |
|
300 |
- issue_attachment, |
|
301 |
- issue_attachment_description, |
|
302 |
- issue_tags, |
|
303 |
- state, |
|
304 |
- check_mode=module.check_mode |
|
305 |
- ) |
|
291 |
+ module, |
|
292 |
+ taiga_host, |
|
293 |
+ project_name, |
|
294 |
+ issue_subject, |
|
295 |
+ issue_priority, |
|
296 |
+ issue_status, |
|
297 |
+ issue_type, |
|
298 |
+ issue_severity, |
|
299 |
+ issue_description, |
|
300 |
+ issue_attachment, |
|
301 |
+ issue_attachment_description, |
|
302 |
+ issue_tags, |
|
303 |
+ state, |
|
304 |
+ check_mode=module.check_mode |
|
305 |
+ ) |
|
306 | 306 |
if return_status: |
307 | 307 |
if len(issue_attr_dict) > 0: |
308 | 308 |
module.exit_json(changed=changed, msg=msg, issue=issue_attr_dict) |
... | ... |
@@ -349,8 +349,8 @@ class Block(Base, Become, Conditional, Taggable): |
349 | 349 |
if isinstance(task, Block): |
350 | 350 |
tmp_list.append(evaluate_block(task)) |
351 | 351 |
elif task.action == 'meta' \ |
352 |
- or (task.action == 'include' and task.evaluate_tags([], play_context.skip_tags, all_vars=all_vars)) \ |
|
353 |
- or task.evaluate_tags(play_context.only_tags, play_context.skip_tags, all_vars=all_vars): |
|
352 |
+ or (task.action == 'include' and task.evaluate_tags([], play_context.skip_tags, all_vars=all_vars)) \ |
|
353 |
+ or task.evaluate_tags(play_context.only_tags, play_context.skip_tags, all_vars=all_vars): |
|
354 | 354 |
tmp_list.append(task) |
355 | 355 |
return tmp_list |
356 | 356 |
|
... | ... |
@@ -133,8 +133,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h |
133 | 133 |
is_static = t.static |
134 | 134 |
else: |
135 | 135 |
is_static = C.DEFAULT_TASK_INCLUDES_STATIC or \ |
136 |
- (use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC) or \ |
|
137 |
- (not templar._contains_vars(t.args['_raw_params']) and t.all_parents_static() and not t.loop) |
|
136 |
+ (use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC) or \ |
|
137 |
+ (not templar._contains_vars(t.args['_raw_params']) and t.all_parents_static() and not t.loop) |
|
138 | 138 |
|
139 | 139 |
if is_static: |
140 | 140 |
if t.loop is not None: |
... | ... |
@@ -179,13 +179,13 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h |
179 | 179 |
include_target = templar.template(t.args['_raw_params']) |
180 | 180 |
except AnsibleUndefinedVariable: |
181 | 181 |
raise AnsibleParserError( |
182 |
- "Error when evaluating variable in include name: %s.\n\n" \ |
|
183 |
- "When using static includes, ensure that any variables used in their names are defined in vars/vars_files\n" \ |
|
184 |
- "or extra-vars passed in from the command line. Static includes cannot use variables from inventory\n" \ |
|
185 |
- "sources like group or host vars." % t.args['_raw_params'], |
|
186 |
- obj=task_ds, |
|
187 |
- suppress_extended_error=True, |
|
188 |
- ) |
|
182 |
+ "Error when evaluating variable in include name: %s.\n\n" \ |
|
183 |
+ "When using static includes, ensure that any variables used in their names are defined in vars/vars_files\n" \ |
|
184 |
+ "or extra-vars passed in from the command line. Static includes cannot use variables from inventory\n" \ |
|
185 |
+ "sources like group or host vars." % t.args['_raw_params'], |
|
186 |
+ obj=task_ds, |
|
187 |
+ suppress_extended_error=True, |
|
188 |
+ ) |
|
189 | 189 |
if t._role: |
190 | 190 |
include_file = loader.path_dwim_relative(t._role._role_path, subdir, include_target) |
191 | 191 |
else: |
... | ... |
@@ -269,13 +269,13 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h |
269 | 269 |
elif 'include_role' in task_ds: |
270 | 270 |
|
271 | 271 |
ir = IncludeRole.load( |
272 |
- task_ds, |
|
273 |
- block=block, |
|
274 |
- role=role, |
|
275 |
- task_include=None, |
|
276 |
- variable_manager=variable_manager, |
|
277 |
- loader=loader |
|
278 |
- ) |
|
272 |
+ task_ds, |
|
273 |
+ block=block, |
|
274 |
+ role=role, |
|
275 |
+ task_include=None, |
|
276 |
+ variable_manager=variable_manager, |
|
277 |
+ loader=loader |
|
278 |
+ ) |
|
279 | 279 |
|
280 | 280 |
# 1. the user has set the 'static' option to false or true |
281 | 281 |
# 2. one of the appropriate config options was set |
... | ... |
@@ -51,41 +51,41 @@ except ImportError: |
51 | 51 |
# in variable names. |
52 | 52 |
|
53 | 53 |
MAGIC_VARIABLE_MAPPING = dict( |
54 |
- connection = ('ansible_connection',), |
|
55 |
- remote_addr = ('ansible_ssh_host', 'ansible_host'), |
|
56 |
- remote_user = ('ansible_ssh_user', 'ansible_user'), |
|
57 |
- port = ('ansible_ssh_port', 'ansible_port'), |
|
58 |
- ssh_executable = ('ansible_ssh_executable',), |
|
59 |
- accelerate_port = ('ansible_accelerate_port',), |
|
60 |
- password = ('ansible_ssh_pass', 'ansible_password'), |
|
61 |
- private_key_file = ('ansible_ssh_private_key_file', 'ansible_private_key_file'), |
|
62 |
- pipelining = ('ansible_ssh_pipelining', 'ansible_pipelining'), |
|
63 |
- shell = ('ansible_shell_type',), |
|
64 |
- network_os = ('ansible_network_os',), |
|
65 |
- become = ('ansible_become',), |
|
66 |
- become_method = ('ansible_become_method',), |
|
67 |
- become_user = ('ansible_become_user',), |
|
68 |
- become_pass = ('ansible_become_password','ansible_become_pass'), |
|
69 |
- become_exe = ('ansible_become_exe',), |
|
70 |
- become_flags = ('ansible_become_flags',), |
|
71 |
- ssh_common_args = ('ansible_ssh_common_args',), |
|
72 |
- docker_extra_args= ('ansible_docker_extra_args',), |
|
73 |
- sftp_extra_args = ('ansible_sftp_extra_args',), |
|
74 |
- scp_extra_args = ('ansible_scp_extra_args',), |
|
75 |
- ssh_extra_args = ('ansible_ssh_extra_args',), |
|
76 |
- ssh_transfer_method = ('ansible_ssh_transfer_method',), |
|
77 |
- sudo = ('ansible_sudo',), |
|
78 |
- sudo_user = ('ansible_sudo_user',), |
|
79 |
- sudo_pass = ('ansible_sudo_password', 'ansible_sudo_pass'), |
|
80 |
- sudo_exe = ('ansible_sudo_exe',), |
|
81 |
- sudo_flags = ('ansible_sudo_flags',), |
|
82 |
- su = ('ansible_su',), |
|
83 |
- su_user = ('ansible_su_user',), |
|
84 |
- su_pass = ('ansible_su_password', 'ansible_su_pass'), |
|
85 |
- su_exe = ('ansible_su_exe',), |
|
86 |
- su_flags = ('ansible_su_flags',), |
|
87 |
- executable = ('ansible_shell_executable',), |
|
88 |
- module_compression = ('ansible_module_compression',), |
|
54 |
+ connection = ('ansible_connection',), |
|
55 |
+ remote_addr = ('ansible_ssh_host', 'ansible_host'), |
|
56 |
+ remote_user = ('ansible_ssh_user', 'ansible_user'), |
|
57 |
+ port = ('ansible_ssh_port', 'ansible_port'), |
|
58 |
+ ssh_executable = ('ansible_ssh_executable',), |
|
59 |
+ accelerate_port = ('ansible_accelerate_port',), |
|
60 |
+ password = ('ansible_ssh_pass', 'ansible_password'), |
|
61 |
+ private_key_file = ('ansible_ssh_private_key_file', 'ansible_private_key_file'), |
|
62 |
+ pipelining = ('ansible_ssh_pipelining', 'ansible_pipelining'), |
|
63 |
+ shell = ('ansible_shell_type',), |
|
64 |
+ network_os = ('ansible_network_os',), |
|
65 |
+ become = ('ansible_become',), |
|
66 |
+ become_method = ('ansible_become_method',), |
|
67 |
+ become_user = ('ansible_become_user',), |
|
68 |
+ become_pass = ('ansible_become_password','ansible_become_pass'), |
|
69 |
+ become_exe = ('ansible_become_exe',), |
|
70 |
+ become_flags = ('ansible_become_flags',), |
|
71 |
+ ssh_common_args = ('ansible_ssh_common_args',), |
|
72 |
+ docker_extra_args= ('ansible_docker_extra_args',), |
|
73 |
+ sftp_extra_args = ('ansible_sftp_extra_args',), |
|
74 |
+ scp_extra_args = ('ansible_scp_extra_args',), |
|
75 |
+ ssh_extra_args = ('ansible_ssh_extra_args',), |
|
76 |
+ ssh_transfer_method = ('ansible_ssh_transfer_method',), |
|
77 |
+ sudo = ('ansible_sudo',), |
|
78 |
+ sudo_user = ('ansible_sudo_user',), |
|
79 |
+ sudo_pass = ('ansible_sudo_password', 'ansible_sudo_pass'), |
|
80 |
+ sudo_exe = ('ansible_sudo_exe',), |
|
81 |
+ sudo_flags = ('ansible_sudo_flags',), |
|
82 |
+ su = ('ansible_su',), |
|
83 |
+ su_user = ('ansible_su_user',), |
|
84 |
+ su_pass = ('ansible_su_password', 'ansible_su_pass'), |
|
85 |
+ su_exe = ('ansible_su_exe',), |
|
86 |
+ su_flags = ('ansible_su_flags',), |
|
87 |
+ executable = ('ansible_shell_executable',), |
|
88 |
+ module_compression = ('ansible_module_compression',), |
|
89 | 89 |
) |
90 | 90 |
|
91 | 91 |
b_SU_PROMPT_LOCALIZATIONS = [ |
... | ... |
@@ -441,11 +441,11 @@ class ActionBase(with_metaclass(ABCMeta, object)): |
441 | 441 |
Get information from remote file. |
442 | 442 |
''' |
443 | 443 |
module_args=dict( |
444 |
- path=path, |
|
445 |
- follow=follow, |
|
446 |
- get_md5=False, |
|
447 |
- get_checksum=True, |
|
448 |
- checksum_algo='sha1', |
|
444 |
+ path=path, |
|
445 |
+ follow=follow, |
|
446 |
+ get_md5=False, |
|
447 |
+ get_checksum=True, |
|
448 |
+ checksum_algo='sha1', |
|
449 | 449 |
) |
450 | 450 |
mystat = self._execute_module(module_name='stat', module_args=module_args, task_vars=all_vars, tmp=tmp, delete_remote_tmp=(tmp is None)) |
451 | 451 |
|
... | ... |
@@ -175,12 +175,12 @@ class ActionModule(ActionBase): |
175 | 175 |
|
176 | 176 |
# run the copy module |
177 | 177 |
new_module_args.update( |
178 |
- dict( |
|
179 |
- src=xfered, |
|
180 |
- dest=dest, |
|
181 |
- original_basename=os.path.basename(source), |
|
182 |
- follow=True, |
|
183 |
- ), |
|
178 |
+ dict( |
|
179 |
+ src=xfered, |
|
180 |
+ dest=dest, |
|
181 |
+ original_basename=os.path.basename(source), |
|
182 |
+ follow=True, |
|
183 |
+ ), |
|
184 | 184 |
) |
185 | 185 |
result.update(self._execute_module(module_name='copy', module_args=new_module_args, task_vars=task_vars, tmp=tmp, delete_remote_tmp=False)) |
186 | 186 |
|
... | ... |
@@ -167,9 +167,9 @@ class CallbackModule_dense(CallbackModule_default): |
167 | 167 |
|
168 | 168 |
# Attributes to remove from results for more density |
169 | 169 |
self.removed_attributes = ( |
170 |
-# 'changed', |
|
170 |
+ # 'changed', |
|
171 | 171 |
'delta', |
172 |
-# 'diff', |
|
172 |
+ # 'diff', |
|
173 | 173 |
'end', |
174 | 174 |
'failed', |
175 | 175 |
'failed_when_result', |
... | ... |
@@ -63,8 +63,8 @@ class CallbackModule(CallbackBase): |
63 | 63 |
"/etc/foreman/client_key.pem")) |
64 | 64 |
FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', "1") |
65 | 65 |
FOREMAN_HEADERS = { |
66 |
- "Content-Type": "application/json", |
|
67 |
- "Accept": "application/json" |
|
66 |
+ "Content-Type": "application/json", |
|
67 |
+ "Accept": "application/json" |
|
68 | 68 |
} |
69 | 69 |
TIME_FORMAT = "%Y-%m-%d %H:%M:%S %f" |
70 | 70 |
|
... | ... |
@@ -155,7 +155,7 @@ class CallbackModule(CallbackBase): |
155 | 155 |
"status": status, |
156 | 156 |
"logs": log, |
157 | 157 |
} |
158 |
- } |
|
158 |
+ } |
|
159 | 159 |
# To be changed to /api/v2/config_reports in 1.11. Maybe we |
160 | 160 |
# could make a GET request to get the Foreman version & do |
161 | 161 |
# this automatically. |
... | ... |
@@ -226,7 +226,7 @@ class CallbackModule(CallbackBase): |
226 | 226 |
color = 'ok' |
227 | 227 |
|
228 | 228 |
msg = '{} : ok={}\tchanged={}\tfailed={}\tunreachable={}'.format( |
229 |
- host, s['ok'], s['changed'], s['failures'], s['unreachable']) |
|
229 |
+ host, s['ok'], s['changed'], s['failures'], s['unreachable']) |
|
230 | 230 |
print(colorize(msg, color)) |
231 | 231 |
|
232 | 232 |
def v2_runner_on_skipped(self, result, **kwargs): |
... | ... |
@@ -202,8 +202,8 @@ class Connection(ConnectionBase): |
202 | 202 |
if user: |
203 | 203 |
self._add_args(b_command, |
204 | 204 |
(b"-o", b"User=" + to_bytes(self._play_context.remote_user, errors='surrogate_or_strict')), |
205 |
- u"ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set" |
|
206 |
- ) |
|
205 |
+ u"ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set" |
|
206 |
+ ) |
|
207 | 207 |
|
208 | 208 |
self._add_args(b_command, |
209 | 209 |
(b"-o", b"ConnectTimeout=" + to_bytes(self._play_context.timeout, errors='surrogate_or_strict', nonstring='simplerepr')), |
... | ... |
@@ -262,61 +262,61 @@ def ipaddr(value, query = '', version = False, alias = 'ipaddr'): |
262 | 262 |
''' Check if string is an IP address or network and filter it ''' |
263 | 263 |
|
264 | 264 |
query_func_extra_args = { |
265 |
- '': ('vtype',), |
|
266 |
- '6to4': ('vtype', 'value'), |
|
267 |
- 'cidr_lookup': ('iplist', 'value'), |
|
268 |
- 'int': ('vtype',), |
|
269 |
- 'ipv4': ('value',), |
|
270 |
- 'ipv6': ('value',), |
|
271 |
- 'link-local': ('value',), |
|
272 |
- 'loopback': ('value',), |
|
273 |
- 'lo': ('value',), |
|
274 |
- 'multicast': ('value',), |
|
275 |
- 'private': ('value',), |
|
276 |
- 'public': ('value',), |
|
277 |
- 'unicast': ('value',), |
|
278 |
- 'wrap': ('vtype', 'value'), |
|
279 |
- } |
|
265 |
+ '': ('vtype',), |
|
266 |
+ '6to4': ('vtype', 'value'), |
|
267 |
+ 'cidr_lookup': ('iplist', 'value'), |
|
268 |
+ 'int': ('vtype',), |
|
269 |
+ 'ipv4': ('value',), |
|
270 |
+ 'ipv6': ('value',), |
|
271 |
+ 'link-local': ('value',), |
|
272 |
+ 'loopback': ('value',), |
|
273 |
+ 'lo': ('value',), |
|
274 |
+ 'multicast': ('value',), |
|
275 |
+ 'private': ('value',), |
|
276 |
+ 'public': ('value',), |
|
277 |
+ 'unicast': ('value',), |
|
278 |
+ 'wrap': ('vtype', 'value'), |
|
279 |
+ } |
|
280 | 280 |
query_func_map = { |
281 |
- '': _empty_ipaddr_query, |
|
282 |
- '6to4': _6to4_query, |
|
283 |
- 'address': _ip_query, |
|
284 |
- 'address/prefix': _gateway_query, |
|
285 |
- 'bool': _bool_ipaddr_query, |
|
286 |
- 'broadcast': _broadcast_query, |
|
287 |
- 'cidr': _cidr_query, |
|
288 |
- 'cidr_lookup': _cidr_lookup_query, |
|
289 |
- 'gateway': _gateway_query, |
|
290 |
- 'gw': _gateway_query, |
|
291 |
- 'host': _host_query, |
|
292 |
- 'host/prefix': _gateway_query, |
|
293 |
- 'hostmask': _hostmask_query, |
|
294 |
- 'hostnet': _gateway_query, |
|
295 |
- 'int': _int_query, |
|
296 |
- 'ip': _ip_query, |
|
297 |
- 'ipv4': _ipv4_query, |
|
298 |
- 'ipv6': _ipv6_query, |
|
299 |
- 'link-local': _link_local_query, |
|
300 |
- 'lo': _loopback_query, |
|
301 |
- 'loopback': _loopback_query, |
|
302 |
- 'multicast': _multicast_query, |
|
303 |
- 'net': _net_query, |
|
304 |
- 'netmask': _netmask_query, |
|
305 |
- 'network': _network_query, |
|
306 |
- 'prefix': _prefix_query, |
|
307 |
- 'private': _private_query, |
|
308 |
- 'public': _public_query, |
|
309 |
- 'revdns': _revdns_query, |
|
310 |
- 'router': _gateway_query, |
|
311 |
- 'size': _size_query, |
|
312 |
- 'subnet': _subnet_query, |
|
313 |
- 'type': _type_query, |
|
314 |
- 'unicast': _unicast_query, |
|
315 |
- 'v4': _ipv4_query, |
|
316 |
- 'v6': _ipv6_query, |
|
317 |
- 'version': _version_query, |
|
318 |
- 'wrap': _wrap_query, |
|
319 |
- } |
|
281 |
+ '': _empty_ipaddr_query, |
|
282 |
+ '6to4': _6to4_query, |
|
283 |
+ 'address': _ip_query, |
|
284 |
+ 'address/prefix': _gateway_query, |
|
285 |
+ 'bool': _bool_ipaddr_query, |
|
286 |
+ 'broadcast': _broadcast_query, |
|
287 |
+ 'cidr': _cidr_query, |
|
288 |
+ 'cidr_lookup': _cidr_lookup_query, |
|
289 |
+ 'gateway': _gateway_query, |
|
290 |
+ 'gw': _gateway_query, |
|
291 |
+ 'host': _host_query, |
|
292 |
+ 'host/prefix': _gateway_query, |
|
293 |
+ 'hostmask': _hostmask_query, |
|
294 |
+ 'hostnet': _gateway_query, |
|
295 |
+ 'int': _int_query, |
|
296 |
+ 'ip': _ip_query, |
|
297 |
+ 'ipv4': _ipv4_query, |
|
298 |
+ 'ipv6': _ipv6_query, |
|
299 |
+ 'link-local': _link_local_query, |
|
300 |
+ 'lo': _loopback_query, |
|
301 |
+ 'loopback': _loopback_query, |
|
302 |
+ 'multicast': _multicast_query, |
|
303 |
+ 'net': _net_query, |
|
304 |
+ 'netmask': _netmask_query, |
|
305 |
+ 'network': _network_query, |
|
306 |
+ 'prefix': _prefix_query, |
|
307 |
+ 'private': _private_query, |
|
308 |
+ 'public': _public_query, |
|
309 |
+ 'revdns': _revdns_query, |
|
310 |
+ 'router': _gateway_query, |
|
311 |
+ 'size': _size_query, |
|
312 |
+ 'subnet': _subnet_query, |
|
313 |
+ 'type': _type_query, |
|
314 |
+ 'unicast': _unicast_query, |
|
315 |
+ 'v4': _ipv4_query, |
|
316 |
+ 'v6': _ipv6_query, |
|
317 |
+ 'version': _version_query, |
|
318 |
+ 'wrap': _wrap_query, |
|
319 |
+ } |
|
320 | 320 |
|
321 | 321 |
vtype = None |
322 | 322 |
|
... | ... |
@@ -633,22 +633,22 @@ def hwaddr(value, query = '', alias = 'hwaddr'): |
633 | 633 |
''' Check if string is a HW/MAC address and filter it ''' |
634 | 634 |
|
635 | 635 |
query_func_extra_args = { |
636 |
- '': ('value',), |
|
637 |
- } |
|
636 |
+ '': ('value',), |
|
637 |
+ } |
|
638 | 638 |
query_func_map = { |
639 |
- '': _empty_hwaddr_query, |
|
640 |
- 'bare': _bare_query, |
|
641 |
- 'bool': _bool_hwaddr_query, |
|
642 |
- 'int': _int_hwaddr_query, |
|
643 |
- 'cisco': _cisco_query, |
|
644 |
- 'eui48': _win_query, |
|
645 |
- 'linux': _linux_query, |
|
646 |
- 'pgsql': _postgresql_query, |
|
647 |
- 'postgresql': _postgresql_query, |
|
648 |
- 'psql': _postgresql_query, |
|
649 |
- 'unix': _unix_query, |
|
650 |
- 'win': _win_query, |
|
651 |
- } |
|
639 |
+ '': _empty_hwaddr_query, |
|
640 |
+ 'bare': _bare_query, |
|
641 |
+ 'bool': _bool_hwaddr_query, |
|
642 |
+ 'int': _int_hwaddr_query, |
|
643 |
+ 'cisco': _cisco_query, |
|
644 |
+ 'eui48': _win_query, |
|
645 |
+ 'linux': _linux_query, |
|
646 |
+ 'pgsql': _postgresql_query, |
|
647 |
+ 'postgresql': _postgresql_query, |
|
648 |
+ 'psql': _postgresql_query, |
|
649 |
+ 'unix': _unix_query, |
|
650 |
+ 'win': _win_query, |
|
651 |
+ } |
|
652 | 652 |
|
653 | 653 |
try: |
654 | 654 |
v = netaddr.EUI(value) |
... | ... |
@@ -39,29 +39,29 @@ def make_rdata_dict(rdata): |
39 | 39 |
Note: adding support for RRSIG is hard work. :) |
40 | 40 |
''' |
41 | 41 |
supported_types = { |
42 |
- A : ['address'], |
|
43 |
- AAAA : ['address'], |
|
44 |
- CNAME : ['target'], |
|
45 |
- DNAME : ['target'], |
|
46 |
- DLV : ['algorithm', 'digest_type', 'key_tag', 'digest'], |
|
47 |
- DNSKEY : ['flags', 'algorithm', 'protocol', 'key'], |
|
48 |
- DS : ['algorithm', 'digest_type', 'key_tag', 'digest'], |
|
49 |
- HINFO : ['cpu', 'os'], |
|
50 |
- LOC : ['latitude', 'longitude', 'altitude', 'size', 'horizontal_precision', 'vertical_precision'], |
|
51 |
- MX : ['preference', 'exchange'], |
|
52 |
- NAPTR : ['order', 'preference', 'flags', 'service', 'regexp', 'replacement'], |
|
53 |
- NS : ['target'], |
|
54 |
- NSEC3PARAM : ['algorithm', 'flags', 'iterations', 'salt'], |
|
55 |
- PTR : ['target'], |
|
56 |
- RP : ['mbox', 'txt'], |
|
57 |
- # RRSIG : ['algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'signature'], |
|
58 |
- SOA : ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', 'minimum'], |
|
59 |
- SPF : ['strings'], |
|
60 |
- SRV : ['priority', 'weight', 'port', 'target'], |
|
61 |
- SSHFP : ['algorithm', 'fp_type', 'fingerprint'], |
|
62 |
- TLSA : ['usage', 'selector', 'mtype', 'cert'], |
|
63 |
- TXT : ['strings'], |
|
64 |
- } |
|
42 |
+ A : ['address'], |
|
43 |
+ AAAA : ['address'], |
|
44 |
+ CNAME : ['target'], |
|
45 |
+ DNAME : ['target'], |
|
46 |
+ DLV : ['algorithm', 'digest_type', 'key_tag', 'digest'], |
|
47 |
+ DNSKEY : ['flags', 'algorithm', 'protocol', 'key'], |
|
48 |
+ DS : ['algorithm', 'digest_type', 'key_tag', 'digest'], |
|
49 |
+ HINFO : ['cpu', 'os'], |
|
50 |
+ LOC : ['latitude', 'longitude', 'altitude', 'size', 'horizontal_precision', 'vertical_precision'], |
|
51 |
+ MX : ['preference', 'exchange'], |
|
52 |
+ NAPTR : ['order', 'preference', 'flags', 'service', 'regexp', 'replacement'], |
|
53 |
+ NS : ['target'], |
|
54 |
+ NSEC3PARAM : ['algorithm', 'flags', 'iterations', 'salt'], |
|
55 |
+ PTR : ['target'], |
|
56 |
+ RP : ['mbox', 'txt'], |
|
57 |
+ # RRSIG : ['algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'signature'], |
|
58 |
+ SOA : ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', 'minimum'], |
|
59 |
+ SPF : ['strings'], |
|
60 |
+ SRV : ['priority', 'weight', 'port', 'target'], |
|
61 |
+ SSHFP : ['algorithm', 'fp_type', 'fingerprint'], |
|
62 |
+ TLSA : ['usage', 'selector', 'mtype', 'cert'], |
|
63 |
+ TXT : ['strings'], |
|
64 |
+ } |
|
65 | 65 |
|
66 | 66 |
rd = {} |
67 | 67 |
|
... | ... |
@@ -414,12 +414,12 @@ class Templar: |
414 | 414 |
|
415 | 415 |
elif isinstance(variable, (list, tuple)): |
416 | 416 |
return [self.template( |
417 |
- v, |
|
418 |
- preserve_trailing_newlines=preserve_trailing_newlines, |
|
419 |
- fail_on_undefined=fail_on_undefined, |
|
420 |
- overrides=overrides, |
|
421 |
- disable_lookups=disable_lookups, |
|
422 |
- ) for v in variable] |
|
417 |
+ v, |
|
418 |
+ preserve_trailing_newlines=preserve_trailing_newlines, |
|
419 |
+ fail_on_undefined=fail_on_undefined, |
|
420 |
+ overrides=overrides, |
|
421 |
+ disable_lookups=disable_lookups, |
|
422 |
+ ) for v in variable] |
|
423 | 423 |
elif isinstance(variable, dict): |
424 | 424 |
d = {} |
425 | 425 |
# we don't use iteritems() here to avoid problems if the underlying dict |
... | ... |
@@ -427,12 +427,12 @@ class Templar: |
427 | 427 |
for k in variable.keys(): |
428 | 428 |
if k not in static_vars: |
429 | 429 |
d[k] = self.template( |
430 |
- variable[k], |
|
431 |
- preserve_trailing_newlines=preserve_trailing_newlines, |
|
432 |
- fail_on_undefined=fail_on_undefined, |
|
433 |
- overrides=overrides, |
|
434 |
- disable_lookups=disable_lookups, |
|
435 |
- ) |
|
430 |
+ variable[k], |
|
431 |
+ preserve_trailing_newlines=preserve_trailing_newlines, |
|
432 |
+ fail_on_undefined=fail_on_undefined, |
|
433 |
+ overrides=overrides, |
|
434 |
+ disable_lookups=disable_lookups, |
|
435 |
+ ) |
|
436 | 436 |
else: |
437 | 437 |
d[k] = variable[k] |
438 | 438 |
return d |
... | ... |
@@ -24,7 +24,7 @@ setup(name='ansible', |
24 | 24 |
package_dir={ '': 'lib' }, |
25 | 25 |
packages=find_packages('lib'), |
26 | 26 |
package_data={ |
27 |
- '': ['module_utils/*.ps1', 'modules/windows/*.ps1', 'modules/windows/*.ps1', 'galaxy/data/*/*.*', 'galaxy/data/*/*/*.*', 'galaxy/data/*/tests/inventory'], |
|
27 |
+ '': ['module_utils/*.ps1', 'modules/windows/*.ps1', 'modules/windows/*.ps1', 'galaxy/data/*/*.*', 'galaxy/data/*/*/*.*', 'galaxy/data/*/tests/inventory'], |
|
28 | 28 |
}, |
29 | 29 |
classifiers=[ |
30 | 30 |
'Development Status :: 5 - Production/Stable', |
... | ... |
@@ -42,14 +42,14 @@ setup(name='ansible', |
42 | 42 |
'Topic :: Utilities', |
43 | 43 |
], |
44 | 44 |
scripts=[ |
45 |
- 'bin/ansible', |
|
46 |
- 'bin/ansible-playbook', |
|
47 |
- 'bin/ansible-pull', |
|
48 |
- 'bin/ansible-doc', |
|
49 |
- 'bin/ansible-galaxy', |
|
50 |
- 'bin/ansible-console', |
|
51 |
- 'bin/ansible-connection', |
|
52 |
- 'bin/ansible-vault', |
|
45 |
+ 'bin/ansible', |
|
46 |
+ 'bin/ansible-playbook', |
|
47 |
+ 'bin/ansible-pull', |
|
48 |
+ 'bin/ansible-doc', |
|
49 |
+ 'bin/ansible-galaxy', |
|
50 |
+ 'bin/ansible-console', |
|
51 |
+ 'bin/ansible-connection', |
|
52 |
+ 'bin/ansible-vault', |
|
53 | 53 |
], |
54 | 54 |
data_files=[], |
55 | 55 |
) |
... | ... |
@@ -1,29 +1,17 @@ |
1 | 1 |
contrib/inventory/abiquo.py |
2 |
-contrib/inventory/azure_rm.py |
|
3 |
-contrib/inventory/cloudstack.py |
|
4 | 2 |
contrib/inventory/consul_io.py |
5 | 3 |
contrib/inventory/digital_ocean.py |
6 | 4 |
contrib/inventory/docker.py |
7 | 5 |
contrib/inventory/ec2.py |
8 |
-contrib/inventory/gce.py |
|
9 | 6 |
contrib/inventory/mdt_dynamic_inventory.py |
10 | 7 |
contrib/inventory/openvz.py |
11 | 8 |
contrib/inventory/rax.py |
12 | 9 |
contrib/inventory/softlayer.py |
13 |
-contrib/inventory/ssh_config.py |
|
14 | 10 |
contrib/inventory/vbox.py |
15 | 11 |
contrib/inventory/zone.py |
16 |
-docs/api/conf.py |
|
17 |
-docs/docsite/conf.py |
|
18 |
-docs/docsite/rst/conf.py |
|
19 |
-docs/docsite/rst/dev_guide/conf.py |
|
20 |
-examples/scripts/uptime.py |
|
21 | 12 |
hacking/metadata-tool.py |
22 | 13 |
hacking/module_formatter.py |
23 |
-hacking/tests/gen_distribution_version_testcase.py |
|
24 | 14 |
lib/ansible/cli/__init__.py |
25 |
-lib/ansible/cli/adhoc.py |
|
26 |
-lib/ansible/cli/console.py |
|
27 | 15 |
lib/ansible/cli/galaxy.py |
28 | 16 |
lib/ansible/cli/playbook.py |
29 | 17 |
lib/ansible/compat/six/__init__.py |
... | ... |
@@ -42,11 +30,8 @@ lib/ansible/module_utils/ec2.py |
42 | 42 |
lib/ansible/module_utils/eos.py |
43 | 43 |
lib/ansible/module_utils/f5.py |
44 | 44 |
lib/ansible/module_utils/facts.py |
45 |
-lib/ansible/module_utils/gcp.py |
|
46 | 45 |
lib/ansible/module_utils/known_hosts.py |
47 | 46 |
lib/ansible/module_utils/mysql.py |
48 |
-lib/ansible/module_utils/nxos.py |
|
49 |
-lib/ansible/module_utils/redhat.py |
|
50 | 47 |
lib/ansible/module_utils/vmware.py |
51 | 48 |
lib/ansible/modules/cloud/amazon/_ec2_vpc.py |
52 | 49 |
lib/ansible/modules/cloud/amazon/aws_kms.py |
... | ... |
@@ -58,19 +43,15 @@ lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py |
58 | 58 |
lib/ansible/modules/cloud/amazon/dynamodb_table.py |
59 | 59 |
lib/ansible/modules/cloud/amazon/ec2.py |
60 | 60 |
lib/ansible/modules/cloud/amazon/ec2_ami.py |
61 |
-lib/ansible/modules/cloud/amazon/ec2_ami_copy.py |
|
62 | 61 |
lib/ansible/modules/cloud/amazon/ec2_ami_find.py |
63 | 62 |
lib/ansible/modules/cloud/amazon/ec2_asg.py |
64 | 63 |
lib/ansible/modules/cloud/amazon/ec2_asg_facts.py |
65 | 64 |
lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py |
66 | 65 |
lib/ansible/modules/cloud/amazon/ec2_elb.py |
67 |
-lib/ansible/modules/cloud/amazon/ec2_elb_facts.py |
|
68 | 66 |
lib/ansible/modules/cloud/amazon/ec2_elb_lb.py |
69 | 67 |
lib/ansible/modules/cloud/amazon/ec2_eni.py |
70 | 68 |
lib/ansible/modules/cloud/amazon/ec2_eni_facts.py |
71 |
-lib/ansible/modules/cloud/amazon/ec2_facts.py |
|
72 | 69 |
lib/ansible/modules/cloud/amazon/ec2_group.py |
73 |
-lib/ansible/modules/cloud/amazon/ec2_key.py |
|
74 | 70 |
lib/ansible/modules/cloud/amazon/ec2_lc.py |
75 | 71 |
lib/ansible/modules/cloud/amazon/ec2_lc_facts.py |
76 | 72 |
lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py |
... | ... |
@@ -87,7 +68,6 @@ lib/ansible/modules/cloud/amazon/ec2_vpc_net.py |
87 | 87 |
lib/ansible/modules/cloud/amazon/ec2_vpc_net_facts.py |
88 | 88 |
lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py |
89 | 89 |
lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py |
90 |
-lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py |
|
91 | 90 |
lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py |
92 | 91 |
lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py |
93 | 92 |
lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py |
... | ... |
@@ -97,7 +77,6 @@ lib/ansible/modules/cloud/amazon/ecs_service_facts.py |
97 | 97 |
lib/ansible/modules/cloud/amazon/ecs_task.py |
98 | 98 |
lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py |
99 | 99 |
lib/ansible/modules/cloud/amazon/elasticache.py |
100 |
-lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py |
|
101 | 100 |
lib/ansible/modules/cloud/amazon/iam.py |
102 | 101 |
lib/ansible/modules/cloud/amazon/iam_cert.py |
103 | 102 |
lib/ansible/modules/cloud/amazon/iam_policy.py |
... | ... |
@@ -109,7 +88,6 @@ lib/ansible/modules/cloud/amazon/rds_subnet_group.py |
109 | 109 |
lib/ansible/modules/cloud/amazon/redshift.py |
110 | 110 |
lib/ansible/modules/cloud/amazon/route53.py |
111 | 111 |
lib/ansible/modules/cloud/amazon/route53_health_check.py |
112 |
-lib/ansible/modules/cloud/amazon/route53_zone.py |
|
113 | 112 |
lib/ansible/modules/cloud/amazon/s3.py |
114 | 113 |
lib/ansible/modules/cloud/amazon/s3_bucket.py |
115 | 114 |
lib/ansible/modules/cloud/amazon/s3_lifecycle.py |
... | ... |
@@ -118,8 +96,6 @@ lib/ansible/modules/cloud/amazon/s3_website.py |
118 | 118 |
lib/ansible/modules/cloud/amazon/sns_topic.py |
119 | 119 |
lib/ansible/modules/cloud/amazon/sts_assume_role.py |
120 | 120 |
lib/ansible/modules/cloud/amazon/sts_session_token.py |
121 |
-lib/ansible/modules/cloud/atomic/atomic_host.py |
|
122 |
-lib/ansible/modules/cloud/atomic/atomic_image.py |
|
123 | 121 |
lib/ansible/modules/cloud/azure/azure.py |
124 | 122 |
lib/ansible/modules/cloud/azure/azure_rm_deployment.py |
125 | 123 |
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py |
... | ... |
@@ -135,46 +111,26 @@ lib/ansible/modules/cloud/cloudstack/cs_host.py |
135 | 135 |
lib/ansible/modules/cloud/cloudstack/cs_instance.py |
136 | 136 |
lib/ansible/modules/cloud/cloudstack/cs_iso.py |
137 | 137 |
lib/ansible/modules/cloud/cloudstack/cs_portforward.py |
138 |
-lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py |
|
139 | 138 |
lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py |
140 | 139 |
lib/ansible/modules/cloud/digital_ocean/digital_ocean.py |
141 | 140 |
lib/ansible/modules/cloud/docker/_docker.py |
142 |
-lib/ansible/modules/cloud/docker/docker_container.py |
|
143 | 141 |
lib/ansible/modules/cloud/docker/docker_image.py |
144 | 142 |
lib/ansible/modules/cloud/docker/docker_service.py |
145 | 143 |
lib/ansible/modules/cloud/google/gc_storage.py |
146 | 144 |
lib/ansible/modules/cloud/google/gce_img.py |
147 |
-lib/ansible/modules/cloud/google/gce_lb.py |
|
148 |
-lib/ansible/modules/cloud/google/gce_mig.py |
|
149 | 145 |
lib/ansible/modules/cloud/google/gce_net.py |
150 |
-lib/ansible/modules/cloud/google/gce_pd.py |
|
151 | 146 |
lib/ansible/modules/cloud/google/gce_tag.py |
152 | 147 |
lib/ansible/modules/cloud/google/gcpubsub.py |
153 | 148 |
lib/ansible/modules/cloud/google/gcpubsub_facts.py |
154 |
-lib/ansible/modules/cloud/linode/linode.py |
|
155 | 149 |
lib/ansible/modules/cloud/misc/ovirt.py |
156 | 150 |
lib/ansible/modules/cloud/misc/proxmox.py |
157 | 151 |
lib/ansible/modules/cloud/misc/proxmox_kvm.py |
158 | 152 |
lib/ansible/modules/cloud/misc/proxmox_template.py |
159 | 153 |
lib/ansible/modules/cloud/misc/serverless.py |
160 |
-lib/ansible/modules/cloud/misc/virt.py |
|
161 | 154 |
lib/ansible/modules/cloud/misc/xenserver_facts.py |
162 |
-lib/ansible/modules/cloud/openstack/_glance_image.py |
|
163 |
-lib/ansible/modules/cloud/openstack/_keystone_user.py |
|
164 | 155 |
lib/ansible/modules/cloud/openstack/_nova_compute.py |
165 |
-lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py |
|
166 |
-lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py |
|
167 |
-lib/ansible/modules/cloud/openstack/_quantum_network.py |
|
168 |
-lib/ansible/modules/cloud/openstack/_quantum_router.py |
|
169 |
-lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py |
|
170 |
-lib/ansible/modules/cloud/openstack/_quantum_router_interface.py |
|
171 |
-lib/ansible/modules/cloud/openstack/_quantum_subnet.py |
|
172 |
-lib/ansible/modules/cloud/openstack/os_auth.py |
|
173 | 156 |
lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py |
174 | 157 |
lib/ansible/modules/cloud/openstack/os_object.py |
175 |
-lib/ansible/modules/cloud/openstack/os_quota.py |
|
176 |
-lib/ansible/modules/cloud/openstack/os_recordset.py |
|
177 |
-lib/ansible/modules/cloud/openstack/os_zone.py |
|
178 | 158 |
lib/ansible/modules/cloud/packet/packet_device.py |
179 | 159 |
lib/ansible/modules/cloud/packet/packet_sshkey.py |
180 | 160 |
lib/ansible/modules/cloud/profitbricks/profitbricks.py |
... | ... |
@@ -182,7 +138,6 @@ lib/ansible/modules/cloud/profitbricks/profitbricks_datacenter.py |
182 | 182 |
lib/ansible/modules/cloud/softlayer/sl_vm.py |
183 | 183 |
lib/ansible/modules/cloud/vmware/vca_fw.py |
184 | 184 |
lib/ansible/modules/cloud/vmware/vmware_guest.py |
185 |
-lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py |
|
186 | 185 |
lib/ansible/modules/cloud/vmware/vsphere_guest.py |
187 | 186 |
lib/ansible/modules/cloud/webfaction/webfaction_app.py |
188 | 187 |
lib/ansible/modules/cloud/webfaction/webfaction_db.py |
... | ... |
@@ -190,17 +145,11 @@ lib/ansible/modules/cloud/webfaction/webfaction_domain.py |
190 | 190 |
lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py |
191 | 191 |
lib/ansible/modules/cloud/webfaction/webfaction_site.py |
192 | 192 |
lib/ansible/modules/clustering/consul.py |
193 |
-lib/ansible/modules/clustering/consul_acl.py |
|
194 |
-lib/ansible/modules/clustering/consul_kv.py |
|
195 |
-lib/ansible/modules/clustering/consul_session.py |
|
196 |
-lib/ansible/modules/commands/command.py |
|
197 | 193 |
lib/ansible/modules/commands/script.py |
198 | 194 |
lib/ansible/modules/crypto/openssl_publickey.py |
199 | 195 |
lib/ansible/modules/database/influxdb/influxdb_retention_policy.py |
200 | 196 |
lib/ansible/modules/database/misc/mongodb_parameter.py |
201 | 197 |
lib/ansible/modules/database/misc/mongodb_user.py |
202 |
-lib/ansible/modules/database/misc/redis.py |
|
203 |
-lib/ansible/modules/database/misc/riak.py |
|
204 | 198 |
lib/ansible/modules/database/mssql/mssql_db.py |
205 | 199 |
lib/ansible/modules/database/mysql/mysql_db.py |
206 | 200 |
lib/ansible/modules/database/mysql/mysql_replication.py |
... | ... |
@@ -219,25 +168,17 @@ lib/ansible/modules/files/archive.py |
219 | 219 |
lib/ansible/modules/files/copy.py |
220 | 220 |
lib/ansible/modules/files/find.py |
221 | 221 |
lib/ansible/modules/files/ini_file.py |
222 |
-lib/ansible/modules/files/lineinfile.py |
|
223 |
-lib/ansible/modules/files/stat.py |
|
224 | 222 |
lib/ansible/modules/files/synchronize.py |
225 | 223 |
lib/ansible/modules/files/tempfile.py |
226 | 224 |
lib/ansible/modules/files/unarchive.py |
227 |
-lib/ansible/modules/messaging/rabbitmq_binding.py |
|
228 |
-lib/ansible/modules/messaging/rabbitmq_exchange.py |
|
229 | 225 |
lib/ansible/modules/messaging/rabbitmq_queue.py |
230 | 226 |
lib/ansible/modules/monitoring/boundary_meter.py |
231 | 227 |
lib/ansible/modules/monitoring/datadog_monitor.py |
232 | 228 |
lib/ansible/modules/monitoring/librato_annotation.py |
233 | 229 |
lib/ansible/modules/monitoring/logicmonitor.py |
234 |
-lib/ansible/modules/monitoring/logicmonitor_facts.py |
|
235 | 230 |
lib/ansible/modules/monitoring/nagios.py |
236 |
-lib/ansible/modules/monitoring/pagerduty.py |
|
237 | 231 |
lib/ansible/modules/monitoring/pagerduty_alert.py |
238 |
-lib/ansible/modules/monitoring/pingdom.py |
|
239 | 232 |
lib/ansible/modules/monitoring/sensu_check.py |
240 |
-lib/ansible/modules/monitoring/statusio_maintenance.py |
|
241 | 233 |
lib/ansible/modules/monitoring/zabbix_screen.py |
242 | 234 |
lib/ansible/modules/network/a10/a10_server.py |
243 | 235 |
lib/ansible/modules/network/a10/a10_server_axapi3.py |
... | ... |
@@ -321,28 +262,20 @@ lib/ansible/modules/network/snmp_facts.py |
321 | 321 |
lib/ansible/modules/notification/hall.py |
322 | 322 |
lib/ansible/modules/notification/sendgrid.py |
323 | 323 |
lib/ansible/modules/notification/sns.py |
324 |
-lib/ansible/modules/packaging/language/bundler.py |
|
325 | 324 |
lib/ansible/modules/packaging/language/composer.py |
326 | 325 |
lib/ansible/modules/packaging/language/cpanm.py |
327 | 326 |
lib/ansible/modules/packaging/language/maven_artifact.py |
328 | 327 |
lib/ansible/modules/packaging/os/apt.py |
329 | 328 |
lib/ansible/modules/packaging/os/apt_key.py |
330 |
-lib/ansible/modules/packaging/os/apt_rpm.py |
|
331 | 329 |
lib/ansible/modules/packaging/os/dnf.py |
332 | 330 |
lib/ansible/modules/packaging/os/dpkg_selections.py |
333 | 331 |
lib/ansible/modules/packaging/os/homebrew.py |
334 | 332 |
lib/ansible/modules/packaging/os/openbsd_pkg.py |
335 | 333 |
lib/ansible/modules/packaging/os/opkg.py |
336 | 334 |
lib/ansible/modules/packaging/os/pacman.py |
337 |
-lib/ansible/modules/packaging/os/pkgin.py |
|
338 |
-lib/ansible/modules/packaging/os/pkgng.py |
|
339 |
-lib/ansible/modules/packaging/os/portinstall.py |
|
340 | 335 |
lib/ansible/modules/packaging/os/redhat_subscription.py |
341 |
-lib/ansible/modules/packaging/os/rhn_channel.py |
|
342 | 336 |
lib/ansible/modules/packaging/os/rhn_register.py |
343 |
-lib/ansible/modules/packaging/os/rpm_key.py |
|
344 | 337 |
lib/ansible/modules/packaging/os/swdepot.py |
345 |
-lib/ansible/modules/packaging/os/urpmi.py |
|
346 | 338 |
lib/ansible/modules/packaging/os/yum.py |
347 | 339 |
lib/ansible/modules/packaging/os/zypper.py |
348 | 340 |
lib/ansible/modules/remote_management/foreman/katello.py |
... | ... |
@@ -357,21 +290,15 @@ lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py |
357 | 357 |
lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py |
358 | 358 |
lib/ansible/modules/storage/netapp/netapp_e_storage_system.py |
359 | 359 |
lib/ansible/modules/storage/netapp/netapp_e_storagepool.py |
360 |
-lib/ansible/modules/system/authorized_key.py |
|
361 |
-lib/ansible/modules/system/cron.py |
|
362 | 360 |
lib/ansible/modules/system/debconf.py |
363 | 361 |
lib/ansible/modules/system/filesystem.py |
364 | 362 |
lib/ansible/modules/system/firewalld.py |
365 |
-lib/ansible/modules/system/gconftool2.py |
|
366 | 363 |
lib/ansible/modules/system/gluster_volume.py |
367 | 364 |
lib/ansible/modules/system/group.py |
368 | 365 |
lib/ansible/modules/system/known_hosts.py |
369 | 366 |
lib/ansible/modules/system/locale_gen.py |
370 | 367 |
lib/ansible/modules/system/lvol.py |
371 |
-lib/ansible/modules/system/openwrt_init.py |
|
372 | 368 |
lib/ansible/modules/system/pam_limits.py |
373 |
-lib/ansible/modules/system/sefcontext.py |
|
374 |
-lib/ansible/modules/system/seport.py |
|
375 | 369 |
lib/ansible/modules/system/solaris_zone.py |
376 | 370 |
lib/ansible/modules/system/systemd.py |
377 | 371 |
lib/ansible/modules/system/ufw.py |
... | ... |
@@ -384,12 +311,10 @@ lib/ansible/modules/utilities/logic/pause.py |
384 | 384 |
lib/ansible/modules/utilities/logic/set_fact.py |
385 | 385 |
lib/ansible/modules/utilities/logic/wait_for.py |
386 | 386 |
lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py |
387 |
-lib/ansible/modules/web_infrastructure/apache2_module.py |
|
388 | 387 |
lib/ansible/modules/web_infrastructure/django_manage.py |
389 | 388 |
lib/ansible/modules/web_infrastructure/jenkins_job.py |
390 | 389 |
lib/ansible/modules/web_infrastructure/jira.py |
391 | 390 |
lib/ansible/modules/web_infrastructure/nginx_status_facts.py |
392 |
-lib/ansible/modules/web_infrastructure/taiga_issue.py |
|
393 | 391 |
lib/ansible/modules/windows/win_acl.py |
394 | 392 |
lib/ansible/modules/windows/win_acl_inheritance.py |
395 | 393 |
lib/ansible/modules/windows/win_chocolatey.py |
... | ... |
@@ -411,7 +336,6 @@ lib/ansible/modules/windows/win_webpicmd.py |
411 | 411 |
lib/ansible/parsing/mod_args.py |
412 | 412 |
lib/ansible/playbook/attribute.py |
413 | 413 |
lib/ansible/playbook/block.py |
414 |
-lib/ansible/playbook/helpers.py |
|
415 | 414 |
lib/ansible/playbook/play_context.py |
416 | 415 |
lib/ansible/playbook/playbook_include.py |
417 | 416 |
lib/ansible/playbook/role/__init__.py |
... | ... |
@@ -423,14 +347,10 @@ lib/ansible/plugins/action/async.py |
423 | 423 |
lib/ansible/plugins/action/set_fact.py |
424 | 424 |
lib/ansible/plugins/action/set_stats.py |
425 | 425 |
lib/ansible/plugins/action/synchronize.py |
426 |
-lib/ansible/plugins/action/template.py |
|
427 | 426 |
lib/ansible/plugins/cache/jsonfile.py |
428 | 427 |
lib/ansible/plugins/callback/default.py |
429 |
-lib/ansible/plugins/callback/dense.py |
|
430 |
-lib/ansible/plugins/callback/foreman.py |
|
431 | 428 |
lib/ansible/plugins/callback/logentries.py |
432 | 429 |
lib/ansible/plugins/callback/oneline.py |
433 |
-lib/ansible/plugins/callback/selective.py |
|
434 | 430 |
lib/ansible/plugins/connection/accelerate.py |
435 | 431 |
lib/ansible/plugins/connection/paramiko_ssh.py |
436 | 432 |
lib/ansible/plugins/connection/ssh.py |
... | ... |
@@ -466,26 +386,9 @@ test/units/errors/test_errors.py |
466 | 466 |
test/units/executor/test_playbook_executor.py |
467 | 467 |
test/units/mock/yaml_helper.py |
468 | 468 |
test/units/module_utils/basic/test__log_invocation.py |
469 |
-test/units/module_utils/basic/test_exit_json.py |
|
470 |
-test/units/module_utils/basic/test_log.py |
|
471 |
-test/units/module_utils/basic/test_no_log.py |
|
472 |
-test/units/module_utils/basic/test_safe_eval.py |
|
473 |
-test/units/module_utils/basic/test_set_mode_if_different.py |
|
474 |
-test/units/module_utils/json_utils/test_filter_non_json_lines.py |
|
475 | 469 |
test/units/module_utils/test_basic.py |
476 | 470 |
test/units/module_utils/test_distribution_version.py |
477 | 471 |
test/units/module_utils/test_facts.py |
478 |
-test/units/module_utils/test_text.py |
|
479 |
-test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py |
|
480 |
-test/units/parsing/test_mod_args.py |
|
481 | 472 |
test/units/parsing/yaml/test_loader.py |
482 |
-test/units/playbook/test_block.py |
|
483 | 473 |
test/units/playbook/test_helpers.py |
484 | 474 |
test/units/playbook/test_play_context.py |
485 |
-test/units/playbook/test_task.py |
|
486 |
-test/units/plugins/lookup/test_ini.py |
|
487 |
-test/units/plugins/lookup/test_password.py |
|
488 |
-test/units/template/test_templar.py |
|
489 |
-test/units/template/test_template_utilities.py |
|
490 |
-test/units/utils/test_vars.py |
|
491 |
-test/units/vars/test_variable_manager.py |
... | ... |
@@ -92,28 +92,28 @@ class TestAnsibleModuleExitJson(unittest.TestCase): |
92 | 92 |
class TestAnsibleModuleExitValuesRemoved(unittest.TestCase): |
93 | 93 |
OMIT = 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' |
94 | 94 |
dataset = ( |
95 |
- (dict(username='person', password='$ecret k3y'), |
|
95 |
+ (dict(username='person', password='$ecret k3y'), |
|
96 | 96 |
dict(one=1, pwd='$ecret k3y', url='https://username:password12345@foo.com/login/', |
97 | 97 |
not_secret='following the leader', msg='here'), |
98 | 98 |
dict(one=1, pwd=OMIT, url='https://username:password12345@foo.com/login/', |
99 | 99 |
not_secret='following the leader', changed=False, msg='here', |
100 | 100 |
invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), |
101 | 101 |
), |
102 |
- (dict(username='person', password='password12345'), |
|
102 |
+ (dict(username='person', password='password12345'), |
|
103 | 103 |
dict(one=1, pwd='$ecret k3y', url='https://username:password12345@foo.com/login/', |
104 | 104 |
not_secret='following the leader', msg='here'), |
105 | 105 |
dict(one=1, pwd='$ecret k3y', url='https://username:********@foo.com/login/', |
106 | 106 |
not_secret='following the leader', changed=False, msg='here', |
107 | 107 |
invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), |
108 | 108 |
), |
109 |
- (dict(username='person', password='$ecret k3y'), |
|
109 |
+ (dict(username='person', password='$ecret k3y'), |
|
110 | 110 |
dict(one=1, pwd='$ecret k3y', url='https://username:$ecret k3y@foo.com/login/', |
111 | 111 |
not_secret='following the leader', msg='here'), |
112 | 112 |
dict(one=1, pwd=OMIT, url='https://username:********@foo.com/login/', |
113 | 113 |
not_secret='following the leader', changed=False, msg='here', |
114 | 114 |
invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), |
115 | 115 |
), |
116 |
- ) |
|
116 |
+ ) |
|
117 | 117 |
|
118 | 118 |
def test_exit_json_removes_values(self): |
119 | 119 |
self.maxDiff = None |
... | ... |
@@ -115,20 +115,20 @@ class TestAnsibleModuleLogSyslog(unittest.TestCase): |
115 | 115 |
"""Test the AnsibleModule Log Method""" |
116 | 116 |
|
117 | 117 |
py2_output_data = { |
118 |
- u'Text string': b'Text string', |
|
119 |
- u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test'.encode('utf-8'), |
|
120 |
- b'Byte string': b'Byte string', |
|
121 |
- u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test'.encode('utf-8'), |
|
122 |
- b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace').encode('utf-8'), |
|
123 |
- } |
|
118 |
+ u'Text string': b'Text string', |
|
119 |
+ u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test'.encode('utf-8'), |
|
120 |
+ b'Byte string': b'Byte string', |
|
121 |
+ u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test'.encode('utf-8'), |
|
122 |
+ b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace').encode('utf-8'), |
|
123 |
+ } |
|
124 | 124 |
|
125 | 125 |
py3_output_data = { |
126 |
- u'Text string': u'Text string', |
|
127 |
- u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', |
|
128 |
- b'Byte string': u'Byte string', |
|
129 |
- u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', |
|
130 |
- b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') |
|
131 |
- } |
|
126 |
+ u'Text string': u'Text string', |
|
127 |
+ u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', |
|
128 |
+ b'Byte string': u'Byte string', |
|
129 |
+ u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', |
|
130 |
+ b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') |
|
131 |
+ } |
|
132 | 132 |
|
133 | 133 |
def setUp(self): |
134 | 134 |
args = json.dumps(dict(ANSIBLE_MODULE_ARGS={})) |
... | ... |
@@ -184,12 +184,12 @@ class TestAnsibleModuleLogJournal(unittest.TestCase): |
184 | 184 |
"""Test the AnsibleModule Log Method""" |
185 | 185 |
|
186 | 186 |
output_data = { |
187 |
- u'Text string': u'Text string', |
|
188 |
- u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', |
|
189 |
- b'Byte string': u'Byte string', |
|
190 |
- u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', |
|
191 |
- b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') |
|
192 |
- } |
|
187 |
+ u'Text string': u'Text string', |
|
188 |
+ u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', |
|
189 |
+ b'Byte string': u'Byte string', |
|
190 |
+ u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', |
|
191 |
+ b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') |
|
192 |
+ } |
|
193 | 193 |
|
194 | 194 |
# overriding run lets us use context managers for setup/teardown-esque behavior |
195 | 195 |
def setUp(self): |
... | ... |
@@ -34,21 +34,21 @@ from ansible.module_utils.basic import return_values, remove_values |
34 | 34 |
|
35 | 35 |
class TestReturnValues(unittest.TestCase): |
36 | 36 |
dataset = ( |
37 |
- ('string', frozenset(['string'])), |
|
38 |
- ('', frozenset()), |
|
39 |
- (1, frozenset(['1'])), |
|
40 |
- (1.0, frozenset(['1.0'])), |
|
41 |
- (False, frozenset()), |
|
42 |
- (['1', '2', '3'], frozenset(['1', '2', '3'])), |
|
43 |
- (('1', '2', '3'), frozenset(['1', '2', '3'])), |
|
44 |
- ({'one': 1, 'two': 'dos'}, frozenset(['1', 'dos'])), |
|
45 |
- ({'one': 1, 'two': 'dos', |
|
37 |
+ ('string', frozenset(['string'])), |
|
38 |
+ ('', frozenset()), |
|
39 |
+ (1, frozenset(['1'])), |
|
40 |
+ (1.0, frozenset(['1.0'])), |
|
41 |
+ (False, frozenset()), |
|
42 |
+ (['1', '2', '3'], frozenset(['1', '2', '3'])), |
|
43 |
+ (('1', '2', '3'), frozenset(['1', '2', '3'])), |
|
44 |
+ ({'one': 1, 'two': 'dos'}, frozenset(['1', 'dos'])), |
|
45 |
+ ({'one': 1, 'two': 'dos', |
|
46 | 46 |
'three': ['amigos', 'musketeers', None, |
47 | 47 |
{'ping': 'pong', 'base': ('balls', 'raquets')}]}, |
48 | 48 |
frozenset(['1', 'dos', 'amigos', 'musketeers', 'pong', 'balls', 'raquets'])), |
49 |
- (u'Toshio くらとみ', frozenset(['Toshio くらとみ'])), |
|
50 |
- ('Toshio くらとみ', frozenset(['Toshio くらとみ'])), |
|
51 |
- ) |
|
49 |
+ (u'Toshio くらとみ', frozenset(['Toshio くらとみ'])), |
|
50 |
+ ('Toshio くらとみ', frozenset(['Toshio くらとみ'])), |
|
51 |
+ ) |
|
52 | 52 |
|
53 | 53 |
def test_return_values(self): |
54 | 54 |
for data, expected in self.dataset: |
... | ... |
@@ -61,46 +61,46 @@ class TestReturnValues(unittest.TestCase): |
61 | 61 |
class TestRemoveValues(unittest.TestCase): |
62 | 62 |
OMIT = 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' |
63 | 63 |
dataset_no_remove = ( |
64 |
- ('string', frozenset(['nope'])), |
|
65 |
- (1234, frozenset(['4321'])), |
|
66 |
- (False, frozenset(['4321'])), |
|
67 |
- (1.0, frozenset(['4321'])), |
|
68 |
- (['string', 'strang', 'strung'], frozenset(['nope'])), |
|
69 |
- ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['nope'])), |
|
70 |
- ({'one': 1, 'two': 'dos', |
|
64 |
+ ('string', frozenset(['nope'])), |
|
65 |
+ (1234, frozenset(['4321'])), |
|
66 |
+ (False, frozenset(['4321'])), |
|
67 |
+ (1.0, frozenset(['4321'])), |
|
68 |
+ (['string', 'strang', 'strung'], frozenset(['nope'])), |
|
69 |
+ ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['nope'])), |
|
70 |
+ ({'one': 1, 'two': 'dos', |
|
71 | 71 |
'three': ['amigos', 'musketeers', None, |
72 | 72 |
{'ping': 'pong', 'base': ['balls', 'raquets']}]}, |
73 | 73 |
frozenset(['nope'])), |
74 |
- ('Toshio くら', frozenset(['とみ'])), |
|
75 |
- (u'Toshio くら', frozenset(['とみ'])), |
|
76 |
- ) |
|
74 |
+ ('Toshio くら', frozenset(['とみ'])), |
|
75 |
+ (u'Toshio くら', frozenset(['とみ'])), |
|
76 |
+ ) |
|
77 | 77 |
dataset_remove = ( |
78 |
- ('string', frozenset(['string']), OMIT), |
|
79 |
- (1234, frozenset(['1234']), OMIT), |
|
80 |
- (1234, frozenset(['23']), OMIT), |
|
81 |
- (1.0, frozenset(['1.0']), OMIT), |
|
82 |
- (['string', 'strang', 'strung'], frozenset(['strang']), ['string', OMIT, 'strung']), |
|
83 |
- (['string', 'strang', 'strung'], frozenset(['strang', 'string', 'strung']), [OMIT, OMIT, OMIT]), |
|
84 |
- (('string', 'strang', 'strung'), frozenset(['string', 'strung']), [OMIT, 'strang', OMIT]), |
|
85 |
- ((1234567890, 345678, 987654321), frozenset(['1234567890']), [OMIT, 345678, 987654321]), |
|
86 |
- ((1234567890, 345678, 987654321), frozenset(['345678']), [OMIT, OMIT, 987654321]), |
|
87 |
- ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key']), |
|
78 |
+ ('string', frozenset(['string']), OMIT), |
|
79 |
+ (1234, frozenset(['1234']), OMIT), |
|
80 |
+ (1234, frozenset(['23']), OMIT), |
|
81 |
+ (1.0, frozenset(['1.0']), OMIT), |
|
82 |
+ (['string', 'strang', 'strung'], frozenset(['strang']), ['string', OMIT, 'strung']), |
|
83 |
+ (['string', 'strang', 'strung'], frozenset(['strang', 'string', 'strung']), [OMIT, OMIT, OMIT]), |
|
84 |
+ (('string', 'strang', 'strung'), frozenset(['string', 'strung']), [OMIT, 'strang', OMIT]), |
|
85 |
+ ((1234567890, 345678, 987654321), frozenset(['1234567890']), [OMIT, 345678, 987654321]), |
|
86 |
+ ((1234567890, 345678, 987654321), frozenset(['345678']), [OMIT, OMIT, 987654321]), |
|
87 |
+ ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key']), |
|
88 | 88 |
{'one': 1, 'two': 'dos', 'secret': OMIT}), |
89 |
- ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), |
|
89 |
+ ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), |
|
90 | 90 |
{'one': OMIT, 'two': OMIT, 'secret': OMIT}), |
91 |
- ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), |
|
91 |
+ ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), |
|
92 | 92 |
{'one': OMIT, 'two': OMIT, 'secret': OMIT}), |
93 |
- ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, |
|
93 |
+ ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, |
|
94 | 94 |
{'ping': 'pong', 'base': ['balls', 'raquets']}]}, |
95 | 95 |
frozenset(['balls', 'base', 'pong', 'amigos']), |
96 | 96 |
{'one': 1, 'two': 'dos', 'three': [OMIT, 'musketeers', |
97 | 97 |
None, {'ping': OMIT, 'base': [OMIT, 'raquets']}]}), |
98 |
- ('This sentence has an enigma wrapped in a mystery inside of a secret. - mr mystery', |
|
98 |
+ ('This sentence has an enigma wrapped in a mystery inside of a secret. - mr mystery', |
|
99 | 99 |
frozenset(['enigma', 'mystery', 'secret']), |
100 | 100 |
'This sentence has an ******** wrapped in a ******** inside of a ********. - mr ********'), |
101 |
- ('Toshio くらとみ', frozenset(['くらとみ']), 'Toshio ********'), |
|
102 |
- (u'Toshio くらとみ', frozenset(['くらとみ']), u'Toshio ********'), |
|
103 |
- ) |
|
101 |
+ ('Toshio くらとみ', frozenset(['くらとみ']), 'Toshio ********'), |
|
102 |
+ (u'Toshio くらとみ', frozenset(['くらとみ']), u'Toshio ********'), |
|
103 |
+ ) |
|
104 | 104 |
|
105 | 105 |
def test_no_removal(self): |
106 | 106 |
for value, no_log_strings in self.dataset_no_remove: |
... | ... |
@@ -30,27 +30,27 @@ from units.mock.generator import add_method |
30 | 30 |
|
31 | 31 |
# Strings that should be converted into a typed value |
32 | 32 |
VALID_STRINGS = ( |
33 |
- [("'a'", 'a')], |
|
34 |
- [("'1'", '1')], |
|
35 |
- [("1", 1)], |
|
36 |
- [("True", True)], |
|
37 |
- [("False", False)], |
|
38 |
- [("{}", {})], |
|
39 |
- ) |
|
33 |
+ [("'a'", 'a')], |
|
34 |
+ [("'1'", '1')], |
|
35 |
+ [("1", 1)], |
|
36 |
+ [("True", True)], |
|
37 |
+ [("False", False)], |
|
38 |
+ [("{}", {})], |
|
39 |
+ ) |
|
40 | 40 |
|
41 | 41 |
# Passing things that aren't strings should just return the object |
42 | 42 |
NONSTRINGS = ( |
43 |
- [({'a':1}, {'a':1})], |
|
44 |
- ) |
|
43 |
+ [({'a':1}, {'a':1})], |
|
44 |
+ ) |
|
45 | 45 |
|
46 | 46 |
# These strings are not basic types. For security, these should not be |
47 | 47 |
# executed. We return the same string and get an exception for some |
48 | 48 |
INVALID_STRINGS = ( |
49 |
- [("a=1", "a=1", SyntaxError)], |
|
50 |
- [("a.foo()", "a.foo()", None)], |
|
51 |
- [("import foo", "import foo", None)], |
|
52 |
- [("__import__('foo')", "__import__('foo')", ValueError)], |
|
53 |
- ) |
|
49 |
+ [("a=1", "a=1", SyntaxError)], |
|
50 |
+ [("a.foo()", "a.foo()", None)], |
|
51 |
+ [("import foo", "import foo", None)], |
|
52 |
+ [("__import__('foo')", "__import__('foo')", ValueError)], |
|
53 |
+ ) |
|
54 | 54 |
|
55 | 55 |
|
56 | 56 |
def _check_simple_types(self, code, expected): |
... | ... |
@@ -79,15 +79,15 @@ def _check_mode_unchanged_when_already_0660(self, mode): |
79 | 79 |
|
80 | 80 |
|
81 | 81 |
SYNONYMS_0660 = ( |
82 |
- [[0o660]], |
|
83 |
- [['0o660']], |
|
84 |
- [['660']], |
|
85 |
- ) |
|
82 |
+ [[0o660]], |
|
83 |
+ [['0o660']], |
|
84 |
+ [['660']], |
|
85 |
+ ) |
|
86 | 86 |
|
87 | 87 |
@add_method(_check_no_mode_given_returns_previous_changes, |
88 | 88 |
[dict(previous_changes=True)], |
89 |
- [dict(previous_changes=False)], |
|
90 |
- ) |
|
89 |
+ [dict(previous_changes=False)], |
|
90 |
+ ) |
|
91 | 91 |
@add_method(_check_mode_changed_to_0660, |
92 | 92 |
*SYNONYMS_0660 |
93 | 93 |
) |
... | ... |
@@ -131,8 +131,8 @@ def _check_knows_to_change_to_0660_in_check_mode(self, mode): |
131 | 131 |
|
132 | 132 |
@add_method(_check_no_mode_given_returns_previous_changes, |
133 | 133 |
[dict(previous_changes=True)], |
134 |
- [dict(previous_changes=False)], |
|
135 |
- ) |
|
134 |
+ [dict(previous_changes=False)], |
|
135 |
+ ) |
|
136 | 136 |
@add_method(_check_knows_to_change_to_0660_in_check_mode, |
137 | 137 |
*SYNONYMS_0660 |
138 | 138 |
) |
... | ... |
@@ -46,12 +46,12 @@ class TestAnsibleModuleExitJson(unittest.TestCase): |
46 | 46 |
junk = [u"single line of junk", u"line 1/2 of junk\nline 2/2 of junk"] |
47 | 47 |
|
48 | 48 |
unparsable_cases = ( |
49 |
- u'No json here', |
|
50 |
- u'"olá": "mundo"', |
|
51 |
- u'{"No json": "ending"', |
|
52 |
- u'{"wrong": "ending"]', |
|
53 |
- u'["wrong": "ending"}', |
|
54 |
- ) |
|
49 |
+ u'No json here', |
|
50 |
+ u'"olá": "mundo"', |
|
51 |
+ u'{"No json": "ending"', |
|
52 |
+ u'{"wrong": "ending"]', |
|
53 |
+ u'["wrong": "ending"}', |
|
54 |
+ ) |
|
55 | 55 |
|
56 | 56 |
def test_just_json(self): |
57 | 57 |
for i in self.all_inputs: |
... | ... |
@@ -36,86 +36,86 @@ import ansible.module_utils.facts as facts |
36 | 36 |
# to generate the testcase data, you can use the script gen_distribution_version_testcase.py in hacking/tests |
37 | 37 |
TESTSETS = [ |
38 | 38 |
{ |
39 |
- "platform.dist": [ |
|
40 |
- "centos", |
|
41 |
- "7.2.1511", |
|
42 |
- "Core" |
|
43 |
- ], |
|
44 |
- "input": { |
|
45 |
- "/etc/redhat-release": "CentOS Linux release 7.2.1511 (Core) \n", |
|
46 |
- "/etc/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:7\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n\n", |
|
47 |
- "/etc/system-release": "CentOS Linux release 7.2.1511 (Core) \n" |
|
48 |
- }, |
|
49 |
- "name": "CentOS 7.2.1511", |
|
50 |
- "result": { |
|
51 |
- "distribution_release": "Core", |
|
52 |
- "distribution": "CentOS", |
|
53 |
- "distribution_major_version": "7", |
|
54 |
- "os_family": "RedHat", |
|
55 |
- "distribution_version": "7.2.1511" |
|
56 |
- } |
|
57 |
-}, |
|
39 |
+ "platform.dist": [ |
|
40 |
+ "centos", |
|
41 |
+ "7.2.1511", |
|
42 |
+ "Core" |
|
43 |
+ ], |
|
44 |
+ "input": { |
|
45 |
+ "/etc/redhat-release": "CentOS Linux release 7.2.1511 (Core) \n", |
|
46 |
+ "/etc/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:7\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n\n", |
|
47 |
+ "/etc/system-release": "CentOS Linux release 7.2.1511 (Core) \n" |
|
48 |
+ }, |
|
49 |
+ "name": "CentOS 7.2.1511", |
|
50 |
+ "result": { |
|
51 |
+ "distribution_release": "Core", |
|
52 |
+ "distribution": "CentOS", |
|
53 |
+ "distribution_major_version": "7", |
|
54 |
+ "os_family": "RedHat", |
|
55 |
+ "distribution_version": "7.2.1511" |
|
56 |
+ } |
|
57 |
+ }, |
|
58 | 58 |
{ |
59 |
- "name": "CentOS 6.7", |
|
60 |
- "platform.dist": [ |
|
61 |
- "centos", |
|
62 |
- "6.7", |
|
63 |
- "Final" |
|
64 |
- ], |
|
65 |
- "input": { |
|
66 |
- "/etc/redhat-release": "CentOS release 6.7 (Final)\n", |
|
67 |
- "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", |
|
68 |
- "/etc/system-release": "CentOS release 6.7 (Final)\n" |
|
69 |
- }, |
|
70 |
- "result": { |
|
71 |
- "distribution_release": "Final", |
|
72 |
- "distribution": "CentOS", |
|
73 |
- "distribution_major_version": "6", |
|
74 |
- "os_family": "RedHat", |
|
75 |
- "distribution_version": "6.7" |
|
76 |
- } |
|
77 |
-}, |
|
59 |
+ "name": "CentOS 6.7", |
|
60 |
+ "platform.dist": [ |
|
61 |
+ "centos", |
|
62 |
+ "6.7", |
|
63 |
+ "Final" |
|
64 |
+ ], |
|
65 |
+ "input": { |
|
66 |
+ "/etc/redhat-release": "CentOS release 6.7 (Final)\n", |
|
67 |
+ "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", |
|
68 |
+ "/etc/system-release": "CentOS release 6.7 (Final)\n" |
|
69 |
+ }, |
|
70 |
+ "result": { |
|
71 |
+ "distribution_release": "Final", |
|
72 |
+ "distribution": "CentOS", |
|
73 |
+ "distribution_major_version": "6", |
|
74 |
+ "os_family": "RedHat", |
|
75 |
+ "distribution_version": "6.7" |
|
76 |
+ } |
|
77 |
+ }, |
|
78 |
+ { |
|
79 |
+ "name": "RedHat 7.2", |
|
80 |
+ "platform.dist": [ |
|
81 |
+ "redhat", |
|
82 |
+ "7.2", |
|
83 |
+ "Maipo" |
|
84 |
+ ], |
|
85 |
+ "input": { |
|
86 |
+ "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n", |
|
87 |
+ "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.2 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"7.2\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.2 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.2:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.2\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.2\"\n", |
|
88 |
+ "/etc/system-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n" |
|
89 |
+ }, |
|
90 |
+ "result": { |
|
91 |
+ "distribution_release": "Maipo", |
|
92 |
+ "distribution": "RedHat", |
|
93 |
+ "distribution_major_version": "7", |
|
94 |
+ "os_family": "RedHat", |
|
95 |
+ "distribution_version": "7.2" |
|
96 |
+ } |
|
97 |
+ }, |
|
98 |
+ { |
|
99 |
+ "name": "RedHat 6.7", |
|
100 |
+ "platform.dist": [ |
|
101 |
+ "redhat", |
|
102 |
+ "6.7", |
|
103 |
+ "Santiago" |
|
104 |
+ ], |
|
105 |
+ "input": { |
|
106 |
+ "/etc/redhat-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n", |
|
107 |
+ "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", |
|
108 |
+ "/etc/system-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n" |
|
109 |
+ }, |
|
110 |
+ "result": { |
|
111 |
+ "distribution_release": "Santiago", |
|
112 |
+ "distribution": "RedHat", |
|
113 |
+ "distribution_major_version": "6", |
|
114 |
+ "os_family": "RedHat", |
|
115 |
+ "distribution_version": "6.7" |
|
116 |
+ } |
|
117 |
+ }, |
|
78 | 118 |
{ |
79 |
- "name": "RedHat 7.2", |
|
80 |
- "platform.dist": [ |
|
81 |
- "redhat", |
|
82 |
- "7.2", |
|
83 |
- "Maipo" |
|
84 |
- ], |
|
85 |
- "input": { |
|
86 |
- "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n", |
|
87 |
- "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.2 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"7.2\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.2 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.2:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.2\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.2\"\n", |
|
88 |
- "/etc/system-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n" |
|
89 |
- }, |
|
90 |
- "result": { |
|
91 |
- "distribution_release": "Maipo", |
|
92 |
- "distribution": "RedHat", |
|
93 |
- "distribution_major_version": "7", |
|
94 |
- "os_family": "RedHat", |
|
95 |
- "distribution_version": "7.2" |
|
96 |
- } |
|
97 |
-}, |
|
98 |
-{ |
|
99 |
- "name": "RedHat 6.7", |
|
100 |
- "platform.dist": [ |
|
101 |
- "redhat", |
|
102 |
- "6.7", |
|
103 |
- "Santiago" |
|
104 |
- ], |
|
105 |
- "input": { |
|
106 |
- "/etc/redhat-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n", |
|
107 |
- "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", |
|
108 |
- "/etc/system-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n" |
|
109 |
- }, |
|
110 |
- "result": { |
|
111 |
- "distribution_release": "Santiago", |
|
112 |
- "distribution": "RedHat", |
|
113 |
- "distribution_major_version": "6", |
|
114 |
- "os_family": "RedHat", |
|
115 |
- "distribution_version": "6.7" |
|
116 |
- } |
|
117 |
-}, |
|
118 |
-{ |
|
119 | 119 |
"name" : "openSUSE Leap 42.1", |
120 | 120 |
"input": { |
121 | 121 |
"/etc/os-release": |
... | ... |
@@ -604,84 +604,84 @@ DISTRIB_DESCRIPTION="CoreOS 976.0.0 (Coeur Rouge)" |
604 | 604 |
"platform.system": "SunOS" |
605 | 605 |
}, |
606 | 606 |
|
607 |
-{ |
|
608 |
- "name": "Solaris 11.3", |
|
609 |
- "platform.dist": [ |
|
610 |
- "", |
|
611 |
- "", |
|
612 |
- "" |
|
613 |
- ], |
|
614 |
- "input": { |
|
615 |
- "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.\n Assembled 06 October 2015\n" |
|
616 |
- }, |
|
617 |
- "platform.system": "SunOS", |
|
618 |
- "result": { |
|
619 |
- "distribution_release": "Oracle Solaris 11.3 X86", |
|
620 |
- "distribution": "Solaris", |
|
621 |
- "os_family": "Solaris", |
|
622 |
- "distribution_version": "11.3" |
|
623 |
- } |
|
624 |
-}, |
|
607 |
+ { |
|
608 |
+ "name": "Solaris 11.3", |
|
609 |
+ "platform.dist": [ |
|
610 |
+ "", |
|
611 |
+ "", |
|
612 |
+ "" |
|
613 |
+ ], |
|
614 |
+ "input": { |
|
615 |
+ "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.\n Assembled 06 October 2015\n" |
|
616 |
+ }, |
|
617 |
+ "platform.system": "SunOS", |
|
618 |
+ "result": { |
|
619 |
+ "distribution_release": "Oracle Solaris 11.3 X86", |
|
620 |
+ "distribution": "Solaris", |
|
621 |
+ "os_family": "Solaris", |
|
622 |
+ "distribution_version": "11.3" |
|
623 |
+ } |
|
624 |
+ }, |
|
625 | 625 |
|
626 |
-{ |
|
627 |
- "name": "Solaris 10", |
|
628 |
- "platform.dist": [ |
|
629 |
- "", |
|
630 |
- "", |
|
631 |
- "" |
|
632 |
- ], |
|
633 |
- "input": { |
|
634 |
- "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" |
|
635 |
- }, |
|
636 |
- "platform.system": "SunOS", |
|
637 |
- "result": { |
|
638 |
- "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", |
|
639 |
- "distribution": "Solaris", |
|
640 |
- "os_family": "Solaris", |
|
641 |
- "distribution_version": "10" |
|
642 |
- } |
|
643 |
-}, |
|
626 |
+ { |
|
627 |
+ "name": "Solaris 10", |
|
628 |
+ "platform.dist": [ |
|
629 |
+ "", |
|
630 |
+ "", |
|
631 |
+ "" |
|
632 |
+ ], |
|
633 |
+ "input": { |
|
634 |
+ "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" |
|
635 |
+ }, |
|
636 |
+ "platform.system": "SunOS", |
|
637 |
+ "result": { |
|
638 |
+ "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", |
|
639 |
+ "distribution": "Solaris", |
|
640 |
+ "os_family": "Solaris", |
|
641 |
+ "distribution_version": "10" |
|
642 |
+ } |
|
643 |
+ }, |
|
644 | 644 |
|
645 |
-{ |
|
646 |
- "name": "Fedora 22", |
|
647 |
- "platform.dist": [ |
|
648 |
- "fedora", |
|
649 |
- "22", |
|
650 |
- "Twenty Two" |
|
651 |
- ], |
|
652 |
- "input": { |
|
653 |
- "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", |
|
654 |
- "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", |
|
655 |
- "/etc/system-release": "Fedora release 22 (Twenty Two)\n" |
|
656 |
- }, |
|
657 |
- "result": { |
|
658 |
- "distribution_release": "Twenty Two", |
|
659 |
- "distribution": "Fedora", |
|
660 |
- "distribution_major_version": "22", |
|
661 |
- "os_family": "RedHat", |
|
662 |
- "distribution_version": "22" |
|
663 |
- } |
|
664 |
-}, |
|
665 |
-{ |
|
666 |
- "platform.dist": [ |
|
667 |
- "fedora", |
|
668 |
- "25", |
|
669 |
- "Rawhide" |
|
670 |
- ], |
|
671 |
- "input": { |
|
672 |
- "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", |
|
673 |
- "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", |
|
674 |
- "/etc/system-release": "Fedora release 25 (Rawhide)\n" |
|
675 |
- }, |
|
676 |
- "name": "Fedora 25", |
|
677 |
- "result": { |
|
678 |
- "distribution_release": "Rawhide", |
|
679 |
- "distribution": "Fedora", |
|
680 |
- "distribution_major_version": "25", |
|
681 |
- "os_family": "RedHat", |
|
682 |
- "distribution_version": "25" |
|
683 |
- } |
|
684 |
-}, |
|
645 |
+ { |
|
646 |
+ "name": "Fedora 22", |
|
647 |
+ "platform.dist": [ |
|
648 |
+ "fedora", |
|
649 |
+ "22", |
|
650 |
+ "Twenty Two" |
|
651 |
+ ], |
|
652 |
+ "input": { |
|
653 |
+ "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", |
|
654 |
+ "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", |
|
655 |
+ "/etc/system-release": "Fedora release 22 (Twenty Two)\n" |
|
656 |
+ }, |
|
657 |
+ "result": { |
|
658 |
+ "distribution_release": "Twenty Two", |
|
659 |
+ "distribution": "Fedora", |
|
660 |
+ "distribution_major_version": "22", |
|
661 |
+ "os_family": "RedHat", |
|
662 |
+ "distribution_version": "22" |
|
663 |
+ } |
|
664 |
+ }, |
|
665 |
+ { |
|
666 |
+ "platform.dist": [ |
|
667 |
+ "fedora", |
|
668 |
+ "25", |
|
669 |
+ "Rawhide" |
|
670 |
+ ], |
|
671 |
+ "input": { |
|
672 |
+ "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", |
|
673 |
+ "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", |
|
674 |
+ "/etc/system-release": "Fedora release 25 (Rawhide)\n" |
|
675 |
+ }, |
|
676 |
+ "name": "Fedora 25", |
|
677 |
+ "result": { |
|
678 |
+ "distribution_release": "Rawhide", |
|
679 |
+ "distribution": "Fedora", |
|
680 |
+ "distribution_major_version": "25", |
|
681 |
+ "os_family": "RedHat", |
|
682 |
+ "distribution_version": "25" |
|
683 |
+ } |
|
684 |
+ }, |
|
685 | 685 |
|
686 | 686 |
|
687 | 687 |
] |
... | ... |
@@ -31,13 +31,13 @@ from ansible.module_utils._text import to_text, to_bytes, to_native |
31 | 31 |
|
32 | 32 |
# Format: byte representation, text representation, encoding of byte representation |
33 | 33 |
VALID_STRINGS = ( |
34 |
- (b'abcde', u'abcde', 'ascii'), |
|
35 |
- (b'caf\xc3\xa9', u'caf\xe9', 'utf-8'), |
|
36 |
- (b'caf\xe9', u'caf\xe9', 'latin-1'), |
|
37 |
- # u'くらとみ' |
|
38 |
- (b'\xe3\x81\x8f\xe3\x82\x89\xe3\x81\xa8\xe3\x81\xbf', u'\u304f\u3089\u3068\u307f', 'utf-8'), |
|
39 |
- (b'\x82\xad\x82\xe7\x82\xc6\x82\xdd', u'\u304f\u3089\u3068\u307f', 'shift-jis'), |
|
40 |
- ) |
|
34 |
+ (b'abcde', u'abcde', 'ascii'), |
|
35 |
+ (b'caf\xc3\xa9', u'caf\xe9', 'utf-8'), |
|
36 |
+ (b'caf\xe9', u'caf\xe9', 'latin-1'), |
|
37 |
+ # u'くらとみ' |
|
38 |
+ (b'\xe3\x81\x8f\xe3\x82\x89\xe3\x81\xa8\xe3\x81\xbf', u'\u304f\u3089\u3068\u307f', 'utf-8'), |
|
39 |
+ (b'\x82\xad\x82\xe7\x82\xc6\x82\xdd', u'\u304f\u3089\u3068\u307f', 'shift-jis'), |
|
40 |
+ ) |
|
41 | 41 |
|
42 | 42 |
def _check_to_text(self, in_string, encoding, expected): |
43 | 43 |
"""test happy path of decoding to text""" |
... | ... |
@@ -57,13 +57,13 @@ def run(play): |
57 | 57 |
results = None |
58 | 58 |
try: |
59 | 59 |
tqm = TaskQueueManager( |
60 |
- inventory=inventory, |
|
61 |
- variable_manager=variable_manager, |
|
62 |
- loader=loader, |
|
63 |
- options=options, |
|
64 |
- passwords=passwords, |
|
65 |
- stdout_callback='default', |
|
66 |
- ) |
|
60 |
+ inventory=inventory, |
|
61 |
+ variable_manager=variable_manager, |
|
62 |
+ loader=loader, |
|
63 |
+ options=options, |
|
64 |
+ passwords=passwords, |
|
65 |
+ stdout_callback='default', |
|
66 |
+ ) |
|
67 | 67 |
results = tqm.run(play) |
68 | 68 |
finally: |
69 | 69 |
if tqm is not None: |
... | ... |
@@ -47,9 +47,9 @@ class TestModArgsDwim(unittest.TestCase): |
47 | 47 |
self._debug(mod, args, to) |
48 | 48 |
self.assertEqual(mod, 'command') |
49 | 49 |
self.assertEqual(args, dict( |
50 |
- _raw_params = 'echo hi', |
|
51 |
- _uses_shell = True, |
|
52 |
- )) |
|
50 |
+ _raw_params = 'echo hi', |
|
51 |
+ _uses_shell = True, |
|
52 |
+ )) |
|
53 | 53 |
self.assertIsNone(to) |
54 | 54 |
|
55 | 55 |
def test_basic_command(self): |
... | ... |
@@ -58,8 +58,8 @@ class TestModArgsDwim(unittest.TestCase): |
58 | 58 |
self._debug(mod, args, to) |
59 | 59 |
self.assertEqual(mod, 'command') |
60 | 60 |
self.assertEqual(args, dict( |
61 |
- _raw_params = 'echo hi', |
|
62 |
- )) |
|
61 |
+ _raw_params = 'echo hi', |
|
62 |
+ )) |
|
63 | 63 |
self.assertIsNone(to) |
64 | 64 |
|
65 | 65 |
def test_shell_with_modifiers(self): |
... | ... |
@@ -68,11 +68,11 @@ class TestModArgsDwim(unittest.TestCase): |
68 | 68 |
self._debug(mod, args, to) |
69 | 69 |
self.assertEqual(mod, 'command') |
70 | 70 |
self.assertEqual(args, dict( |
71 |
- creates = '/tmp/baz', |
|
72 |
- removes = '/tmp/bleep', |
|
73 |
- _raw_params = '/bin/foo', |
|
74 |
- _uses_shell = True, |
|
75 |
- )) |
|
71 |
+ creates = '/tmp/baz', |
|
72 |
+ removes = '/tmp/bleep', |
|
73 |
+ _raw_params = '/bin/foo', |
|
74 |
+ _uses_shell = True, |
|
75 |
+ )) |
|
76 | 76 |
self.assertIsNone(to) |
77 | 77 |
|
78 | 78 |
def test_normal_usage(self): |
... | ... |
@@ -39,10 +39,10 @@ class TestBlock(unittest.TestCase): |
39 | 39 |
|
40 | 40 |
def test_load_block_simple(self): |
41 | 41 |
ds = dict( |
42 |
- block = [], |
|
43 |
- rescue = [], |
|
44 |
- always = [], |
|
45 |
- #otherwise = [], |
|
42 |
+ block = [], |
|
43 |
+ rescue = [], |
|
44 |
+ always = [], |
|
45 |
+ #otherwise = [], |
|
46 | 46 |
) |
47 | 47 |
b = Block.load(ds) |
48 | 48 |
self.assertEqual(b.block, []) |
... | ... |
@@ -53,10 +53,10 @@ class TestBlock(unittest.TestCase): |
53 | 53 |
|
54 | 54 |
def test_load_block_with_tasks(self): |
55 | 55 |
ds = dict( |
56 |
- block = [dict(action='block')], |
|
57 |
- rescue = [dict(action='rescue')], |
|
58 |
- always = [dict(action='always')], |
|
59 |
- #otherwise = [dict(action='otherwise')], |
|
56 |
+ block = [dict(action='block')], |
|
57 |
+ rescue = [dict(action='rescue')], |
|
58 |
+ always = [dict(action='always')], |
|
59 |
+ #otherwise = [dict(action='otherwise')], |
|
60 | 60 |
) |
61 | 61 |
b = Block.load(ds) |
62 | 62 |
self.assertEqual(len(b.block), 1) |
... | ... |
@@ -77,9 +77,9 @@ class TestBlock(unittest.TestCase): |
77 | 77 |
|
78 | 78 |
def test_deserialize(self): |
79 | 79 |
ds = dict( |
80 |
- block = [dict(action='block')], |
|
81 |
- rescue = [dict(action='rescue')], |
|
82 |
- always = [dict(action='always')], |
|
80 |
+ block = [dict(action='block')], |
|
81 |
+ rescue = [dict(action='rescue')], |
|
82 |
+ always = [dict(action='always')], |
|
83 | 83 |
) |
84 | 84 |
b = Block.load(ds) |
85 | 85 |
data = dict(parent = ds, parent_type = 'Block') |
... | ... |
@@ -186,7 +186,7 @@ class TestPlayContext(unittest.TestCase): |
186 | 186 |
class TestTaskAndVariableOverrride(unittest.TestCase): |
187 | 187 |
|
188 | 188 |
inventory_vars = ( |
189 |
- ('preferred_names', |
|
189 |
+ ('preferred_names', |
|
190 | 190 |
dict(ansible_connection='local', |
191 | 191 |
ansible_user='ansibull', |
192 | 192 |
ansible_become_user='ansibull', |
... | ... |
@@ -198,11 +198,11 @@ class TestTaskAndVariableOverrride(unittest.TestCase): |
198 | 198 |
become_method='su', |
199 | 199 |
become_pass='ansibullwuzhere',) |
200 | 200 |
), |
201 |
- ('alternate_names', |
|
201 |
+ ('alternate_names', |
|
202 | 202 |
dict(ansible_become_password='ansibullwuzhere',), |
203 | 203 |
dict(become_pass='ansibullwuzhere',) |
204 | 204 |
), |
205 |
- ('deprecated_names', |
|
205 |
+ ('deprecated_names', |
|
206 | 206 |
dict(ansible_ssh_user='ansibull', |
207 | 207 |
ansible_sudo_user='ansibull', |
208 | 208 |
ansible_sudo_pass='ansibullwuzhere',), |
... | ... |
@@ -211,7 +211,7 @@ class TestTaskAndVariableOverrride(unittest.TestCase): |
211 | 211 |
become_user='ansibull', |
212 | 212 |
become_pass='ansibullwuzhere',) |
213 | 213 |
), |
214 |
- ('deprecated_names2', |
|
214 |
+ ('deprecated_names2', |
|
215 | 215 |
dict(ansible_ssh_user='ansibull', |
216 | 216 |
ansible_su_user='ansibull', |
217 | 217 |
ansible_su_pass='ansibullwuzhere',), |
... | ... |
@@ -220,17 +220,17 @@ class TestTaskAndVariableOverrride(unittest.TestCase): |
220 | 220 |
become_user='ansibull', |
221 | 221 |
become_pass='ansibullwuzhere',) |
222 | 222 |
), |
223 |
- ('deprecated_alt_names', |
|
223 |
+ ('deprecated_alt_names', |
|
224 | 224 |
dict(ansible_sudo_password='ansibullwuzhere',), |
225 | 225 |
dict(become_method='sudo', |
226 | 226 |
become_pass='ansibullwuzhere',) |
227 | 227 |
), |
228 |
- ('deprecated_alt_names2', |
|
228 |
+ ('deprecated_alt_names2', |
|
229 | 229 |
dict(ansible_su_password='ansibullwuzhere',), |
230 | 230 |
dict(become_method='su', |
231 | 231 |
become_pass='ansibullwuzhere',) |
232 | 232 |
), |
233 |
- ('deprecated_and_preferred_names', |
|
233 |
+ ('deprecated_and_preferred_names', |
|
234 | 234 |
dict(ansible_user='ansibull', |
235 | 235 |
ansible_ssh_user='badbull', |
236 | 236 |
ansible_become_user='ansibull', |
... | ... |
@@ -245,7 +245,7 @@ class TestTaskAndVariableOverrride(unittest.TestCase): |
245 | 245 |
become_method='su', |
246 | 246 |
become_pass='ansibullwuzhere',) |
247 | 247 |
), |
248 |
- ) |
|
248 |
+ ) |
|
249 | 249 |
|
250 | 250 |
def setUp(self): |
251 | 251 |
parser = CLI.base_parser( |
... | ... |
@@ -23,12 +23,12 @@ from ansible.playbook.task import Task |
23 | 23 |
from ansible.compat.tests import unittest |
24 | 24 |
|
25 | 25 |
basic_shell_task = dict( |
26 |
- name = 'Test Task', |
|
27 |
- shell = 'echo hi' |
|
26 |
+ name = 'Test Task', |
|
27 |
+ shell = 'echo hi' |
|
28 | 28 |
) |
29 | 29 |
|
30 | 30 |
kv_shell_task = dict( |
31 |
- action = 'shell echo hi' |
|
31 |
+ action = 'shell echo hi' |
|
32 | 32 |
) |
33 | 33 |
|
34 | 34 |
class TestTask(unittest.TestCase): |
... | ... |
@@ -28,26 +28,26 @@ class TestINILookup(unittest.TestCase): |
28 | 28 |
|
29 | 29 |
# Currently there isn't a new-style |
30 | 30 |
old_style_params_data = ( |
31 |
- # Simple case |
|
32 |
- dict(term=u'keyA section=sectionA file=/path/to/file', |
|
31 |
+ # Simple case |
|
32 |
+ dict(term=u'keyA section=sectionA file=/path/to/file', |
|
33 | 33 |
expected=[u'keyA', u'section=sectionA', u'file=/path/to/file'], |
34 | 34 |
), |
35 |
- dict(term=u'keyB section=sectionB with space file=/path/with/embedded spaces and/file', |
|
35 |
+ dict(term=u'keyB section=sectionB with space file=/path/with/embedded spaces and/file', |
|
36 | 36 |
expected=[u'keyB', u'section=sectionB with space', u'file=/path/with/embedded spaces and/file'], |
37 | 37 |
), |
38 |
- dict(term=u'keyC section=sectionC file=/path/with/equals/cn=com.ansible', |
|
38 |
+ dict(term=u'keyC section=sectionC file=/path/with/equals/cn=com.ansible', |
|
39 | 39 |
expected=[u'keyC', u'section=sectionC', u'file=/path/with/equals/cn=com.ansible'], |
40 | 40 |
), |
41 |
- dict(term=u'keyD section=sectionD file=/path/with space and/equals/cn=com.ansible', |
|
41 |
+ dict(term=u'keyD section=sectionD file=/path/with space and/equals/cn=com.ansible', |
|
42 | 42 |
expected=[u'keyD', u'section=sectionD', u'file=/path/with space and/equals/cn=com.ansible'], |
43 | 43 |
), |
44 |
- dict(term=u'keyE section=sectionE file=/path/with/unicode/くらとみ/file', |
|
44 |
+ dict(term=u'keyE section=sectionE file=/path/with/unicode/くらとみ/file', |
|
45 | 45 |
expected=[u'keyE', u'section=sectionE', u'file=/path/with/unicode/くらとみ/file'], |
46 | 46 |
), |
47 |
- dict(term=u'keyF section=sectionF file=/path/with/utf 8 and spaces/くらとみ/file', |
|
47 |
+ dict(term=u'keyF section=sectionF file=/path/with/utf 8 and spaces/くらとみ/file', |
|
48 | 48 |
expected=[u'keyF', u'section=sectionF', u'file=/path/with/utf 8 and spaces/くらとみ/file'], |
49 | 49 |
), |
50 |
- ) |
|
50 |
+ ) |
|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
def setUp(self): |
... | ... |
@@ -305,24 +305,24 @@ class TestParseContent(unittest.TestCase): |
305 | 305 |
class TestFormatContent(unittest.TestCase): |
306 | 306 |
def test_no_encrypt(self): |
307 | 307 |
self.assertEqual( |
308 |
- password._format_content(password=u'hunter42', |
|
308 |
+ password._format_content(password=u'hunter42', |
|
309 | 309 |
salt=u'87654321', |
310 | 310 |
encrypt=False), |
311 |
- u'hunter42 salt=87654321') |
|
311 |
+ u'hunter42 salt=87654321') |
|
312 | 312 |
|
313 | 313 |
def test_no_encrypt_no_salt(self): |
314 | 314 |
self.assertEqual( |
315 |
- password._format_content(password=u'hunter42', |
|
315 |
+ password._format_content(password=u'hunter42', |
|
316 | 316 |
salt=None, |
317 | 317 |
encrypt=False), |
318 |
- u'hunter42') |
|
318 |
+ u'hunter42') |
|
319 | 319 |
|
320 | 320 |
def test_encrypt(self): |
321 | 321 |
self.assertEqual( |
322 |
- password._format_content(password=u'hunter42', |
|
322 |
+ password._format_content(password=u'hunter42', |
|
323 | 323 |
salt=u'87654321', |
324 | 324 |
encrypt='pbkdf2_sha256'), |
325 |
- u'hunter42 salt=87654321') |
|
325 |
+ u'hunter42 salt=87654321') |
|
326 | 326 |
|
327 | 327 |
def test_encrypt_no_salt(self): |
328 | 328 |
self.assertRaises(AssertionError, password._format_content, |
... | ... |
@@ -30,45 +30,45 @@ from ansible.template import _escape_backslashes, _count_newlines_from_end |
30 | 30 |
class TestBackslashEscape(unittest.TestCase): |
31 | 31 |
|
32 | 32 |
test_data = ( |
33 |
- # Test backslashes in a filter arg are double escaped |
|
34 |
- dict( |
|
35 |
- template=u"{{ 'test2 %s' | format('\\1') }}", |
|
36 |
- intermediate=u"{{ 'test2 %s' | format('\\\\1') }}", |
|
37 |
- expectation=u"test2 \\1", |
|
38 |
- args=dict() |
|
39 |
- ), |
|
40 |
- # Test backslashes inside the jinja2 var itself are double |
|
41 |
- # escaped |
|
42 |
- dict( |
|
43 |
- template=u"Test 2\\3: {{ '\\1 %s' | format('\\2') }}", |
|
44 |
- intermediate=u"Test 2\\3: {{ '\\\\1 %s' | format('\\\\2') }}", |
|
45 |
- expectation=u"Test 2\\3: \\1 \\2", |
|
46 |
- args=dict() |
|
47 |
- ), |
|
48 |
- # Test backslashes outside of the jinja2 var are not double |
|
49 |
- # escaped |
|
50 |
- dict( |
|
51 |
- template=u"Test 2\\3: {{ 'test2 %s' | format('\\1') }}; \\done", |
|
52 |
- intermediate=u"Test 2\\3: {{ 'test2 %s' | format('\\\\1') }}; \\done", |
|
53 |
- expectation=u"Test 2\\3: test2 \\1; \\done", |
|
54 |
- args=dict() |
|
55 |
- ), |
|
56 |
- # Test backslashes in a variable sent to a filter are handled |
|
57 |
- dict( |
|
58 |
- template=u"{{ 'test2 %s' | format(var1) }}", |
|
59 |
- intermediate=u"{{ 'test2 %s' | format(var1) }}", |
|
60 |
- expectation=u"test2 \\1", |
|
61 |
- args=dict(var1=u'\\1') |
|
62 |
- ), |
|
63 |
- # Test backslashes in a variable expanded by jinja2 are double |
|
64 |
- # escaped |
|
65 |
- dict( |
|
66 |
- template=u"Test 2\\3: {{ var1 | format('\\2') }}", |
|
67 |
- intermediate=u"Test 2\\3: {{ var1 | format('\\\\2') }}", |
|
68 |
- expectation=u"Test 2\\3: \\1 \\2", |
|
69 |
- args=dict(var1=u'\\1 %s') |
|
70 |
- ), |
|
71 |
- ) |
|
33 |
+ # Test backslashes in a filter arg are double escaped |
|
34 |
+ dict( |
|
35 |
+ template=u"{{ 'test2 %s' | format('\\1') }}", |
|
36 |
+ intermediate=u"{{ 'test2 %s' | format('\\\\1') }}", |
|
37 |
+ expectation=u"test2 \\1", |
|
38 |
+ args=dict() |
|
39 |
+ ), |
|
40 |
+ # Test backslashes inside the jinja2 var itself are double |
|
41 |
+ # escaped |
|
42 |
+ dict( |
|
43 |
+ template=u"Test 2\\3: {{ '\\1 %s' | format('\\2') }}", |
|
44 |
+ intermediate=u"Test 2\\3: {{ '\\\\1 %s' | format('\\\\2') }}", |
|
45 |
+ expectation=u"Test 2\\3: \\1 \\2", |
|
46 |
+ args=dict() |
|
47 |
+ ), |
|
48 |
+ # Test backslashes outside of the jinja2 var are not double |
|
49 |
+ # escaped |
|
50 |
+ dict( |
|
51 |
+ template=u"Test 2\\3: {{ 'test2 %s' | format('\\1') }}; \\done", |
|
52 |
+ intermediate=u"Test 2\\3: {{ 'test2 %s' | format('\\\\1') }}; \\done", |
|
53 |
+ expectation=u"Test 2\\3: test2 \\1; \\done", |
|
54 |
+ args=dict() |
|
55 |
+ ), |
|
56 |
+ # Test backslashes in a variable sent to a filter are handled |
|
57 |
+ dict( |
|
58 |
+ template=u"{{ 'test2 %s' | format(var1) }}", |
|
59 |
+ intermediate=u"{{ 'test2 %s' | format(var1) }}", |
|
60 |
+ expectation=u"test2 \\1", |
|
61 |
+ args=dict(var1=u'\\1') |
|
62 |
+ ), |
|
63 |
+ # Test backslashes in a variable expanded by jinja2 are double |
|
64 |
+ # escaped |
|
65 |
+ dict( |
|
66 |
+ template=u"Test 2\\3: {{ var1 | format('\\2') }}", |
|
67 |
+ intermediate=u"Test 2\\3: {{ var1 | format('\\\\2') }}", |
|
68 |
+ expectation=u"Test 2\\3: \\1 \\2", |
|
69 |
+ args=dict(var1=u'\\1 %s') |
|
70 |
+ ), |
|
71 |
+ ) |
|
72 | 72 |
def setUp(self): |
73 | 73 |
self.env = jinja2.Environment() |
74 | 74 |
|
... | ... |
@@ -30,39 +30,39 @@ from ansible.utils.vars import combine_vars, merge_hash |
30 | 30 |
class TestVariableUtils(unittest.TestCase): |
31 | 31 |
|
32 | 32 |
test_merge_data = ( |
33 |
- dict( |
|
34 |
- a=dict(a=1), |
|
35 |
- b=dict(b=2), |
|
36 |
- result=dict(a=1, b=2) |
|
33 |
+ dict( |
|
34 |
+ a=dict(a=1), |
|
35 |
+ b=dict(b=2), |
|
36 |
+ result=dict(a=1, b=2) |
|
37 | 37 |
), |
38 |
- dict( |
|
39 |
- a=dict(a=1, c=dict(foo='bar')), |
|
40 |
- b=dict(b=2, c=dict(baz='bam')), |
|
41 |
- result=dict(a=1, b=2, c=dict(foo='bar', baz='bam')) |
|
38 |
+ dict( |
|
39 |
+ a=dict(a=1, c=dict(foo='bar')), |
|
40 |
+ b=dict(b=2, c=dict(baz='bam')), |
|
41 |
+ result=dict(a=1, b=2, c=dict(foo='bar', baz='bam')) |
|
42 | 42 |
), |
43 |
- dict( |
|
44 |
- a=defaultdict(a=1, c=defaultdict(foo='bar')), |
|
45 |
- b=dict(b=2, c=dict(baz='bam')), |
|
46 |
- result=defaultdict(a=1, b=2, c=defaultdict(foo='bar', baz='bam')) |
|
43 |
+ dict( |
|
44 |
+ a=defaultdict(a=1, c=defaultdict(foo='bar')), |
|
45 |
+ b=dict(b=2, c=dict(baz='bam')), |
|
46 |
+ result=defaultdict(a=1, b=2, c=defaultdict(foo='bar', baz='bam')) |
|
47 | 47 |
), |
48 |
- ) |
|
48 |
+ ) |
|
49 | 49 |
test_replace_data = ( |
50 |
- dict( |
|
51 |
- a=dict(a=1), |
|
52 |
- b=dict(b=2), |
|
53 |
- result=dict(a=1, b=2) |
|
50 |
+ dict( |
|
51 |
+ a=dict(a=1), |
|
52 |
+ b=dict(b=2), |
|
53 |
+ result=dict(a=1, b=2) |
|
54 | 54 |
), |
55 |
- dict( |
|
56 |
- a=dict(a=1, c=dict(foo='bar')), |
|
57 |
- b=dict(b=2, c=dict(baz='bam')), |
|
58 |
- result=dict(a=1, b=2, c=dict(baz='bam')) |
|
55 |
+ dict( |
|
56 |
+ a=dict(a=1, c=dict(foo='bar')), |
|
57 |
+ b=dict(b=2, c=dict(baz='bam')), |
|
58 |
+ result=dict(a=1, b=2, c=dict(baz='bam')) |
|
59 | 59 |
), |
60 |
- dict( |
|
61 |
- a=defaultdict(a=1, c=dict(foo='bar')), |
|
62 |
- b=dict(b=2, c=defaultdict(baz='bam')), |
|
63 |
- result=defaultdict(a=1, b=2, c=defaultdict(baz='bam')) |
|
60 |
+ dict( |
|
61 |
+ a=defaultdict(a=1, c=dict(foo='bar')), |
|
62 |
+ b=dict(b=2, c=defaultdict(baz='bam')), |
|
63 |
+ result=defaultdict(a=1, b=2, c=defaultdict(baz='bam')) |
|
64 | 64 |
), |
65 |
- ) |
|
65 |
+ ) |
|
66 | 66 |
|
67 | 67 |
def setUp(self): |
68 | 68 |
pass |
... | ... |
@@ -237,8 +237,8 @@ class TestVariableManager(unittest.TestCase): |
237 | 237 |
inv1.set_playbook_basedir('./') |
238 | 238 |
|
239 | 239 |
play1 = Play.load(dict( |
240 |
- hosts=['all'], |
|
241 |
- roles=['defaults_only1', 'defaults_only2'], |
|
240 |
+ hosts=['all'], |
|
241 |
+ roles=['defaults_only1', 'defaults_only2'], |
|
242 | 242 |
), loader=fake_loader, variable_manager=v) |
243 | 243 |
|
244 | 244 |
# first we assert that the defaults as viewed as a whole are the merged results |
... | ... |
@@ -341,8 +341,8 @@ class TestVariableManager(unittest.TestCase): |
341 | 341 |
}) |
342 | 342 |
|
343 | 343 |
play1 = Play.load(dict( |
344 |
- hosts=['all'], |
|
345 |
- roles=['role1', 'role2'], |
|
344 |
+ hosts=['all'], |
|
345 |
+ roles=['role1', 'role2'], |
|
346 | 346 |
), loader=fake_loader, variable_manager=v) |
347 | 347 |
|
348 | 348 |
# The task defined by common-role exists twice because role1 |