How to use the cysystemd.journal function in cysystemd

To help you get started, we’ve selected a few cysystemd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jahia / paas_jelastic_backup / autobackup / import_package_as_user.py View on Github external
package = parser.add_argument_group('package')
    package.add_argument("-u", "--url",
                         help="package url")
    package.add_argument("--settings",
                         help="package settings (dict format)")
    cluster = parser.add_argument_group('Jelastic Cluster')
    cluster.add_argument("-j", "--jelastic",
                         default=JELHOST,
                         help="Jelastic Cluster DNS")
    return parser.parse_args()

args = argparser()

# logging = logging.getLogger(name=re.split('[@.]', args.sudo)[1])
logging = logging.getLogger(name='jahiacloudbackup')
logging.addHandler(journal.JournaldLogHandler(identifier=(args.env)))
logging.info("BACKUP START")

def importPackage(classname):
    try:
        resp = classname.devScriptEval(urlpackage=args.url,
                                       shortdomain=args.env,
                                       settings=json.loads(args.settings))
    except:
        logging.error("BACKUP END: An error was returning during package execution")
        if userSess:
            userSess.signOut()
        if adminSess:
            adminSess.signOut()
        quit(1)
    return resp