mirror of https://github.com/ansible/ansible.git
Merge branch 'devel' into unevaluated-vars
commit
8d919d6c97
@ -0,0 +1,146 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# (c) 2013, Darryl Stoflet <stoflet@gmail.com>
|
||||||
|
#
|
||||||
|
# This file is part of Ansible
|
||||||
|
#
|
||||||
|
# Ansible is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Ansible is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
---
|
||||||
|
module: monit
|
||||||
|
short_description: Manage the state of a program monitored via Monit
|
||||||
|
description:
|
||||||
|
- Manage the state of a program monitored via I(Monit)
|
||||||
|
version_added: "1.2"
|
||||||
|
options:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The name of the I(monit) program/process to manage
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
state:
|
||||||
|
description:
|
||||||
|
- The state of service
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: [ "present", "started", "stopped", "restarted", "monitored", "unmonitored", "reloaded" ]
|
||||||
|
examples:
|
||||||
|
- code: "monit: name=httpd state=started"
|
||||||
|
description: Manage the state of program I(httpd) to be in I(started) state.
|
||||||
|
requirements: [ ]
|
||||||
|
author: Darryl Stoflet
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
arg_spec = dict(
|
||||||
|
name=dict(required=True),
|
||||||
|
state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped', 'monitored', 'unmonitored', 'reloaded'])
|
||||||
|
)
|
||||||
|
|
||||||
|
module = AnsibleModule(argument_spec=arg_spec, supports_check_mode=True)
|
||||||
|
|
||||||
|
name = module.params['name']
|
||||||
|
state = module.params['state']
|
||||||
|
|
||||||
|
MONIT = module.get_bin_path('monit', True)
|
||||||
|
|
||||||
|
if state == 'reloaded':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
rc, out, err = module.run_command('%s reload' % MONIT)
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
|
||||||
|
rc, out, err = module.run_command('%s summary | grep "Process \'%s\'"' % (MONIT, name))
|
||||||
|
present = name in out
|
||||||
|
|
||||||
|
if not present and not state == 'present':
|
||||||
|
module.fail_json(msg='%s process not presently configured with monit' % name, name=name, state=state)
|
||||||
|
|
||||||
|
if state == 'present':
|
||||||
|
if not present:
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s reload' % MONIT, check_rc=True)
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
if name in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
else:
|
||||||
|
module.fail_json(msg=out, name=name, state=state)
|
||||||
|
|
||||||
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
running = 'Running' in out
|
||||||
|
|
||||||
|
if running and (state == 'started' or state == 'monitored'):
|
||||||
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
|
if running and state == 'monitored':
|
||||||
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
|
if running and state == 'stopped':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s stop %s' % (MONIT, name))
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
if 'Not monitored' in out or 'stop pending' in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
module.fail_json(msg=out)
|
||||||
|
|
||||||
|
if running and state == 'unmonitored':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s unmonitor %s' % (MONIT, name))
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
if 'Not monitored' in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
module.fail_json(msg=out)
|
||||||
|
|
||||||
|
elif state == 'restarted':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s stop %s' % (MONIT, name))
|
||||||
|
rc, out, err = module.run_command('%s start %s' % (MONIT, name))
|
||||||
|
if 'Initializing' in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
module.fail_json(msg=out)
|
||||||
|
|
||||||
|
elif not running and state == 'started':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s start %s' % (MONIT, name))
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
if 'Initializing' in out or 'start pending' in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
module.fail_json(msg=out)
|
||||||
|
|
||||||
|
elif not running and state == 'monitored':
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
|
module.run_command('%s monitor %s' % (MONIT, name))
|
||||||
|
rc, out, err = module.run_command('%s summary | grep %s' % (MONIT, name))
|
||||||
|
if 'Initializing' in out or 'start pending' in out:
|
||||||
|
module.exit_json(changed=True, name=name, state=state)
|
||||||
|
module.fail_json(msg=out)
|
||||||
|
|
||||||
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
|
# this is magic, see lib/ansible/module_common.py
|
||||||
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||||
|
|
||||||
|
main()
|
||||||
@ -0,0 +1,154 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
|
||||||
|
module: pagerduty
|
||||||
|
short_description: Create PagerDuty maintenance windows
|
||||||
|
description:
|
||||||
|
- This module will let you create PagerDuty maintenance windows
|
||||||
|
version_added: "1.2"
|
||||||
|
author: Justin Johns
|
||||||
|
requirements:
|
||||||
|
- PagerDuty API access
|
||||||
|
options:
|
||||||
|
state:
|
||||||
|
description:
|
||||||
|
- Create a maintenance window or get a list of ongoing windows.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: [ "running", "started", "ongoing" ]
|
||||||
|
aliases: []
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- PagerDuty unique subdomain.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
user:
|
||||||
|
description:
|
||||||
|
- PagerDuty user ID.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
passwd:
|
||||||
|
description:
|
||||||
|
- PagerDuty user password.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
service:
|
||||||
|
description:
|
||||||
|
- PagerDuty service ID.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
hours:
|
||||||
|
description:
|
||||||
|
- Length of maintenance window in hours.
|
||||||
|
required: false
|
||||||
|
default: 1
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
desc:
|
||||||
|
description:
|
||||||
|
- Short description of maintenance window.
|
||||||
|
required: false
|
||||||
|
default: Created by Ansible
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
notes:
|
||||||
|
- This module does not yet have support to end maintenance windows.
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES='''
|
||||||
|
# List ongoing maintenance windows.
|
||||||
|
pagerduty: name=companyabc user=example@example.com passwd=password123 state=ongoing
|
||||||
|
|
||||||
|
# Create a 1 hour maintenance window for service FOO123.
|
||||||
|
pagerduty: name=companyabc user=example@example.com passwd=password123 state=running service=FOO123"
|
||||||
|
|
||||||
|
# Create a 4 hour maintenance window for service FOO123 with the description "deployment".
|
||||||
|
pagerduty: name=companyabc user=example@example.com passwd=password123 state=running service=FOO123 hours=4 desc=deployment"
|
||||||
|
'''
|
||||||
|
|
||||||
|
import json
|
||||||
|
import datetime
|
||||||
|
import urllib2
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
|
def ongoing(name, user, passwd):
|
||||||
|
|
||||||
|
url = "https://" + name + ".pagerduty.com/api/v1/maintenance_windows/ongoing"
|
||||||
|
auth = base64.encodestring('%s:%s' % (user, passwd)).replace('\n', '')
|
||||||
|
|
||||||
|
req = urllib2.Request(url)
|
||||||
|
req.add_header("Authorization", "Basic %s" % auth)
|
||||||
|
res = urllib2.urlopen(req)
|
||||||
|
out = res.read()
|
||||||
|
|
||||||
|
return False, out
|
||||||
|
|
||||||
|
|
||||||
|
def create(name, user, passwd, service, hours, desc):
|
||||||
|
|
||||||
|
now = datetime.datetime.utcnow()
|
||||||
|
later = now + datetime.timedelta(hours=int(hours))
|
||||||
|
start = now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
end = later.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
|
url = "https://" + name + ".pagerduty.com/api/v1/maintenance_windows"
|
||||||
|
auth = base64.encodestring('%s:%s' % (user, passwd)).replace('\n', '')
|
||||||
|
data = json.dumps({'maintenance_window': {'start_time': start, 'end_time': end, 'description': desc, 'service_ids': [service]}})
|
||||||
|
|
||||||
|
req = urllib2.Request(url, data)
|
||||||
|
req.add_header("Authorization", "Basic %s" % auth)
|
||||||
|
req.add_header('Content-Type', 'application/json')
|
||||||
|
res = urllib2.urlopen(req)
|
||||||
|
out = res.read()
|
||||||
|
|
||||||
|
return False, out
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
state=dict(required=True, choices=['running', 'started', 'ongoing']),
|
||||||
|
name=dict(required=True),
|
||||||
|
user=dict(required=True),
|
||||||
|
passwd=dict(required=True),
|
||||||
|
service=dict(required=False),
|
||||||
|
hours=dict(default='1', required=False),
|
||||||
|
desc=dict(default='Created by Ansible', required=False)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
state = module.params['state']
|
||||||
|
name = module.params['name']
|
||||||
|
user = module.params['user']
|
||||||
|
passwd = module.params['passwd']
|
||||||
|
service = module.params['service']
|
||||||
|
hours = module.params['hours']
|
||||||
|
desc = module.params['desc']
|
||||||
|
|
||||||
|
if state == "running" or state == "started":
|
||||||
|
if not service:
|
||||||
|
module.fail_json(msg="service not specified")
|
||||||
|
(rc, out) = create(name, user, passwd, service, hours, desc)
|
||||||
|
|
||||||
|
if state == "ongoing":
|
||||||
|
(rc, out) = ongoing(name, user, passwd)
|
||||||
|
|
||||||
|
if rc != 0:
|
||||||
|
module.fail_json(msg="failed", result=out)
|
||||||
|
|
||||||
|
module.exit_json(msg="success", result=out)
|
||||||
|
|
||||||
|
# include magic from lib/ansible/module_common.py
|
||||||
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||||
|
main()
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
DOCUMENTATION = '''
|
||||||
|
|
||||||
|
module: pingdom
|
||||||
|
short_description: Pause/unpause Pingdom alerts
|
||||||
|
description:
|
||||||
|
- This module will let you pause/unpause Pingdom alerts
|
||||||
|
version_added: "1.2"
|
||||||
|
author: Justin Johns
|
||||||
|
requirements:
|
||||||
|
- "pingdom python library"
|
||||||
|
options:
|
||||||
|
state:
|
||||||
|
description:
|
||||||
|
- Define whether or not the check should be running or paused.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: [ "running", "paused" ]
|
||||||
|
aliases: []
|
||||||
|
checkid:
|
||||||
|
description:
|
||||||
|
- Pingdom ID of the check.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
uid:
|
||||||
|
description:
|
||||||
|
- Pingdom user ID.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
passwd:
|
||||||
|
description:
|
||||||
|
- Pingdom user password.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
key:
|
||||||
|
description:
|
||||||
|
- Pingdom API key.
|
||||||
|
required: true
|
||||||
|
default: null
|
||||||
|
choices: []
|
||||||
|
aliases: []
|
||||||
|
notes:
|
||||||
|
- This module does not yet have support to add/remove checks.
|
||||||
|
'''
|
||||||
|
|
||||||
|
EXAMPLES = '''
|
||||||
|
# Pause the check with the ID of 12345.
|
||||||
|
pingdom: uid=example@example.com passwd=password123 key=apipassword123 checkid=12345 state=paused
|
||||||
|
|
||||||
|
# Unpause the check with the ID of 12345.
|
||||||
|
pingdom: uid=example@example.com passwd=password123 key=apipassword123 checkid=12345 state=running
|
||||||
|
'''
|
||||||
|
|
||||||
|
import pingdom
|
||||||
|
|
||||||
|
|
||||||
|
def pause(checkid, uid, passwd, key):
|
||||||
|
|
||||||
|
c = pingdom.PingdomConnection(uid, passwd, key)
|
||||||
|
c.modify_check(checkid, paused=True)
|
||||||
|
check = c.get_check(checkid)
|
||||||
|
name = check.name
|
||||||
|
result = check.status
|
||||||
|
#if result != "paused": # api output buggy - accept raw exception for now
|
||||||
|
# return (True, name, result)
|
||||||
|
return (False, name, result)
|
||||||
|
|
||||||
|
|
||||||
|
def unpause(checkid, uid, passwd, key):
|
||||||
|
|
||||||
|
c = pingdom.PingdomConnection(uid, passwd, key)
|
||||||
|
c.modify_check(checkid, paused=False)
|
||||||
|
check = c.get_check(checkid)
|
||||||
|
name = check.name
|
||||||
|
result = check.status
|
||||||
|
#if result != "up": # api output buggy - accept raw exception for now
|
||||||
|
# return (True, name, result)
|
||||||
|
return (False, name, result)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
module = AnsibleModule(
|
||||||
|
argument_spec=dict(
|
||||||
|
state=dict(required=True, choices=['running', 'paused', 'started', 'stopped']),
|
||||||
|
checkid=dict(required=True),
|
||||||
|
uid=dict(required=True),
|
||||||
|
passwd=dict(required=True),
|
||||||
|
key=dict(required=True)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
checkid = module.params['checkid']
|
||||||
|
state = module.params['state']
|
||||||
|
uid = module.params['uid']
|
||||||
|
passwd = module.params['passwd']
|
||||||
|
key = module.params['key']
|
||||||
|
|
||||||
|
if (state == "paused" or state == "stopped"):
|
||||||
|
(rc, name, result) = pause(checkid, uid, passwd, key)
|
||||||
|
|
||||||
|
if (state == "running" or state == "started"):
|
||||||
|
(rc, name, result) = unpause(checkid, uid, passwd, key)
|
||||||
|
|
||||||
|
if rc != 0:
|
||||||
|
module.fail_json(checkid=checkid, name=name, status=result)
|
||||||
|
|
||||||
|
module.exit_json(checkid=checkid, name=name, status=result)
|
||||||
|
|
||||||
|
# include magic from lib/ansible/module_common.py
|
||||||
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||||
|
main()
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""
|
||||||
|
Vagrant external inventory script. Automatically finds the IP of the booted vagrant vm(s), and
|
||||||
|
returns it under the host group 'vagrant'
|
||||||
|
|
||||||
|
Example Vagrant configuration using this script:
|
||||||
|
|
||||||
|
config.vm.provision :ansible do |ansible|
|
||||||
|
ansible.playbook = "./provision/your_playbook.yml"
|
||||||
|
ansible.inventory_file = "./provision/inventory/vagrant.py"
|
||||||
|
ansible.verbose = true
|
||||||
|
end
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Copyright (C) 2013 Mark Mandel <mark@compoundtheory.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Thanks to the spacewalk.py inventory script for giving me the basic structure
|
||||||
|
# of this.
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
import string
|
||||||
|
from optparse import OptionParser
|
||||||
|
try:
|
||||||
|
import json
|
||||||
|
except:
|
||||||
|
import simplejson as json
|
||||||
|
|
||||||
|
# Options
|
||||||
|
#------------------------------
|
||||||
|
|
||||||
|
parser = OptionParser(usage="%prog [options] --list | --host <machine>")
|
||||||
|
parser.add_option('--list', default=False, dest="list", action="store_true",
|
||||||
|
help="Produce a JSON consumable grouping of Vagrant servers for Ansible")
|
||||||
|
parser.add_option('--host', default=None, dest="host",
|
||||||
|
help="Generate additional host specific details for given host for Ansible")
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
#
|
||||||
|
# helper functions
|
||||||
|
#
|
||||||
|
|
||||||
|
# get all the ssh configs for all boxes in an array of dictionaries.
|
||||||
|
def get_ssh_config():
|
||||||
|
configs = []
|
||||||
|
|
||||||
|
boxes = list_running_boxes()
|
||||||
|
|
||||||
|
for box in boxes:
|
||||||
|
config = get_a_ssh_config(box)
|
||||||
|
configs.append(config)
|
||||||
|
|
||||||
|
return configs
|
||||||
|
|
||||||
|
#list all the running boxes
|
||||||
|
def list_running_boxes():
|
||||||
|
output = subprocess.check_output(["vagrant", "status"]).split('\n')
|
||||||
|
|
||||||
|
boxes = []
|
||||||
|
|
||||||
|
for line in output:
|
||||||
|
matcher = re.search("([^\s]+)[\s]+running \(.+", line)
|
||||||
|
if matcher:
|
||||||
|
boxes.append(matcher.group(1))
|
||||||
|
|
||||||
|
|
||||||
|
return boxes
|
||||||
|
|
||||||
|
#get the ssh config for a single box
|
||||||
|
def get_a_ssh_config(box_name):
|
||||||
|
"""Gives back a map of all the machine's ssh configurations"""
|
||||||
|
|
||||||
|
output = subprocess.check_output(["vagrant", "ssh-config", box_name]).split('\n')
|
||||||
|
|
||||||
|
config = {}
|
||||||
|
for line in output:
|
||||||
|
if line.strip() != '':
|
||||||
|
matcher = re.search("( )?([a-zA-Z]+) (.*)", line)
|
||||||
|
config[matcher.group(2)] = matcher.group(3)
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
# List out servers that vagrant has running
|
||||||
|
#------------------------------
|
||||||
|
if options.list:
|
||||||
|
ssh_config = get_ssh_config()
|
||||||
|
hosts = { 'vagrant': []}
|
||||||
|
|
||||||
|
for data in ssh_config:
|
||||||
|
hosts['vagrant'].append(data['HostName'])
|
||||||
|
|
||||||
|
print json.dumps(hosts)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Get out the host details
|
||||||
|
#------------------------------
|
||||||
|
elif options.host:
|
||||||
|
result = {}
|
||||||
|
ssh_config = get_ssh_config()
|
||||||
|
|
||||||
|
details = filter(lambda x: (x['HostName'] == options.host), ssh_config)
|
||||||
|
if len(details) > 0:
|
||||||
|
#pass through the port, in case it's non standard.
|
||||||
|
result = details[0]
|
||||||
|
result['ansible_ssh_port'] = result['Port']
|
||||||
|
|
||||||
|
print json.dumps(result)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
# Print out help
|
||||||
|
#------------------------------
|
||||||
|
else:
|
||||||
|
parser.print_help()
|
||||||
|
sys.exit(1)
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
[major-god] # group with inline comments
|
||||||
|
zeus var_a=1 # host with inline comments
|
||||||
|
# A comment
|
||||||
|
thor
|
||||||
|
|
||||||
|
[minor-god] # group with inline comment and unbalanced quotes: ' "
|
||||||
|
morpheus # host with inline comments and unbalanced quotes: ' "
|
||||||
|
# A comment with unbalanced quotes: ' "
|
||||||
Loading…
Reference in New Issue