def getActivationFile(prop, PATH): nemesys.info('getActivationFile function') try: #activation code ac = str(prop['code']) nemesys.info('Activation Code found: %s' % ac) except Exception as e: nemesys.error( 'Exception in reading activation code from cfg.properties: ' + str(e)) et = ErrorThread('ace') et.start() sys.exit(1) try: path = PATH + os.sep + '..' + os.sep + 'config' download = getconf(ac, path, _clientConfigurationFile, _configurationServer) nemesys.info('download = %s' % str(download)) if download != True: raise Exception('Download failed') else: nemesys.info('Configuration file successfully downloaded') myProp.writeProps(_PATH + "cfg" + os.sep + "cfg.properties", '\nregistered', 'ok') _prop = myProp.readProps(_PATH + "cfg" + os.sep + "cfg.properties") except Exception as e: nemesys.error('Cannot download the configuration file: ' + str(e)) nemesys.error('Exit from Ne.Me.Sys.') myProp.writeProps(_PATH + "cfg" + os.sep + "cfg.properties", '\nregistered', 'nok') _prop = myProp.readProps(_PATH + "cfg" + os.sep + "cfg.properties") et = ErrorThread('download') et.start() sys.exit(1)
def getActivationFile(prop,PATH): nemesys.info('getActivationFile function') try: #activation code ac = str(prop['code']) nemesys.info('Activation Code found: %s' % ac) except Exception as e: nemesys.error('Exception in reading activation code from cfg.properties: '+str(e)) et = ErrorThread('ace') et.start() sys.exit(1) try: path=PATH+os.sep+'..'+os.sep+'config' download= getconf(ac, path, _clientConfigurationFile, _configurationServer) nemesys.info('download = %s' % str(download)) if download != True: raise Exception('Download failed') else: nemesys.info('Configuration file successfully downloaded') myProp.writeProps(_PATH+"cfg"+os.sep+"cfg.properties",'\nregistered','ok') _prop=myProp.readProps(_PATH+"cfg"+os.sep+"cfg.properties") except Exception as e: nemesys.error('Cannot download the configuration file: '+str(e)) nemesys.error('Exit from Ne.Me.Sys.') myProp.writeProps(_PATH+"cfg"+os.sep+"cfg.properties",'\nregistered','nok') _prop=myProp.readProps(_PATH+"cfg"+os.sep+"cfg.properties") et=ErrorThread('download') et.start() sys.exit(1)
def getActivationFile(appresult, path, config_path): ''' Scarica il file di configurazione. Ritorna True se tutto è andato bene ''' logger.info('getActivationFile function') ac = appresult logger.info('Codici ricevuti: %s' % ac) download = False try: download = getconf(ac, path, _clientConfigurationFile, _configurationServer) logger.info('download = %s' % str(download)) except Exception as e: logger.error('Cannot download the configuration file: %s' % str(e)) raise LoginConnectionException(str(e)) if download != True: logger.info('Received error from server, wrong credentials or license not active') raise LoginAuthenticationException("") else: logger.info('Configuration file successfully downloaded') myProp.writeProps(config_path,'\nregistered','ok') _prop=myProp.readProps(config_path) OkDialog() return True
def getActivationFile(appresult, path, config_path): ''' Scarica il file di configurazione. Ritorna True se tutto è andato bene ''' logger.info('getActivationFile function') ac = appresult logger.info('Codici ricevuti: %s' % ac) download = False try: download = getconf(ac, path, _clientConfigurationFile, _configurationServer) logger.info('download = %s' % str(download)) except Exception as e: logger.error('Cannot download the configuration file: %s' % str(e)) raise LoginConnectionException(str(e)) if download != True: logger.info( 'Received error from server, wrong credentials or license not active' ) raise LoginAuthenticationException("") else: logger.info('Configuration file successfully downloaded') myProp.writeProps(config_path, '\nregistered', 'ok') _prop = myProp.readProps(config_path) OkDialog() return True
import sys from backup_to_s3 import backup_to_s3 from getconf import getconf, findconfs def _backup_to_s3(access_key, secret_access_key, bucket, directories = {}, commands = {}, files = {}): print " > " + bucket print " > directories" for d,dd in directories.items(): print " > %s : %s" % (d,dd) print " > commands" for d,dd in commands.items(): print " > %s : %s" % (d,dd) print " > files" for d,dd in files.items(): print " > %s : %s" % (d,dd) keys = getconf('INIT', subconf='keys') confs = findconfs(excluding=('INIT',)) # Optional command-line filter try: confs = [c for c in confs if c == sys.argv[1] or sys.argv[1] == 'ALL'] except IndexError: pass for conf_name in confs: conf = getconf(conf_name) label = conf['META'].get('label', "Unnamed backup %s" % conf_name) print "Starting backup: '%s'" % label args = { 'access_key': keys['access'], 'secret_access_key': keys['secret'],