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
ebfc7765
Commit
ebfc7765
authored
Mar 12, 2014
by
Richard Isaacson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6444 from risaacson/setup_unsafe_shell
setup module: Mark unsafe commands as use_unsafe_shell=True.
parents
6d841d12
154f123b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
library/system/setup
+17
-17
No files found.
library/system/setup
View file @
ebfc7765
...
...
@@ -260,7 +260,7 @@ class Facts(object):
self
.
facts
[
'distribution_release'
]
=
data
[
1
]
elif
self
.
facts
[
'system'
]
==
'HP-UX'
:
self
.
facts
[
'distribution'
]
=
'HP-UX'
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/swlist |egrep 'HPUX.*OE.*[AB].[0-9]+
\
.[0-9]+'"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/swlist |egrep 'HPUX.*OE.*[AB].[0-9]+
\
.[0-9]+'"
,
use_unsafe_shell
=
True
)
data
=
re
.
search
(
'HPUX.*OE.*([AB].[0-9]+
\
.[0-9]+)
\
.([0-9]+).*'
,
out
)
if
data
:
self
.
facts
[
'distribution_version'
]
=
data
.
groups
()[
0
]
...
...
@@ -1254,31 +1254,31 @@ class HPUX(Hardware):
def
get_cpu_facts
(
self
):
if
self
.
facts
[
'architecture'
]
==
'9000/800'
:
rc
,
out
,
err
=
module
.
run_command
(
"ioscan -FkCprocessor
|wc -l"
)
rc
,
out
,
err
=
module
.
run_command
(
"ioscan -FkCprocessor
| wc -l"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_count'
]
=
int
(
out
.
strip
())
#Working with machinfo mess
elif
self
.
facts
[
'architecture'
]
==
'ia64'
:
if
self
.
facts
[
'distribution_version'
]
==
"B.11.23"
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep 'Number of CPUs'"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep 'Number of CPUs'"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_count'
]
=
int
(
out
.
strip
()
.
split
(
'='
)[
1
])
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep 'processor family'"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep 'processor family'"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor'
]
=
re
.
search
(
'.*(Intel.*)'
,
out
)
.
groups
()[
0
]
.
strip
()
rc
,
out
,
err
=
module
.
run_command
(
"ioscan -FkCprocessor
|wc -l"
)
rc
,
out
,
err
=
module
.
run_command
(
"ioscan -FkCprocessor
| wc -l"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_cores'
]
=
int
(
out
.
strip
())
if
self
.
facts
[
'distribution_version'
]
==
"B.11.31"
:
#if machinfo return cores strings release B.11.31 > 1204
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep core|wc -l"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep core | wc -l"
,
use_unsafe_shell
=
True
)
if
out
.
strip
()
==
'0'
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_count'
]
=
int
(
out
.
strip
()
.
split
(
" "
)[
0
])
#If hyperthreading is active divide cores by 2
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/psrset |
grep LCPU"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/psrset |
grep LCPU"
,
use_unsafe_shell
=
True
)
data
=
re
.
sub
(
' +'
,
' '
,
out
)
.
strip
()
.
split
(
' '
)
if
len
(
data
)
==
1
:
hyperthreading
=
'OFF'
else
:
hyperthreading
=
data
[
1
]
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep logical"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep logical"
,
use_unsafe_shell
=
True
)
data
=
out
.
strip
()
.
split
(
" "
)
if
hyperthreading
==
'ON'
:
self
.
facts
[
'processor_cores'
]
=
int
(
data
[
0
])
/
2
...
...
@@ -1287,19 +1287,19 @@ class HPUX(Hardware):
self
.
facts
[
'processor_cores'
]
=
self
.
facts
[
'processor_count'
]
else
:
self
.
facts
[
'processor_cores'
]
=
int
(
data
[
0
])
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel |cut -d' ' -f4-"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel |cut -d' ' -f4-"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor'
]
=
out
.
strip
()
else
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
egrep 'socket[s]?$' | tail -1"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
egrep 'socket[s]?$' | tail -1"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_count'
]
=
int
(
out
.
strip
()
.
split
(
" "
)[
0
])
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep -e '[0-9] core' |tail -1"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep -e '[0-9] core' | tail -1"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor_cores'
]
=
int
(
out
.
strip
()
.
split
(
" "
)[
0
])
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Intel"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'processor'
]
=
out
.
strip
()
def
get_memory_facts
(
self
):
pagesize
=
4096
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/vmstat
|tail -1"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/vmstat
| tail -1"
,
use_unsafe_shell
=
True
)
data
=
int
(
re
.
sub
(
' +'
,
' '
,
out
)
.
split
(
' '
)[
5
]
.
strip
())
self
.
facts
[
'memfree_mb'
]
=
pagesize
*
data
/
1024
/
1024
if
self
.
facts
[
'architecture'
]
==
'9000/800'
:
...
...
@@ -1307,12 +1307,12 @@ class HPUX(Hardware):
data
=
re
.
search
(
'.*Physical: ([0-9]*) Kbytes.*'
,
out
)
.
groups
()[
0
]
.
strip
()
self
.
facts
[
'memtotal_mb'
]
=
int
(
data
)
/
1024
else
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Memory"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |
grep Memory"
,
use_unsafe_shell
=
True
)
data
=
re
.
search
(
'Memory[
\
:=]*([0-9]*).*MB.*'
,
out
)
.
groups
()[
0
]
.
strip
()
self
.
facts
[
'memtotal_mb'
]
=
int
(
data
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/swapinfo -m -d -f -q"
)
self
.
facts
[
'swaptotal_mb'
]
=
int
(
out
.
strip
())
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/swapinfo -m -d -f |
egrep '^dev|^fs'"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/swapinfo -m -d -f |
egrep '^dev|^fs'"
,
use_unsafe_shell
=
True
)
swap
=
0
for
line
in
out
.
strip
()
.
split
(
'
\n
'
):
swap
+=
int
(
re
.
sub
(
' +'
,
' '
,
line
)
.
split
(
' '
)[
3
]
.
strip
())
...
...
@@ -1322,7 +1322,7 @@ class HPUX(Hardware):
rc
,
out
,
err
=
module
.
run_command
(
"model"
)
self
.
facts
[
'model'
]
=
out
.
strip
()
if
self
.
facts
[
'architecture'
]
==
'ia64'
:
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |grep -i 'Firmware revision' |
grep -v BMC"
)
rc
,
out
,
err
=
module
.
run_command
(
"/usr/contrib/bin/machinfo |grep -i 'Firmware revision' |
grep -v BMC"
,
use_unsafe_shell
=
True
)
self
.
facts
[
'firmware_version'
]
=
out
.
split
(
':'
)[
1
]
.
strip
()
...
...
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