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
033c7d9d
Commit
033c7d9d
authored
Mar 10, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2274 from jcftang/setup-osx-facts
Start of more OSX facts for setup
parents
80cd277d
7653c4ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
2 deletions
+42
-2
library/setup
+42
-2
No files found.
library/setup
View file @
033c7d9d
...
...
@@ -110,7 +110,8 @@ class Facts(object):
{
'path'
:
'/usr/bin/zypper'
,
'name'
:
'zypper'
},
{
'path'
:
'/usr/bin/pacman'
,
'name'
:
'pacman'
},
{
'path'
:
'/bin/opkg'
,
'name'
:
'opkg'
},
{
'path'
:
'/opt/local/bin/pkgin'
,
'name'
:
'pkgin'
}
]
{
'path'
:
'/opt/local/bin/pkgin'
,
'name'
:
'pkgin'
},
{
'path'
:
'/opt/local/bin/port'
,
'name'
:
'macports'
}
]
def
__init__
(
self
):
self
.
facts
=
{}
...
...
@@ -164,7 +165,7 @@ class Facts(object):
SLED
=
'Suse'
,
OpenSuSE
=
'Suse'
,
SuSE
=
'Suse'
,
Gentoo
=
'Gentoo'
,
Archlinux
=
'Archlinux'
,
Mandriva
=
'Mandrake'
,
Mandrake
=
'Mandrake'
,
Solaris
=
'Solaris'
,
Nexenta
=
'Solaris'
,
OmniOS
=
'Solaris'
,
OpenIndiana
=
'Solaris'
,
SmartOS
=
'Solaris'
,
AIX
=
'AIX'
SmartOS
=
'Solaris'
,
AIX
=
'AIX'
,
MacOSX
=
'Darwin'
)
if
self
.
facts
[
'system'
]
==
'AIX'
:
...
...
@@ -173,6 +174,11 @@ class Facts(object):
data
=
out
.
split
(
'.'
)
self
.
facts
[
'distribution_version'
]
=
data
[
0
]
self
.
facts
[
'distribution_release'
]
=
data
[
1
]
elif
self
.
facts
[
'system'
]
==
'Darwin'
:
self
.
facts
[
'distribution'
]
=
'MacOSX'
rc
,
out
,
err
=
module
.
run_command
(
"/usr/bin/sw_vers -productVersion"
)
data
=
out
.
split
()[
-
1
]
self
.
facts
[
'distribution_version'
]
=
data
else
:
dist
=
platform
.
dist
()
self
.
facts
[
'distribution'
]
=
dist
[
0
]
.
capitalize
()
or
'NA'
...
...
@@ -762,6 +768,40 @@ class AIX(Hardware):
data
=
out
.
split
()
self
.
facts
[
'firmware_version'
]
=
data
[
1
]
.
strip
(
'IBM,'
)
class
Darwin
(
Hardware
):
"""
Darwin-specific subclass of Hardware. Defines memory and CPU facts:
- processor_cores
- memtotal_mb
- memfree_mb
"""
platform
=
'Darwin'
def
__init__
(
self
):
Hardware
.
__init__
(
self
)
def
populate
(
self
):
self
.
get_cpu_facts
()
self
.
get_memory_facts
()
return
self
.
facts
def
get_cpu_facts
(
self
):
self
.
facts
[
'processor'
]
=
[]
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/sysctl machdep.cpu.brand_string"
)
data
=
out
[:
-
1
]
.
split
(
': '
)
self
.
facts
[
'processor'
]
=
data
[
1
]
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/sysctl machdep.cpu.core_count"
)
data
=
out
[:
-
1
]
.
split
(
': '
)
self
.
facts
[
'processor_cores'
]
=
data
[
1
]
def
get_memory_facts
(
self
):
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/sysctl hw.memsize"
)
data
=
out
[:
-
1
]
.
split
(
': '
)
self
.
facts
[
'memtotal_mb'
]
=
int
(
data
[
1
])
/
1024
/
1024
rc
,
out
,
err
=
module
.
run_command
(
"/usr/sbin/sysctl hw.usermem"
)
data
=
out
[:
-
1
]
.
split
(
': '
)
self
.
facts
[
'memfree_mb'
]
=
int
(
data
[
1
])
/
1024
/
1024
class
Network
(
Facts
):
"""
This is a generic Network subclass of Facts. This should be further
...
...
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