source: opsi/products/opsi-bacula-server-conf.py @ 1027

Last change on this file since 1027 was 1027, checked in by joergs, 8 years ago

initial

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2
3# get client properties for bacula
4
5import subprocess
6import json
7from pprint import pprint
8
9opsi={
10    'server': "https://degdepot2.joergs:4447/rpc",
11    'username': "joergs",
12    'password': "linuxlinux",
13    }
14
15# "-d"
16opsiCallPrefix=[ "opsi-admin",  "-a", opsi['server'], "-u", opsi['username'], "-p", opsi['password'] ]
17
18opsiCallClientsWithBacula=[ "method", "productOnClient_getObjects", "[]", '{"productId":"bacula", "installationStatus": "installed"}']
19
20opsiCallClientBaculaProperties=[ "method", "getProductProperties_hash", "bacula" ]
21
22try:
23    clientsWithBacula=json.loads( subprocess.check_output( opsiCallPrefix + opsiCallClientsWithBacula ) )
24except subprocess.CalledProcessError:
25    print "failed"
26    exit( 1 )
27
28pprint( clientsWithBacula )
29       
30for 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.