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
ee1af1b1
Commit
ee1af1b1
authored
Apr 02, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10559 from bcoca/become_constants_fix
removed folding sudo/su to become logic from constants
parents
278c1e65
5ec1f3bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
lib/ansible/constants.py
+4
-4
v2/ansible/constants.py
+3
-3
No files found.
lib/ansible/constants.py
View file @
ee1af1b1
...
...
@@ -112,7 +112,6 @@ DEFAULT_POLL_INTERVAL = get_config(p, DEFAULTS, 'poll_interval', 'ANSIBLE
DEFAULT_REMOTE_USER
=
get_config
(
p
,
DEFAULTS
,
'remote_user'
,
'ANSIBLE_REMOTE_USER'
,
active_user
)
DEFAULT_ASK_PASS
=
get_config
(
p
,
DEFAULTS
,
'ask_pass'
,
'ANSIBLE_ASK_PASS'
,
False
,
boolean
=
True
)
DEFAULT_PRIVATE_KEY_FILE
=
shell_expand_path
(
get_config
(
p
,
DEFAULTS
,
'private_key_file'
,
'ANSIBLE_PRIVATE_KEY_FILE'
,
None
))
DEFAULT_SUDO_USER
=
get_config
(
p
,
DEFAULTS
,
'sudo_user'
,
'ANSIBLE_SUDO_USER'
,
'root'
)
DEFAULT_ASK_SUDO_PASS
=
get_config
(
p
,
DEFAULTS
,
'ask_sudo_pass'
,
'ANSIBLE_ASK_SUDO_PASS'
,
False
,
boolean
=
True
)
DEFAULT_REMOTE_PORT
=
get_config
(
p
,
DEFAULTS
,
'remote_port'
,
'ANSIBLE_REMOTE_PORT'
,
None
,
integer
=
True
)
DEFAULT_ASK_VAULT_PASS
=
get_config
(
p
,
DEFAULTS
,
'ask_vault_pass'
,
'ANSIBLE_ASK_VAULT_PASS'
,
False
,
boolean
=
True
)
...
...
@@ -123,6 +122,7 @@ DEFAULT_MANAGED_STR = get_config(p, DEFAULTS, 'ansible_managed', None,
DEFAULT_SYSLOG_FACILITY
=
get_config
(
p
,
DEFAULTS
,
'syslog_facility'
,
'ANSIBLE_SYSLOG_FACILITY'
,
'LOG_USER'
)
DEFAULT_KEEP_REMOTE_FILES
=
get_config
(
p
,
DEFAULTS
,
'keep_remote_files'
,
'ANSIBLE_KEEP_REMOTE_FILES'
,
False
,
boolean
=
True
)
DEFAULT_SUDO
=
get_config
(
p
,
DEFAULTS
,
'sudo'
,
'ANSIBLE_SUDO'
,
False
,
boolean
=
True
)
DEFAULT_SUDO_USER
=
get_config
(
p
,
DEFAULTS
,
'sudo_user'
,
'ANSIBLE_SUDO_USER'
,
'root'
)
DEFAULT_SUDO_EXE
=
get_config
(
p
,
DEFAULTS
,
'sudo_exe'
,
'ANSIBLE_SUDO_EXE'
,
'sudo'
)
DEFAULT_SUDO_FLAGS
=
get_config
(
p
,
DEFAULTS
,
'sudo_flags'
,
'ANSIBLE_SUDO_FLAGS'
,
'-H'
)
DEFAULT_HASH_BEHAVIOUR
=
get_config
(
p
,
DEFAULTS
,
'hash_behaviour'
,
'ANSIBLE_HASH_BEHAVIOUR'
,
'replace'
)
...
...
@@ -139,10 +139,10 @@ DEFAULT_LOG_PATH = shell_expand_path(get_config(p, DEFAULTS, 'log_
#TODO: get rid of ternary chain mess
BECOME_METHODS
=
[
'sudo'
,
'su'
,
'pbrun'
,
'pfexec'
,
'runas'
]
BECOME_ERROR_STRINGS
=
{
'sudo'
:
'Sorry, try again.'
,
'su'
:
'Authentication failure'
,
'pbrun'
:
''
,
'pfexec'
:
''
,
'runas'
:
''
}
DEFAULT_BECOME
=
get_config
(
p
,
'privilege_escalation'
,
'become'
,
'ANSIBLE_BECOME'
,
True
if
DEFAULT_SUDO
or
DEFAULT_SU
else
False
,
boolean
=
True
)
DEFAULT_BECOME
=
get_config
(
p
,
'privilege_escalation'
,
'become'
,
'ANSIBLE_BECOME'
,
False
,
boolean
=
True
)
DEFAULT_BECOME_METHOD
=
get_config
(
p
,
'privilege_escalation'
,
'become_method'
,
'ANSIBLE_BECOME_METHOD'
,
'sudo'
if
DEFAULT_SUDO
else
'su'
if
DEFAULT_SU
else
'sudo'
)
.
lower
()
DEFAULT_BECOME_USER
=
get_config
(
p
,
'privilege_escalation'
,
'become_user'
,
'ANSIBLE_BECOME_USER'
,
DEFAULT_SUDO_USER
if
DEFAULT_SUDO
else
DEFAULT_SU_USER
if
DEFAULT_SU
else
'root'
)
DEFAULT_BECOME_ASK_PASS
=
get_config
(
p
,
'privilege_escalation'
,
'become_ask_pass'
,
'ANSIBLE_BECOME_ASK_PASS'
,
True
if
DEFAULT_ASK_SUDO_PASS
else
False
,
boolean
=
True
)
DEFAULT_BECOME_USER
=
get_config
(
p
,
'privilege_escalation'
,
'become_user'
,
'ANSIBLE_BECOME_USER'
,
default
=
None
)
DEFAULT_BECOME_ASK_PASS
=
get_config
(
p
,
'privilege_escalation'
,
'become_ask_pass'
,
'ANSIBLE_BECOME_ASK_PASS'
,
False
,
boolean
=
True
)
# need to rethink impementing these 2
DEFAULT_BECOME_EXE
=
None
#DEFAULT_BECOME_EXE = get_config(p, DEFAULTS, 'become_exe', 'ANSIBLE_BECOME_EXE','sudo' if DEFAULT_SUDO else 'su' if DEFAULT_SU else 'sudo')
...
...
v2/ansible/constants.py
View file @
ee1af1b1
...
...
@@ -145,10 +145,10 @@ DEFAULT_LOG_PATH = shell_expand_path(get_config(p, DEFAULTS, 'log_
#TODO: get rid of ternary chain mess
BECOME_METHODS
=
[
'sudo'
,
'su'
,
'pbrun'
,
'pfexec'
,
'runas'
]
BECOME_ERROR_STRINGS
=
{
'sudo'
:
'Sorry, try again.'
,
'su'
:
'Authentication failure'
,
'pbrun'
:
''
,
'pfexec'
:
''
,
'runas'
:
''
}
DEFAULT_BECOME
=
get_config
(
p
,
'privilege_escalation'
,
'become'
,
'ANSIBLE_BECOME'
,
True
if
DEFAULT_SUDO
or
DEFAULT_SU
else
False
,
boolean
=
True
)
DEFAULT_BECOME
=
get_config
(
p
,
'privilege_escalation'
,
'become'
,
'ANSIBLE_BECOME'
,
False
,
boolean
=
True
)
DEFAULT_BECOME_METHOD
=
get_config
(
p
,
'privilege_escalation'
,
'become_method'
,
'ANSIBLE_BECOME_METHOD'
,
'sudo'
if
DEFAULT_SUDO
else
'su'
if
DEFAULT_SU
else
'sudo'
)
.
lower
()
DEFAULT_BECOME_USER
=
get_config
(
p
,
'privilege_escalation'
,
'become_user'
,
'ANSIBLE_BECOME_USER'
,
DEFAULT_SUDO_USER
if
DEFAULT_SUDO
else
DEFAULT_SU_USER
if
DEFAULT_SU
else
'root'
)
DEFAULT_BECOME_ASK_PASS
=
get_config
(
p
,
'privilege_escalation'
,
'become_ask_pass'
,
'ANSIBLE_BECOME_ASK_PASS'
,
True
if
DEFAULT_ASK_SUDO_PASS
else
False
,
boolean
=
True
)
DEFAULT_BECOME_USER
=
get_config
(
p
,
'privilege_escalation'
,
'become_user'
,
'ANSIBLE_BECOME_USER'
,
None
)
DEFAULT_BECOME_ASK_PASS
=
get_config
(
p
,
'privilege_escalation'
,
'become_ask_pass'
,
'ANSIBLE_BECOME_ASK_PASS'
,
False
,
boolean
=
True
)
# need to rethink impementing these 2
DEFAULT_BECOME_EXE
=
None
#DEFAULT_BECOME_EXE = get_config(p, DEFAULTS, 'become_exe', 'ANSIBLE_BECOME_EXE','sudo' if DEFAULT_SUDO else 'su' if DEFAULT_SU else 'sudo')
...
...
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