def check_ntp(): check_service('ntpd') ntpserver = _get_ntpserver() if not ntpserver: LOG.error('Can not get ntp server, please check it.') else: LOG.debug('ntpserver is %s' % ntpserver)
def check_ntp(): check_service("ntpd") ntpserver = _get_ntpserver() if not ntpserver: LOG.error("Can not get ntp server, please check it.") else: LOG.debug("ntpserver is %s" % ntpserver)
def deploy_bro(): print('Deploying Bro') check_service(SERVICE_LOCK) make_conf(make_subnets(), NETWORK_CONF) make_conf(make_node(), NODE_CONF) #sleep(DEPLOY_DELAY) #Popen(DEPLOY_CMD,shell=True) return
def check_mongodb(): if NODE_ROLE.is_mongo(): role = NODE_ROLE.role if search_service('mongod'): LOG.error('mongod service was not found on %s node,please fix it' \ % role ) else: yaml_path = '/etc/astute.yaml' check_service('mongod') mongodb_stats = _get_mongodb_stats(yaml_path) if isinstance(mongodb_stats, dict): LOG.debug("mongod service is ok:%s" % mongodb_stats) else: LOG.error('mongod service is wrong:%s' % mongodb_stats)
def check_ntp(): check_service('ntpd') (s, out) = commands.getstatusoutput( 'ntpstat | grep "synchronised to NTP server"') if s != 0: LOG.error('ntpstat error, please check it') return else: p = re.compile(r'.+\((.+)\).+') try: server = p.match(out).groups()[0] LOG.info('ntpserver is %s', server) except: LOG.error('except ntpstate error, please check it') return
def send_receipt(doc, document): buf = StringIO.StringIO() buf.write(document) buffer_xml = base64.encodestring(buf.getvalue()) if not utils.check_service('prueba'): print('Error SRI', 'Servicio SRI no disponible.') client = Client(SriService.get_active_ws()[0]) result = client.service.validarComprobante(buffer_xml) print "result", result if result[0] == 'RECIBIDA': return True else: for m in result[1][0][0][1][0]: if m.identificador == '43': return True else: response = u'Comprobante Electrónico DEVUELTO:\nError : ' + str( m.mensaje) + '\nIdentificador : ' + str( m.identificador) + '\nTipo : ' + str(m.tipo) return response