Пример #1
0
def process_file():
    print "[INFO] Processing JSON file %s" % sys.argv[1]
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.load(None)
    # Converge
    finish_config()
Пример #2
0
def process_file():
    print "[INFO] Processing JSON file %s" % sys.argv[1]
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.load(None)
    # These can be safely deferred, dramatically speeding up loading times
    if not (os.environ.get('DEFER_CONFIG', False) and sys.argv[1] in ('vm_dhcp_entry.json', 'vm_metadata.json')):
        # Converge
        finish_config()
Пример #3
0
def process(do_merge=True):
    print "[INFO] Processing JSON file %s" % sys.argv[1]
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.do_merge = do_merge
    qf.load(None)
    return qf
Пример #4
0
def process(do_merge=True):
    print "[INFO] Processing JSON file %s" % sys.argv[1]
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.do_merge = do_merge
    qf.load(None)
    return qf
Пример #5
0
def process_file():
    print "[INFO] Processing JSON file %s" % sys.argv[1]
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.load(None)
    # Converge
    finish_config()
Пример #6
0
def process_file():
    logging.info("Processing JSON file %s" % sys.argv[1])
    qf = QueueFile()
    if len(sys.argv) > 2 and sys.argv[2].lower() == "false":
        qf.keep = False

    qf.setFile(sys.argv[1])
    qf.load(None)
    # These can be safely deferred, dramatically speeding up loading times
    if not (os.environ.get('DEFER_CONFIG', False) and ('vm_dhcp_entry.json' in sys.argv[1] or 'vm_metadata.json' in sys.argv[1])):
        # Converge
        finish_config()
Пример #7
0
def process_file():
    logging.info("Processing JSON file %s" % sys.argv[1])
    qf = QueueFile()
    qf.setFile(sys.argv[1])
    qf.load(None)
    # These can be safely deferred, dramatically speeding up loading times
    if not (os.environ.get('DEFER_CONFIG', False) and sys.argv[1] in ('vm_dhcp_entry.json', 'vm_metadata.json')):
        # Converge
        finish_config()
Пример #8
0
        if exists:
            break

    return exists


if not (os.path.isfile(jsonCmdConfigPath)
        and os.access(jsonCmdConfigPath, os.R_OK)):
    print "[ERROR] update_config.py :: You are telling me to process %s, but i can't access it" % jsonCmdConfigPath
    sys.exit(1)

# If the command line json file is unprocessed process it
# This is important or, the control interfaces will get deleted!
if os.path.isfile(jsonPath % "cmd_line.json"):
    qf = QueueFile()
    qf.setFile("cmd_line.json")
    qf.load(None)

# If the guest network is already configured and have the same IP, do not try to configure it again otherwise it will break
if sys.argv[1] == "guest_network.json":
    if os.path.isfile(currentGuestNetConfig):
        file = open(currentGuestNetConfig)
        guestnet_dict = json.load(file)

        if not is_guestnet_configured(guestnet_dict, [
                'eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8',
                'eth9'
        ]):
            print "[INFO] update_config.py :: Processing Guest Network."
            process_file()
Пример #9
0
            new_ip = new_guestnet_dict["router_guest_ip"].encode('utf-8')
            old_ip = interface["router_guest_ip"].encode('utf-8')

            if (new_mac == old_mac) and (new_ip == old_ip):
                exists = True
                break

        if exists:
            break

    return exists

# If the command line json file is unprocessed process it
# This is important or, the control interfaces will get deleted!
if jsonFilename != "cmd_line.json" and os.path.isfile(jsonPath % "cmd_line.json"):
    qf = QueueFile()
    qf.setFile("cmd_line.json")
    qf.load(None)

if not (os.path.isfile(jsonConfigFile) and os.access(jsonConfigFile, os.R_OK)):
    print "[ERROR] update_config.py :: Unable to read and access %s to process it" % jsonConfigFile
    sys.exit(1)

# If the guest network is already configured and have the same IP, do not try to configure it again otherwise it will break
if jsonFilename.startswith("guest_network.json"):
    if os.path.isfile(currentGuestNetConfig):
        file = open(currentGuestNetConfig)
        guestnet_dict = json.load(file)

        if not is_guestnet_configured(guestnet_dict, ['eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', 'eth7', 'eth8', 'eth9']):
            print "[INFO] update_config.py :: Processing Guest Network."