Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60129277
inventory.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 27, 17:47
Size
301 B
Mime Type
text/x-python
Expires
Mon, Apr 29, 17:47 (2 d)
Engine
blob
Format
Raw Data
Handle
17253332
Attached To
rPHINFRA c4science
inventory.py
View Options
#!/usr/bin/env python2
import
json
,
sys
FILE
=
sys
.
argv
[
1
]
GROUP
=
sys
.
argv
[
2
]
INVENTORY
=
''
INVENTORY
+=
'[
%s
]
\n
'
%
GROUP
for
h
in
sys
.
argv
[
3
:]:
host
=
h
.
split
(
','
)
INVENTORY
+=
'
%s
host_name=
%s
\n
'
%
(
host
[
0
],
host
[
1
])
INVENTORY
+=
'
\n
'
f
=
open
(
FILE
,
'a'
)
f
.
write
(
INVENTORY
)
f
.
close
()
Event Timeline
Log In to Comment