Merge remote-tracking branch 'master/release1.8.2' into devel

reviewable/pr18780/r1
Michael Groening 10 years ago
commit 7b6bc198df

@ -0,0 +1 @@
1.8.2

@ -159,9 +159,10 @@ def start_slave(cursor):
return started return started
def changemaster(cursor, chm): def changemaster(cursor, chm, chm_params):
SQLPARAM = ",".join(chm) sql_param = ",".join(chm)
cursor.execute("CHANGE MASTER TO " + SQLPARAM) query = 'CHANGE MASTER TO %s' % sql_param
cursor.execute(query, chm_params)
def strip_quotes(s): def strip_quotes(s):
@ -318,37 +319,52 @@ def main():
elif mode in "changemaster": elif mode in "changemaster":
print "Change master" print "Change master"
chm=[] chm=[]
chm_params = {}
if master_host: if master_host:
chm.append("MASTER_HOST='" + master_host + "'") chm.append("MASTER_HOST=%(master_host)s")
chm_params['master_host'] = master_host
if master_user: if master_user:
chm.append("MASTER_USER='" + master_user + "'") chm.append("MASTER_USER=%(master_user)s")
chm_params['master_user'] = master_user
if master_password: if master_password:
chm.append("MASTER_PASSWORD='" + master_password + "'") chm.append("MASTER_PASSWORD=%(master_password)s")
chm_params['master_password'] = master_password
if master_port: if master_port:
chm.append("MASTER_PORT=" + master_port) chm.append("MASTER_PORT=%(master_port)s")
chm_params['master_port'] = master_port
if master_connect_retry: if master_connect_retry:
chm.append("MASTER_CONNECT_RETRY='" + master_connect_retry + "'") chm.append("MASTER_CONNECT_RETRY=%(master_connect_retry)s")
chm_params['master_connect_retry'] = master_connect_retry
if master_log_file: if master_log_file:
chm.append("MASTER_LOG_FILE='" + master_log_file + "'") chm.append("MASTER_LOG_FILE=%(master_log_file)s")
chm_params['master_log_file'] = master_log_file
if master_log_pos: if master_log_pos:
chm.append("MASTER_LOG_POS=" + master_log_pos) chm.append("MASTER_LOG_POS=%(master_log_pos)s")
chm_params['master_log_pos'] = master_log_pos
if relay_log_file: if relay_log_file:
chm.append("RELAY_LOG_FILE='" + relay_log_file + "'") chm.append("RELAY_LOG_FILE=%(relay_log_file)s")
chm_params['relay_log_file'] = relay_log_file
if relay_log_pos: if relay_log_pos:
chm.append("RELAY_LOG_POS=" + relay_log_pos) chm.append("RELAY_LOG_POS=%(relay_log_pos)s")
chm_params['relay_log_pos'] = relay_log_pos
if master_ssl: if master_ssl:
chm.append("MASTER_SSL=1") chm.append("MASTER_SSL=1")
if master_ssl_ca: if master_ssl_ca:
chm.append("MASTER_SSL_CA='" + master_ssl_ca + "'") chm.append("MASTER_SSL_CA=%(master_ssl_ca)s")
chm_params['master_ssl_ca'] = master_ssl_ca
if master_ssl_capath: if master_ssl_capath:
chm.append("MASTER_SSL_CAPATH='" + master_ssl_capath + "'") chm.append("MASTER_SSL_CAPATH=%(master_ssl_capath)s")
chm_params['master_ssl_capath'] = master_ssl_capath
if master_ssl_cert: if master_ssl_cert:
chm.append("MASTER_SSL_CERT='" + master_ssl_cert + "'") chm.append("MASTER_SSL_CERT=%(master_ssl_cert)s")
chm_params['master_ssl_cert'] = master_ssl_cert
if master_ssl_key: if master_ssl_key:
chm.append("MASTER_SSL_KEY='" + master_ssl_key + "'") chm.append("MASTER_SSL_KEY=%(master_ssl_key)s")
chm_params['master_ssl_key'] = master_ssl_key
if master_ssl_cipher: if master_ssl_cipher:
chm.append("MASTER_SSL_CIPHER='" + master_ssl_cipher + "'") chm.append("MASTER_SSL_CIPHER=%(master_ssl_cipher)s")
changemaster(cursor,chm) chm_params['master_ssl_cipher'] = master_ssl_cipher
changemaster(cursor, chm, chm_params)
module.exit_json(changed=True) module.exit_json(changed=True)
elif mode in "startslave": elif mode in "startslave":
started = start_slave(cursor) started = start_slave(cursor)
@ -366,4 +382,4 @@ def main():
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
main() main()
warnings.simplefilter("ignore") warnings.simplefilter("ignore")

