Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
451f05fa
Commit
451f05fa
authored
Nov 12, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1594 from sfromm/issue1342
Add ability to specify syslog facility for modules
parents
2f517f1c
06e54c0b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
1 deletions
+9
-1
hacking/test-module
+2
-0
lib/ansible/constants.py
+1
-0
lib/ansible/module_common.py
+1
-1
lib/ansible/runner/__init__.py
+5
-0
No files found.
hacking/test-module
View file @
451f05fa
...
@@ -35,6 +35,7 @@ import traceback
...
@@ -35,6 +35,7 @@ import traceback
import
optparse
import
optparse
import
ansible.utils
as
utils
import
ansible.utils
as
utils
import
ansible.module_common
as
module_common
import
ansible.module_common
as
module_common
import
ansible.constants
as
C
try
:
try
:
import
json
import
json
...
@@ -83,6 +84,7 @@ def boilerplate_module(modfile, args):
...
@@ -83,6 +84,7 @@ def boilerplate_module(modfile, args):
module_data
=
module_data
.
replace
(
module_common
.
REPLACER
,
module_common
.
MODULE_COMMON
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER
,
module_common
.
MODULE_COMMON
)
encoded_args
=
"
\"\"\"
%
s
\"\"\"
"
%
args
.
replace
(
"
\"
"
,
"
\\\"
"
)
encoded_args
=
"
\"\"\"
%
s
\"\"\"
"
%
args
.
replace
(
"
\"
"
,
"
\\\"
"
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER_ARGS
,
encoded_args
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER_ARGS
,
encoded_args
)
module_data
=
module_data
.
replace
(
'syslog.LOG_USER'
,
"syslog.
%
s"
%
C
.
DEFAULT_SYSLOG_FACILITY
)
modfile2_path
=
os
.
path
.
expanduser
(
"~/.ansible_module_generated"
)
modfile2_path
=
os
.
path
.
expanduser
(
"~/.ansible_module_generated"
)
print
"* including generated source, if any, saving to:
%
s"
%
modfile2_path
print
"* including generated source, if any, saving to:
%
s"
%
modfile2_path
...
...
lib/ansible/constants.py
View file @
451f05fa
...
@@ -88,6 +88,7 @@ DEFAULT_REMOTE_PORT = int(get_config(p, DEFAULTS, 'remote_port', 'ANS
...
@@ -88,6 +88,7 @@ DEFAULT_REMOTE_PORT = int(get_config(p, DEFAULTS, 'remote_port', 'ANS
DEFAULT_TRANSPORT
=
get_config
(
p
,
DEFAULTS
,
'transport'
,
'ANSIBLE_TRANSPORT'
,
'paramiko'
)
DEFAULT_TRANSPORT
=
get_config
(
p
,
DEFAULTS
,
'transport'
,
'ANSIBLE_TRANSPORT'
,
'paramiko'
)
DEFAULT_SCP_IF_SSH
=
get_config
(
p
,
DEFAULTS
,
'scp_if_ssh'
,
'ANSIBLE_SCP_IF_SSH'
,
False
)
DEFAULT_SCP_IF_SSH
=
get_config
(
p
,
DEFAULTS
,
'scp_if_ssh'
,
'ANSIBLE_SCP_IF_SSH'
,
False
)
DEFAULT_MANAGED_STR
=
get_config
(
p
,
DEFAULTS
,
'ansible_managed'
,
None
,
'Ansible managed: {file} modified on
%
Y-
%
m-
%
d
%
H:
%
M:
%
S by {uid} on {host}'
)
DEFAULT_MANAGED_STR
=
get_config
(
p
,
DEFAULTS
,
'ansible_managed'
,
None
,
'Ansible managed: {file} modified on
%
Y-
%
m-
%
d
%
H:
%
M:
%
S by {uid} on {host}'
)
DEFAULT_SYSLOG_FACILITY
=
get_config
(
p
,
DEFAULTS
,
'syslog_facility'
,
'ANSIBLE_SYSLOG_FACILITY'
,
'LOG_USER'
)
DEFAULT_ACTION_PLUGIN_PATH
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'action_plugins'
,
None
,
'/usr/share/ansible_plugins/action_plugins'
))
DEFAULT_ACTION_PLUGIN_PATH
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'action_plugins'
,
None
,
'/usr/share/ansible_plugins/action_plugins'
))
DEFAULT_CALLBACK_PLUGIN_PATH
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'callback_plugins'
,
None
,
'/usr/share/ansible_plugins/callback_plugins'
))
DEFAULT_CALLBACK_PLUGIN_PATH
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'callback_plugins'
,
None
,
'/usr/share/ansible_plugins/callback_plugins'
))
...
...
lib/ansible/module_common.py
View file @
451f05fa
...
@@ -539,7 +539,7 @@ class AnsibleModule(object):
...
@@ -539,7 +539,7 @@ class AnsibleModule(object):
journal.sendv(*journal_args)
journal.sendv(*journal_args)
else:
else:
msg = ''
msg = ''
syslog.openlog('ansible-
%
s'
%
os.path.basename(__file__))
syslog.openlog('ansible-
%
s'
%
os.path.basename(__file__)
, 0, syslog.LOG_USER
)
for arg in log_args:
for arg in log_args:
msg = msg + arg + '=' + str(log_args[arg]) + ' '
msg = msg + arg + '=' + str(log_args[arg]) + ' '
if msg:
if msg:
...
...
lib/ansible/runner/__init__.py
View file @
451f05fa
...
@@ -531,6 +531,11 @@ class Runner(object):
...
@@ -531,6 +531,11 @@ class Runner(object):
module_data
=
module_data
.
replace
(
module_common
.
REPLACER
,
module_common
.
MODULE_COMMON
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER
,
module_common
.
MODULE_COMMON
)
encoded_args
=
"
\"\"\"
%
s
\"\"\"
"
%
module_args
.
replace
(
"
\"
"
,
"
\\\"
"
)
encoded_args
=
"
\"\"\"
%
s
\"\"\"
"
%
module_args
.
replace
(
"
\"
"
,
"
\\\"
"
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER_ARGS
,
encoded_args
)
module_data
=
module_data
.
replace
(
module_common
.
REPLACER_ARGS
,
encoded_args
)
if
is_new_style
:
facility
=
C
.
DEFAULT_SYSLOG_FACILITY
if
'ansible_syslog_facility'
in
inject
:
facility
=
inject
[
'ansible_syslog_facility'
]
module_data
=
module_data
.
replace
(
'syslog.LOG_USER'
,
"syslog.
%
s"
%
facility
)
# use the correct python interpreter for the host
# use the correct python interpreter for the host
if
'ansible_python_interpreter'
in
inject
:
if
'ansible_python_interpreter'
in
inject
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment