Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63714794
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
Wed, May 22, 01:00
Size
301 B
Mime Type
text/x-python
Expires
Fri, May 24, 01:00 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17809782
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