Merge pull request #12877 from gtmanfred/cache

cache on create for more drivers.
This commit is contained in:
Joseph Hall 2014-05-18 19:17:24 -06:00
commit 6cc3af207e
7 changed files with 12 additions and 9 deletions

View file

@ -321,7 +321,7 @@ def create(vm_):
return False
def __query_node_data(vm_name):
data = _get_node(vm_name)
data = show_instance(vm_name, 'action')
if not data:
# Trigger an error in the wait_for_ip function
return False

View file

@ -1898,7 +1898,7 @@ def create(vm_=None, call=None):
)
return False
node_dict = _expand_node(node_data)
node_dict = show_instance(node_data['name'], 'action')
if config.get_cloud_config_value('deploy', vm_, __opts__) is True:
deploy_script = script(vm_)

View file

@ -343,7 +343,7 @@ def create(vm_):
return False
def __query_node_data(vm_name):
data = _get_node(vm_name)
data = show_instance(vm_name, call='action')
if not data:
# Trigger an error in the wait_for_ip function
return False

View file

@ -246,12 +246,12 @@ def create(vm_):
def __query_node_data(vm_, data):
try:
nodelist = list_nodes()
node = show_instance(vm_['name'], 'action')
log.debug(
'Loaded node data for {0}:\n{1}'.format(
vm_['name'],
pprint.pformat(
nodelist[vm_['name']]
node['name']
)
)
)
@ -266,15 +266,15 @@ def create(vm_):
# Trigger a failure in the wait for IP function
return False
running = nodelist[vm_['name']]['state'] == node_state(
running = node['name']['state'] == node_state(
NodeState.RUNNING
)
if not running:
# Still not running, trigger another iteration
return
private = nodelist[vm_['name']]['private_ips']
public = nodelist[vm_['name']]['public_ips']
private = node['name']['private_ips']
public = node['name']['public_ips']
if private and not public:
log.warn(

View file

@ -540,6 +540,7 @@ def list_nodes_full(mask='mask[id]', call=None):
response = conn.getVirtualGuests()
for node_id in response:
ret[node_id['hostname']] = node_id
salt.utils.cloud.cache_node_list(ret, __active_provider_name__.split(':')[0], __opts__)
return ret

View file

@ -700,6 +700,7 @@ def list_nodes_full(mask='mask[id, hostname, primaryIpAddress, \
for node in response:
ret[node['hostname']] = node
salt.utils.cloud.cache_node_list(ret, __active_provider_name__.split(':')[0], __opts__)
return ret

View file

@ -111,6 +111,7 @@ def get_node(conn, name):
nodes = conn.list_nodes()
for node in nodes:
if node.name == name:
salt.utils.cloud.cache_node(node.__dict__, __active_provider_name__, __opts__)
return node
@ -469,7 +470,7 @@ def list_nodes_full(conn=None, call=None):
ret[node.name] = pairs
del ret[node.name]['driver']
salt.utils.cloud.cache_node_list(ret, __active_provider_name__.split(':')[0], __opts__)
salt.utils.cloud.cache_node_list(ret, __active_provider_name__, __opts__)
return ret