@ -97,7 +97,7 @@ author: Alex Coomans
''' '''
EXAMPLES = ''' EXAMPLES = '''
# authenicate using email and API token # authenticate using email and API token
- local_action: dnsimple account_email=test@example.com account_api_token=dummyapitoken - local_action: dnsimple account_email=test@example.com account_api_token=dummyapitoken
# fetch all domains # fetch all domains

@ -96,4 +96,5 @@ def main():
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.urls import *
main() main()

@ -105,8 +105,7 @@ EXAMPLES = """
""" """
SLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s'
SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s'
def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse): def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse):
payload = dict(text=text) payload = dict(text=text)
@ -128,11 +127,11 @@ def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoj
return payload return payload
def do_notify_slack(module, domain, token, payload): def do_notify_slack(module, domain, token, payload):
slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, token) slack_incoming_webhook = SLACK_INCOMING_WEBHOOK % (token)
response, info = fetch_url(module, slack_incoming_webhook, data=payload) response, info = fetch_url(module, slack_incoming_webhook, data=payload)
if info['status'] != 200: if info['status'] != 200:
obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % (domain, '[obscured]') obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]')
module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg'])) module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg']))
def main(): def main():
@ -170,4 +169,4 @@ def main():
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.urls import * from ansible.module_utils.urls import *
main() main()

@ -33,9 +33,9 @@ DOCUMENTATION = '''
module: zypper module: zypper
author: Patrick Callahan author: Patrick Callahan
version_added: "1.2" version_added: "1.2"
short_description: Manage packages on SuSE and openSuSE short_description: Manage packages on SUSE and openSUSE
description: description:
- Manage packages on SuSE and openSuSE using the zypper and rpm tools. - Manage packages on SUSE and openSUSE using the zypper and rpm tools.
options: options:
name: name:
description: description:

@ -26,7 +26,7 @@ module: getent
short_description: a wrapper to the unix getent utility short_description: a wrapper to the unix getent utility
description: description:
- Runs getent against one of it's various databases and returns information into - Runs getent against one of it's various databases and returns information into
the host's facts the host's facts, in a getent_<database> prefixed variable
version_added: "1.8" version_added: "1.8"
options: options:
database: database:
@ -51,7 +51,7 @@ options:
description: description:
- If a supplied key is missing this will make the task fail if True - If a supplied key is missing this will make the task fail if True
notes: notes:
- "Not all databases support enumeration, check system documentation for details" - "Not all databases support enumeration, check system documentation for details"
requirements: [ ] requirements: [ ]
author: Brian Coca author: Brian Coca
@ -60,23 +60,23 @@ author: Brian Coca
EXAMPLES = ''' EXAMPLES = '''
# get root user info # get root user info
- getent: database=passwd key=root - getent: database=passwd key=root
register: root_info - debug: var=getent_passwd
# get all groups # get all groups
- getent: database=group split=':' - getent: database=group split=':'
register: groups - debug: var=getent_group
# get all hosts, split by tab # get all hosts, split by tab
- getent: database=hosts - getent: database=hosts
register: hosts - debug: var=getent_hosts
# get http service info, no error if missing # get http service info, no error if missing
- getent: database=services key=http fail_key=False - getent: database=services key=http fail_key=False
register: http_info - debug: var=getent_services
# get user password hash (requires sudo/root) # get user password hash (requires sudo/root)
- getent: database=shadow key=www-data split=: - getent: database=shadow key=www-data split=:
register: pw_hash - debug: var=getent_shadow
''' '''

Loading…
Cancel
Save