Пример #1
0
def joyent_node_state(id_):
    '''
    Convert joyent returned state to state common to other data center return
    values for consistency

    :param id_: joyent state value
    :return: state value
    '''
    states = {'running': 0,
              'stopped': 2,
              'stopping': 2,
              'provisioning': 3,
              'deleted': 2,
              'unknown': 4}

    if id_ not in states:
        id_ = 'unknown'

    return node_state(states[id_])
Пример #2
0
def joyent_node_state(id_):
    '''
    Convert joyent returned state to state common to other data center return
    values for consistency

    :param id_: joyent state value
    :return: state value
    '''
    states = {'running': 0,
              'stopped': 2,
              'stopping': 2,
              'provisioning': 3,
              'deleted': 2,
              'unknown': 4}

    if id_ not in states:
        id_ = 'unknown'

    return node_state(states[id_])
Пример #3
0
def joyent_node_state(id_):
    """
    Convert joyent returned state to state common to other data center return
    values for consistency

    :param id_: joyent state value
    :return: state value
    """
    states = {
        "running": 0,
        "stopped": 2,
        "stopping": 2,
        "provisioning": 3,
        "deleted": 2,
        "unknown": 4,
    }

    if id_ not in states:
        id_ = "unknown"

    return node_state(states[id_])
Пример #4
0
 def test_node_state_libcloud_100(self):
     state = libcloud.node_state('terminated')
     self.assertEqual('TERMINATED', state)
Пример #5
0
 def test_node_state_libcloud_020(self):
     state = libcloud.node_state(2)
     self.assertEqual('TERMINATED', state)
Пример #6
0
 def test_node_state_libcloud_100(self):
     state = libcloud.node_state("terminated")
     self.assertEqual("TERMINATED", state)