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
54bab2c4
Commit
54bab2c4
authored
Jul 23, 2015
by
dmccue
Committed by
James Cammarata
Aug 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed issues with output format and order key
parent
ba6b89a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
contrib/inventory/cobbler.py
+5
-4
No files found.
contrib/inventory/cobbler.py
View file @
54bab2c4
...
@@ -76,6 +76,8 @@ except ImportError:
...
@@ -76,6 +76,8 @@ except ImportError:
# server, so it does not attempt to login with a username and password.
# server, so it does not attempt to login with a username and password.
# this will be addressed in a future version of this script.
# this will be addressed in a future version of this script.
orderby_keyname
=
'owners'
# alternatively 'mgmt_classes'
class
CobblerInventory
(
object
):
class
CobblerInventory
(
object
):
...
@@ -104,13 +106,12 @@ class CobblerInventory(object):
...
@@ -104,13 +106,12 @@ class CobblerInventory(object):
# Data to print
# Data to print
if
self
.
args
.
host
:
if
self
.
args
.
host
:
data_to_print
=
self
.
get_host_info
()
data_to_print
+
=
self
.
get_host_info
()
else
:
else
:
self
.
inventory
[
'_meta'
]
=
{
'hostvars'
:
{}
}
self
.
inventory
[
'_meta'
]
=
{
'hostvars'
:
{}
}
for
hostname
in
self
.
cache
:
for
hostname
in
self
.
cache
:
self
.
inventory
[
'_meta'
][
'hostvars'
][
hostname
]
=
{
'cobbler'
:
self
.
cache
[
hostname
]
}
self
.
inventory
[
'_meta'
][
'hostvars'
][
hostname
]
=
{
'cobbler'
:
self
.
cache
[
hostname
]
}
data_to_print
+=
self
.
json_format_dict
(
self
.
inventory
,
True
)
data_to_print
+=
self
.
json_format_dict
(
self
.
inventory
,
True
)
print
data_to_print
print
data_to_print
...
@@ -180,7 +181,7 @@ class CobblerInventory(object):
...
@@ -180,7 +181,7 @@ class CobblerInventory(object):
status
=
host
[
'status'
]
status
=
host
[
'status'
]
profile
=
host
[
'profile'
]
profile
=
host
[
'profile'
]
classes
=
host
[
'owners'
]
#host['mgmt_classes']
classes
=
host
[
orderby_keyname
]
#host['mgmt_classes']
if
status
not
in
self
.
inventory
:
if
status
not
in
self
.
inventory
:
self
.
inventory
[
status
]
=
[]
self
.
inventory
[
status
]
=
[]
...
...
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