Line | |
---|
1 | #!/usr/bin/env python
|
---|
2 |
|
---|
3 | # get client properties for bacula
|
---|
4 |
|
---|
5 | import subprocess
|
---|
6 | import json
|
---|
7 | from pprint import pprint
|
---|
8 |
|
---|
9 | opsi={
|
---|
10 | 'server': "https://degdepot2.joergs:4447/rpc",
|
---|
11 | 'username': "joergs",
|
---|
12 | 'password': "linuxlinux",
|
---|
13 | }
|
---|
14 |
|
---|
15 | # "-d"
|
---|
16 | opsiCallPrefix=[ "opsi-admin", "-a", opsi['server'], "-u", opsi['username'], "-p", opsi['password'] ]
|
---|
17 |
|
---|
18 | opsiCallClientsWithBacula=[ "method", "productOnClient_getObjects", "[]", '{"productId":"bacula", "installationStatus": "installed"}']
|
---|
19 |
|
---|
20 | opsiCallClientBaculaProperties=[ "method", "getProductProperties_hash", "bacula" ]
|
---|
21 |
|
---|
22 | try:
|
---|
23 | clientsWithBacula=json.loads( subprocess.check_output( opsiCallPrefix + opsiCallClientsWithBacula ) )
|
---|
24 | except subprocess.CalledProcessError:
|
---|
25 | print "failed"
|
---|
26 | exit( 1 )
|
---|
27 |
|
---|
28 | pprint( clientsWithBacula )
|
---|
29 |
|
---|
30 | for client in clientsWithBacula:
|
---|
31 | print client['clientId']
|
---|
32 |
|
---|
33 | try:
|
---|
34 | clientBaculaProperties=json.loads( subprocess.check_output( opsiCallPrefix + opsiCallClientBaculaProperties + [ client['clientId'] ] ) )
|
---|
35 | except subprocess.CalledProcessError:
|
---|
36 | print "failed"
|
---|
37 | exit( 1 )
|
---|
38 |
|
---|
39 | pprint( clientBaculaProperties )
|
---|
Note:
See
TracBrowser
for help on using the repository browser.