Changeset 1094 for opsi/products/opsi-bacula-server-conf.py
- Timestamp:
- Sep 21, 2012, 11:47:40 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
opsi/products/opsi-bacula-server-conf.py
r1028 r1094 3 3 # get client properties for bacula 4 4 5 import logging 5 6 import subprocess 6 7 import json … … 79 80 # 80 81 82 #logging.basicConfig(format='%(asctime)s %(levelname)8s %(message)s') 83 logging.basicConfig(format='%(message)s') 84 logger = logging.getLogger(__name__) 85 #logger.setLevel(logging.INFO) 86 logger.setLevel(logging.DEBUG) 87 88 logger.debug( "start" ) 89 81 90 try: 82 91 clientsWithBacula=json.loads( subprocess.check_output( opsiCallPrefix + opsiCallClientsWithBacula ) ) 83 except subprocess.CalledProcessError: 84 print "failed" 85 exit( 1 ) 92 #except subprocess.CalledProcessError as e: 93 except e: 94 logger.exception( "%s: failed:" %(clientId) ) 95 exit(1) 86 96 87 pprint( clientsWithBacula )97 #pprint( clientsWithBacula ) 88 98 89 99 for client in clientsWithBacula: 90 100 clientId = client['clientId'] 91 print clientId92 101 93 102 try: 94 103 clientBaculaProperties=json.loads( subprocess.check_output( opsiCallPrefix + opsiCallClientBaculaProperties + [ client['clientId'] ] ) ) 95 except subprocess.CalledProcessError: 96 print "failed" 97 exit( 1 ) 98 99 pprint( clientBaculaProperties ) 100 write_client_conf( client, clientBaculaProperties ) 101 write_job_conf( client, clientBaculaProperties ) 104 except ValueError as e: 105 logger.warn( "%s: no valid information found: %s" %(clientId, e) ) 106 except subprocess.CalledProcessError as e: 107 logger.exception( "%s: failed:" %(clientId) ) 108 #exit( 1 ) 109 else: 110 #pprint( clientBaculaProperties ) 111 write_client_conf( client, clientBaculaProperties ) 112 write_job_conf( client, clientBaculaProperties ) 113 logger.info( "%s: OK" % clientId ) 114 115 logger.debug( "finished" )
Note:
See TracChangeset
for help on using the changeset viewer.