Example #1
0
    def _read(self, name, jsonfile, connection=None, save_connection=True):
        jf = open(jsonfile).read()
        data = json.loads(jf)

        if name is not None:
            data['forest-name'] = name

        if 'database' in data:
            del (data['database'])

        forest = Forest.unmarshal(data,
                                  connection=connection,
                                  save_connection=save_connection)

        return forest
Example #2
0
    def _read(self, name, jsonfile,
              connection=None, save_connection=True):
        jf = open(jsonfile).read()
        data = json.loads(jf)

        if name is not None:
            data['forest-name'] = name

        if 'database' in data:
            del(data['database'])

        forest = Forest.unmarshal(data,
                                  connection=connection,
                                  save_connection=save_connection)

        return forest
Example #3
0
 def _read(self, name, jsonfile):
     jf = open(jsonfile).read()
     data = json.loads(jf)
     data['forest-name'] = name
     forest = Forest.unmarshal(data)
     return forest
        print("{0} user: {1}".format(verb, name))
        user.update(conn)

# Create forests
for config in data['forests']:
    name = config['forest-name']
    f = Forest.lookup(conn, name)
    if f is None:
        print("Need to create forest: {0}".format(name))
        f = Forest(name)
        f.create(conn)

# Update forests
for config in data['forests']:
    name = config['forest-name']
    f = Forest.unmarshal(config)
    print("Updating forest: {0}".format(name))
    f.update(conn)

# Create databases
for config in data['databases']:
    name = config['database-name']
    db = Database.lookup(conn, name)
    if db is None:
        print("Need to create database: {0}".format(name))
        db = Database(name)
        db.create(conn)

# Update databases
for config in data['databases']:
    name = config['database-name']
Example #5
0
 def _read(self, name, jsonfile):
     jf = open(jsonfile).read()
     data = json.loads(jf)
     data['forest-name'] = name
     forest = Forest.unmarshal(data)
     return forest