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
65fe7b70
Commit
65fe7b70
authored
Sep 16, 2012
by
Stephen Fromm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update package manager fact innards to a list of dicts
parent
94eb11a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
library/setup
+9
-6
No files found.
library/setup
View file @
65fe7b70
...
...
@@ -54,9 +54,12 @@ class Facts(object):
'/etc/vmware-release'
:
'VMwareESX'
}
SELINUX_MODE_DICT
=
{
1
:
'enforcing'
,
0
:
'permissive'
,
-
1
:
'disabled'
}
PKG_MGR_DICT
=
{
'/usr/bin/yum'
:
'yum'
,
'/usr/bin/apt-get'
:
'apt'
,
'/usr/bin/zypper'
:
'zypper'
}
# A list of dicts. If there is a platform with more than one
# package manager, put the preferred one last. If there is an
# ansible module, use that as the value for the 'name' key.
PKG_MGRS
=
[
{
'path'
:
'/usr/bin/yum'
,
'name'
:
'yum'
},
{
'path'
:
'/usr/bin/apt-get'
,
'name'
:
'apt'
},
{
'path'
:
'/usr/bin/zypper'
,
'name'
:
'zypper'
}
]
def
__init__
(
self
):
self
.
facts
=
{}
...
...
@@ -140,9 +143,9 @@ class Facts(object):
def
get_pkg_mgr_facts
(
self
):
self
.
facts
[
'pkg_mgr'
]
=
'unknown'
for
(
path
,
name
)
in
Facts
.
PKG_MGR_DICT
.
items
()
:
if
os
.
path
.
exists
(
p
ath
):
self
.
facts
[
'pkg_mgr'
]
=
name
for
pkg
in
Facts
.
PKG_MGRS
:
if
os
.
path
.
exists
(
p
kg
[
'path'
]
):
self
.
facts
[
'pkg_mgr'
]
=
pkg
[
'name'
]
def
get_selinux_facts
(
self
):
if
not
HAVE_SELINUX
:
...
...
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