Example #1
0
    def test_read_no_conffile(self):
        oldfile = config.CONFFILE

        config.CONFFILE = '/does_not_exist'
        self.assertEquals({}, config.read_config())

        config.CONFFILE = oldfile
Example #2
0
File: tests.py Project: aawm/nubo
    def test_read_no_conffile(self):
        oldfile = config.CONFFILE

        config.CONFFILE = '/does_not_exist'
        self.assertEquals({}, config.read_config())

        config.CONFFILE = oldfile
Example #3
0
File: tests.py Project: aawm/nubo
 def test_write_config_no_new_values(self):
     old_config = config.read_config()
     new_config = config.write_config({})
     self.assertEquals(old_config, new_config)
Example #4
0
File: tests.py Project: aawm/nubo
 def test_read_config(self):
     self.assertEquals(dict, type(config.read_config()))
Example #5
0
    'RACKSPACE':          'nubo.clouds.rackspace.Rackspace',
    'RACKSPACE_UK':       'nubo.clouds.rackspace.Rackspace',
    'DIGITAL_OCEAN':      'nubo.clouds.digitalocean.DigitalOcean',
    'LINODE':             'nubo.clouds.linode.Linode',
    'OPENNEBULA':         'nubo.clouds.opennebula.OpenNebula',
}

NODE_STATES = {
    0: 'RUNNING',
    1: 'REBOOTING',
    2: 'TERMINATED',
    3: 'PENDING',
    4: 'UNKNOWN'
}

AVAILABLE_CLOUDS = read_config()


def resolvepath(s):
    return path.abspath(path.expanduser(s))


def node2dict(node):
    """Convert a node object into a dict"""
    fields = ( 'id', 'name', 'state', 'public_ips', 
               'private_ips', 'image', 'size', 'extra' )
    values = {}
    for field in fields:
        value = getattr(node, field)
        if value is not None:
            values[field] = value
Example #6
0
File: base.py Project: ema/nubo
    'EC2_EU_WEST': 'nubo.clouds.ec2.AmazonEC2',
    'RACKSPACE': 'nubo.clouds.rackspace.Rackspace',
    'DIGITAL_OCEAN': 'nubo.clouds.digitalocean.DigitalOcean',
    'LINODE': 'nubo.clouds.linode.Linode',
    'OPENNEBULA': 'nubo.clouds.opennebula.OpenNebula',
}

NODE_STATES = {
    0: 'RUNNING',
    1: 'REBOOTING',
    2: 'TERMINATED',
    3: 'PENDING',
    4: 'UNKNOWN'
}

AVAILABLE_CLOUDS = read_config()


def resolvepath(s):
    return path.abspath(path.expanduser(s))


def node2dict(node):
    """Convert a node object into a dict"""
    fields = ('id', 'name', 'state', 'public_ips', 'private_ips', 'image',
              'size', 'extra')
    values = {}
    for field in fields:
        value = getattr(node, field)
        if value is not None:
            values[field] = value
Example #7
0
 def test_write_config_no_new_values(self):
     old_config = config.read_config()
     new_config = config.write_config({})
     self.assertEquals(old_config, new_config)
Example #8
0
 def test_read_config(self):
     self.assertEquals(dict, type(config.read_config()))