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
453d4737
Commit
453d4737
authored
Feb 05, 2014
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes as per feedback
parent
35980ef3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
library/system/debconf
+23
-24
No files found.
library/system/debconf
View file @
453d4737
...
...
@@ -45,7 +45,7 @@ options:
required: false
default: null
aliases: ['question', 'selection']
type:
v
type:
description:
- The type of the value supplied
required: false
...
...
@@ -57,7 +57,7 @@ options:
- Value to set the configuration to
required: false
default: null
aliases: ['a
wns
er']
aliases: ['a
nsw
er']
unseen:
description:
- Do not set 'seen' flag when pre-seeding
...
...
@@ -76,33 +76,33 @@ debconf: name=locales setting='locales/default_environment_locale' value=fr_FR.U
debconf: name=locales setting='locales/locales_to_be_generated value='en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8'
# Accept oracle license
debconf: names='oracle-java7-installer' question='shared/accepted-oracle-license-v1-1' value='true' type='select'
debconf: names='oracle-java7-installer' question='shared/accepted-oracle-license-v1-1' value='true'
v
type='select'
'''
def
get_selections
(
module
,
pkg
):
cmd
=
[
module
.
get_bin_path
(
'debconf-show'
,
True
),
pkg
]
rc
,
out
,
err
=
module
.
run_command
(
' '
.
join
(
cmd
))
if
rc
==
0
:
selections
=
{}
for
line
in
out
.
splitlines
():
#if not line.startswith('*'): # only awnsered
# continue
(
key
,
value
)
=
line
.
split
(
':'
)
selections
[
key
.
strip
(
'*'
)
.
strip
()
]
=
value
.
strip
()
return
selections
else
:
if
rc
!=
0
:
module
.
fail_json
(
msg
=
err
)
selections
=
{}
for
line
in
out
.
splitlines
():
(
key
,
value
)
=
line
.
split
(
':'
)
selections
[
key
.
strip
(
'*'
)
.
strip
()
]
=
value
.
strip
()
return
selections
def
set_selection
(
module
,
pkg
,
question
,
type
,
value
,
unseen
):
def
set_selection
(
module
,
pkg
,
question
,
v
type
,
value
,
unseen
):
a
wns
er
=
[
question
]
if
'type'
:
a
wnser
.
append
(
type
)
a
wns
er
.
append
(
value
)
a
nsw
er
=
[
question
]
if
'
v
type'
:
a
nswer
.
append
(
v
type
)
a
nsw
er
.
append
(
value
)
data
=
' '
.
join
(
a
wns
er
)
data
=
' '
.
join
(
a
nsw
er
)
setsel
=
module
.
get_bin_path
(
'debconf-set-selections'
,
True
)
cmd
=
[
"echo '
%
s
%
s' |"
%
(
pkg
,
data
),
setsel
]
...
...
@@ -117,7 +117,7 @@ def main():
argument_spec
=
dict
(
name
=
dict
(
required
=
True
,
aliases
=
[
'pkg'
],
type
=
'str'
),
setting
=
dict
(
required
=
False
,
aliases
=
[
'question'
,
'selection'
],
type
=
'str'
),
type
=
dict
(
required
=
False
,
type
=
'str'
,
choices
=
[
'string'
,
'boolean'
,
'select'
,
'multiselect'
,
'note'
,
'text'
,
'password'
,
'title'
]),
v
type
=
dict
(
required
=
False
,
type
=
'str'
,
choices
=
[
'string'
,
'boolean'
,
'select'
,
'multiselect'
,
'note'
,
'text'
,
'password'
,
'title'
]),
value
=
dict
(
required
=
False
,
type
=
'str'
),
unseen
=
dict
(
required
=
False
,
type
=
'bool'
),
),
...
...
@@ -127,7 +127,7 @@ def main():
#TODO: enable passing array of optionas and/or debconf file from get-selections dump
pkg
=
module
.
params
[
"name"
]
question
=
module
.
params
[
"setting"
]
type
=
module
.
params
[
"
type"
]
vtype
=
module
.
params
[
"v
type"
]
value
=
module
.
params
[
"value"
]
unseen
=
module
.
params
[
"unseen"
]
...
...
@@ -143,7 +143,7 @@ def main():
if
changed
:
if
not
module
.
check_mode
:
rc
,
msg
,
e
=
set_selection
(
module
,
pkg
,
question
,
type
,
value
,
unseen
)
rc
,
msg
,
e
=
set_selection
(
module
,
pkg
,
question
,
v
type
,
value
,
unseen
)
if
rc
:
module
.
fail_json
(
msg
=
e
)
...
...
@@ -157,6 +157,5 @@ def main():
module
.
exit_json
(
changed
=
changed
,
msg
=
msg
,
current
=
prev
)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main
()
# import module snippets
from
ansible.module_utils.basic
import
*
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