mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Revert "FIX salt-cloud map create inconsistent result with multi instances having the same name"
This reverts commit c55ccc4be4
.
This commit is contained in:
parent
a0c77aab85
commit
ddba73a4f4
2 changed files with 26 additions and 33 deletions
|
@ -16,7 +16,6 @@ import time
|
|||
import signal
|
||||
import logging
|
||||
import multiprocessing
|
||||
import re
|
||||
from itertools import groupby
|
||||
from salt.ext.six.moves import input
|
||||
|
||||
|
@ -1813,10 +1812,9 @@ class Map(Cloud):
|
|||
for alias, drivers in pmap.items():
|
||||
for driver, vms in drivers.items():
|
||||
for vm_name, details in vms.items():
|
||||
if re.match(name + '(?:-i-[a-fA-F0-9]+)?',vm_name):
|
||||
if vm_name == name:
|
||||
if driver not in matches:
|
||||
matches[driver] = []
|
||||
matches[driver].append(details['state'])
|
||||
matches[driver] = details['state']
|
||||
return matches
|
||||
|
||||
for alias, drivers in pmap.items():
|
||||
|
@ -1832,33 +1830,32 @@ class Map(Cloud):
|
|||
continue
|
||||
|
||||
# A machine by the same name exists
|
||||
for mdriver, states in matching.items():
|
||||
for state in states:
|
||||
if name not in ret['create']:
|
||||
# Machine already removed
|
||||
break
|
||||
for mdriver, state in matching.items():
|
||||
if name not in ret['create']:
|
||||
# Machine already removed
|
||||
break
|
||||
|
||||
if mdriver not in ('aws', 'ec2') and \
|
||||
state.lower() != 'terminated':
|
||||
# Regarding other providers, simply remove
|
||||
# them for the create map.
|
||||
log.warn(
|
||||
'{0!r} already exists, removing from '
|
||||
'the create map'.format(name)
|
||||
)
|
||||
if 'existing' not in ret:
|
||||
ret['existing'] = {}
|
||||
ret['existing'][name] = ret['create'].pop(name)
|
||||
continue
|
||||
if mdriver not in ('aws', 'ec2') and \
|
||||
state.lower() != 'terminated':
|
||||
# Regarding other providers, simply remove
|
||||
# them for the create map.
|
||||
log.warn(
|
||||
'{0!r} already exists, removing from '
|
||||
'the create map'.format(name)
|
||||
)
|
||||
if 'existing' not in ret:
|
||||
ret['existing'] = {}
|
||||
ret['existing'][name] = ret['create'].pop(name)
|
||||
continue
|
||||
|
||||
if state.lower() != 'terminated':
|
||||
log.info(
|
||||
'{0!r} already exists, removing '
|
||||
'from the create map'.format(name)
|
||||
)
|
||||
if 'existing' not in ret:
|
||||
ret['existing'] = {}
|
||||
ret['existing'][name] = ret['create'].pop(name)
|
||||
if state.lower() != 'terminated':
|
||||
log.info(
|
||||
'{0!r} already exists, removing '
|
||||
'from the create map'.format(name)
|
||||
)
|
||||
if 'existing' not in ret:
|
||||
ret['existing'] = {}
|
||||
ret['existing'][name] = ret['create'].pop(name)
|
||||
|
||||
if 'hard' in self.opts and self.opts['hard']:
|
||||
if self.opts['enable_hard_maps'] is False:
|
||||
|
|
|
@ -2894,8 +2894,6 @@ def _extract_instance_info(instances):
|
|||
if isinstance(instance['instancesSet']['item'], list):
|
||||
for item in instance['instancesSet']['item']:
|
||||
name = _extract_name_tag(item)
|
||||
if name in ret:
|
||||
name = name + '-' + item['instanceId']
|
||||
ret[name] = item
|
||||
ret[name].update(
|
||||
dict(
|
||||
|
@ -2910,8 +2908,6 @@ def _extract_instance_info(instances):
|
|||
else:
|
||||
item = instance['instancesSet']['item']
|
||||
name = _extract_name_tag(item)
|
||||
if name in ret:
|
||||
name = name + '-' + item['instanceId']
|
||||
ret[name] = item
|
||||
ret[name].update(
|
||||
dict(
|
||||
|
|
Loading…
Add table
Reference in a new issue