def send_cert_request(event_tag, new_version, dest_cert_path, csr):
    """Send CSR to the salt master."""
    caller = salt_client.Caller()
    return caller.cmd('event.send',
                      event_tag,
                      csr=csr,
                      version=new_version,
                      path=dest_cert_path)
def main():
    caller = client.Caller()
    REGISTRY.register(SaltHighstateCollector(caller, args.highstate_interval))

    init_logging()

    app = web.Application([(r'/', RootHandler),
                           (r'/healthcheck', HealthcheckHandler),
                           (r'/metrics', MetricsHandler)])
    app.listen(args.listen_port, args.listen_addr)

    print 'Serving metrics on {}:{}'.format(args.listen_addr, args.listen_port)
    ioloop.IOLoop.current().start()
Beispiel #3
0
def get_exports_info():
    """
    Returns the status info of each export exported by NFS-ganesha
    """
    caller = SaltClient.Caller()
    if not caller.cmd('service.status', 'nfs-ganesha'):
        return {
            'success': False,
            'message': 'nfs-ganesha service is not running'
        }

    if not ExportMgr:
        return {
            'success': False,
            'message': 'nfs-ganesha utils scripts are not installed'
        }

    mgr = ExportMgr('org.ganesha.nfsd', '/org/ganesha/nfsd/ExportMgr',
                    'org.ganesha.nfsd.exportmgr')
    status, msg, reply = mgr.ShowExports()
    if not status:
        return {'success': False, 'message': msg}

    exports = []
    for export in reply[1]:
        status2, msg2, reply2 = mgr.DisplayExport(export.ExportID)
        if not status2:
            exports.append({
                'export_id': export.ExportID,
                'path': export.ExportPath,
                'active': False,
                'message': msg2
            })
            continue

        exports.append({
            'export_id': export.ExportID,
            'path': reply2[1],
            'pseudo': reply2[2],
            'tag': reply2[3],
            'active': True
        })
    return {'success': True, 'exports': exports}