Merge pull request #49497 from rallytime/bp-49473

Back-port #49473 to 2018.3
This commit is contained in:
Nicole Thomas 2018-09-04 14:44:24 -04:00 committed by GitHub
commit 16ca360d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,13 +66,15 @@ passed in as a dict, or as a string to pull from pillars or minion config:
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import uuid
# Import Salt Libs
import salt.utils.dictupdate as dictupdate
from salt.utils import exactly_one
from salt.ext.six.moves import range
from salt.exceptions import SaltInvocationError
import logging
import salt.utils.data
import salt.utils.dictupdate
log = logging.getLogger(__name__) # pylint: disable=W1699
@ -198,7 +200,7 @@ def hosted_zone_present(name, Name=None, PrivateZone=False,
if not isinstance(VPCs, list):
raise SaltInvocationError("Parameter 'VPCs' must be a list of dicts.")
for v in VPCs:
if not isinstance(v, dict) or not exactly_one((v.get('VPCId'), v.get('VPCName'))):
if not isinstance(v, dict) or not salt.utils.data.exactly_one((v.get('VPCId'), v.get('VPCName'))):
raise SaltInvocationError("Parameter 'VPCs' must be a list of dicts, each composed "
"of either a 'VPCId' or a 'VPCName', and optionally a "
"'VPCRegion', to help distinguish between multitple matches.")
@ -306,7 +308,7 @@ def hosted_zone_present(name, Name=None, PrivateZone=False,
log.info(msg)
ret['comment'] = ' '.join([ret['comment'], msg])
ret['changes']['old'] = zone
ret['changes']['new'] = dictupdate.update(ret['changes'].get('new', {}), r)
ret['changes']['new'] = salt.utils.dictupdate.update(ret['changes'].get('new', {}), r)
else:
ret['comment'] = 'Update of Route 53 {} hosted zone {} comment failed'.format('private'
if PrivateZone else 'public', Name)