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
bcd0001c
Commit
bcd0001c
authored
Jul 12, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring the cobbler external inventory script up to date with current usage (--list, --host hostname)
parent
611e5b0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
examples/scripts/cobbler_external_inventory.py
+7
-3
No files found.
examples/scripts/cobbler_external_inventory.py
View file @
bcd0001c
...
...
@@ -69,7 +69,7 @@ conn = xmlrpclib.Server("http://127.0.0.1/cobbler_api", allow_none=True)
# executed with no parameters, return the list of
# all groups and hosts
if
len
(
sys
.
argv
)
==
1
:
if
len
(
sys
.
argv
)
==
2
and
(
sys
.
argv
[
1
]
==
'--list'
)
:
systems
=
conn
.
get_item_names
(
'system'
)
groups
=
{
'ungrouped'
:
[]
}
...
...
@@ -103,10 +103,10 @@ if len(sys.argv) == 1:
# executed with a hostname as a parameter, return the
# variables for that host
if
len
(
sys
.
argv
)
==
2
:
elif
len
(
sys
.
argv
)
==
3
and
(
sys
.
argv
[
1
]
==
'--host'
)
:
# look up the system record for the given DNS name
result
=
conn
.
find_system_by_dns_name
(
sys
.
argv
[
1
])
result
=
conn
.
find_system_by_dns_name
(
sys
.
argv
[
2
])
system
=
result
.
get
(
'name'
,
None
)
data
=
{}
if
system
is
None
:
...
...
@@ -125,3 +125,7 @@ if len(sys.argv) == 2:
print
json
.
dumps
(
results
)
sys
.
exit
(
0
)
else
:
print
"usage: --list ..OR.. --host <hostname>"
sys
.
exit
(
1
)
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