Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/landscape/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/landscape/lib/juju.py
from __future__ import absolute_import

import os
import json
import logging

from landscape.lib.fs import read_text_file


def get_juju_info(config):
    """
    Returns available Juju info or C{None} if the path referenced from
    L{config} is not a valid file.
    """
    if not os.path.exists(config.juju_filename):
        return

    json_contents = read_text_file(config.juju_filename)
    try:
        juju_info = json.loads(json_contents)
    # Catch any error the json lib could throw, because we don't know or
    # care what goes wrong - we'll display a generic error message and
    # return None in any case.
    except Exception:
        logging.exception(
            "Error attempting to read JSON from %s" % config.juju_filename)
        return None

    juju_info["api-addresses"] = juju_info["api-addresses"].split()
    return juju_info

Spamworldpro Mini