# Buggy code
def present(
    name,
    listeners,
    availability_zones=None,
    subnets=None,
    security_groups=None,
    scheme="internet-facing",
    health_check=None,
    attributes=None,
    attributes_from_pillar="boto_elb_attributes",
    cnames=None,
    alarms=None,
    alarms_from_pillar="boto_elb_alarms",
    policies=None,
    policies_from_pillar="boto_elb_policies",
    backends=None,
    region=None,
    key=None,
    keyid=None,
    profile=None,
    wait_for_sync=True,
    tags=None,
):
    """
    Ensure the ELB exists.

    name
        Name of the ELB.

    availability_zones
        A list of availability zones for this ELB.

    listeners
        A list of listener lists; example::

            [
                ['443', 'HTTPS', 'arn:aws:iam::1111111:server-certificate/mycert'],
                ['8443', '80', 'HTTPS', 'HTTP', 'arn:aws:iam::1111111:server-certificate/mycert']
            ]

    subnets
        A list of subnet IDs in your VPC to attach to your LoadBalancer.

    security_groups
        The security groups assigned to your LoadBalancer within your VPC.

    scheme
        The type of a LoadBalancer. internet-facing or internal. Once set, can not be modified.

    health_check
        A dict defining the health check for this ELB.

    attributes
        A dict defining the attributes to set on this ELB.

    attributes_from_pillar
        name of pillar dict that contains attributes.   Attributes defined for this specific
        state will override those from pillar.

    cnames
        A list of cname dicts with attributes needed for the DNS add_record state.
        By default the boto_route53.add_record state will be used, which requires: name, zone, ttl, and identifier.
        See the boto_route53 state for information about these attributes.
        Other DNS modules can be called by specifying the provider keyword.
        the cnames dict will be passed to the state as kwargs.

    alarms:
        a dictionary of name->boto_cloudwatch_alarm sections to be associated with this ELB.
        All attributes should be specified except for dimension which will be
        automatically set to this ELB.
        See the boto_cloudwatch_alarm state for information about these attributes.

    alarms_from_pillar:
        name of pillar dict that contains alarm settings.   Alarms defined for this specific
        state will override those from pillar.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.

    wait_for_sync
        Wait for an INSYNC change status from Route53.

    tags
        dict of tags
    """

    # load data from attributes_from_pillar and merge with attributes
    tmp = __salt__["config.option"](attributes_from_pillar, {})
    if attributes:
        attributes = dictupdate.update(tmp, attributes)
    else:
        attributes = tmp

    ret = {"name": name, "result": True, "comment": "", "changes": {}}
    _ret = _elb_present(
        name,
        availability_zones,
        listeners,
        subnets,
        security_groups,
        scheme,
        region,
        key,
        keyid,
        profile,
    )
    ret["changes"] = _ret["changes"]
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret

    if attributes:
        _ret = _attributes_present(name, attributes, region, key, keyid, profile)
        ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
        ret["comment"] = " ".join([ret["comment"], _ret["comment"]])

        if not _ret["result"]:
            ret["result"] = _ret["result"]
            if ret["result"] is False:
                return ret

    _ret = _health_check_present(name, health_check, region, key, keyid, profile)
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    if cnames:
        lb = __salt__["boto_elb.get_elb_config"](name, region, key, keyid, profile)
        if len(lb) > 0:
            for cname in cnames:
                _ret = None
                dns_provider = "boto_route53"
                cname["record_type"] = "CNAME"
                cname["value"] = lb["dns_name"]
                if "provider" in cname:
                    dns_provider = cname.pop("provider")
                if dns_provider == "boto_route53":
                    if "profile" not in cname:
                        cname["profile"] = profile
                    if "key" not in cname:
                        cname["key"] = key
                    if "keyid" not in cname:
                        cname["keyid"] = keyid
                    if "region" not in cname:
                        cname["region"] = region
                    if "wait_for_sync" not in cname:
                        cname["wait_for_sync"] = wait_for_sync
                _ret = __states__[".".join([dns_provider, "present"])](**cname)
                ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
                ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
                if not _ret["result"]:
                    ret["result"] = _ret["result"]
                    if ret["result"] is False:
                        return ret

    _ret = _alarms_present(
        name, alarms, alarms_from_pillar, region, key, keyid, profile
    )
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    _ret = _policies_present(
        name,
        policies,
        policies_from_pillar,
        listeners,
        backends,
        region,
        key,
        keyid,
        profile,
    )
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    _ret = _tags_present(name, tags, region, key, keyid, profile)
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    return ret


# Traceback (TypeError)
cent6_2:
provider: vcenter02
clonefrom: CentOS6.6_64bit
num_cpus: 2
memory: 2GB
domain: domain.com
dns_servers:
- 192.168.14.11
- 192.168.14.12
resourcepool: Resources
cluster: qa
datastore: datastore1
datacenter: dlsb
host: hostname
power_on: True
deploy: True
ssh_username: root
password: passwd
minion:
master: 192.168.40.43
grains:
location: ny
env: qa
role: web


cloud.maps.d]# cat map.conf
cent6_2:
- dlsbweb01:
devices:
network:
Network adapter 1:
name: Kickstart Network
switch_type: standard
ip: 192.168.40.248
gateway: [192.168.40.1]
subnet_mask: 255.255.255.0
- dlsbweb02:
devices:
network:
Network adapter 1:
name: Kickstart Network
switch_type: standard
ip: 192.168.40.249
gateway: [192.168.40.1]
subnet_mask: 255.255.255.0


[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ]  *  INFO: Salt installed!
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ]  *  INFO: Salt installed!
[DEBUG   ] Executed command "/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/deploy.sh -c '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 rm -f '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/deploy.sh'"
[DEBUG   ] Executed command "/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/deploy.sh -c '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 rm -f '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/deploy.sh'"
[DEBUG   ] Child Forked! PID: 15369  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Child Forked! PID: 15370  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 'rm -f '"'"'/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/deploy.sh'"'"''
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 'rm -f '"'"'/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/deploy.sh'"'"''
[DEBUG   ] Warning: Permanently added '192.168.40.249' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.249's password:
[DEBUG   ] Warning: Permanently added '192.168.40.248' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.248's password:
[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ] Removed /tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/deploy.sh
[DEBUG   ] Removed /tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/deploy.sh
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 rm -f '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pub'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 rm -f '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pub'"
[DEBUG   ] Child Forked! PID: 15372  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Child Forked! PID: 15373  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 'rm -f '"'"'/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pub'"'"''
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 'rm -f '"'"'/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pub'"'"''
[DEBUG   ] Warning: Permanently added '192.168.40.249' (RSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '192.168.40.248' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.249's password:
[DEBUG   ] root@192.168.40.248's password:
[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ] Removed /tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pub
[DEBUG   ] Removed /tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pub
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 rm -f '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pem'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 rm -f '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pem'"
[DEBUG   ] Child Forked! PID: 15374  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Child Forked! PID: 15375  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 'rm -f '"'"'/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pem'"'"''
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 'rm -f '"'"'/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pem'"'"''
[DEBUG   ] Warning: Permanently added '192.168.40.248' (RSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '192.168.40.249' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.249's password:
[DEBUG   ] root@192.168.40.248's password:
[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ] Removed /tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion.pem
[DEBUG   ] Removed /tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion.pem
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 rm -f '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/grains'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 rm -f '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/grains'"
[DEBUG   ] Child Forked! PID: 15376  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Child Forked! PID: 15377  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 'rm -f '"'"'/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/grains'"'"''
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 'rm -f '"'"'/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/grains'"'"''
[DEBUG   ] Warning: Permanently added '192.168.40.249' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.249's password:
[DEBUG   ] Warning: Permanently added '192.168.40.248' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.248's password:
[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ] Removed /tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/grains
[DEBUG   ] Removed /tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/grains
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 rm -f '/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion'"
[DEBUG   ] SSH command: "ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 rm -f '/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion'"
[DEBUG   ] Child Forked! PID: 15378  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Child Forked! PID: 15379  STDOUT_FD: 21  STDERR_FD: 23
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.248 'rm -f '"'"'/tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion'"'"''
[DEBUG   ] Terminal Command: /bin/sh -c ssh -t -t -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oControlPath=none -p 22 root@192.168.40.249 'rm -f '"'"'/tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion'"'"''
[DEBUG   ] Warning: Permanently added '192.168.40.248' (RSA) to the list of known hosts.
[DEBUG   ] Warning: Permanently added '192.168.40.249' (RSA) to the list of known hosts.
[DEBUG   ] root@192.168.40.248's password:
[DEBUG   ] root@192.168.40.249's password:
[DEBUG   ] Connection to 192.168.40.248 closed.
[DEBUG   ] Connection to 192.168.40.249 closed.
[DEBUG   ] Removed /tmp/.saltcloud-73e57e99-789c-4379-bc47-6410b7a78c74/minion
[DEBUG   ] Removed /tmp/.saltcloud-8f078916-9324-44ba-b4a9-c0db91995654/minion
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event - data = {'host': '192.168.40.249', 'name': 'dlsbweb02', '_stamp': '2016-03-02T18:19:36.067144', 'event': 'dlsbweb02 has been deployed at 192.168.40.249'}
[DEBUG   ] Sending event - data = {'host': '192.168.40.248', 'name': 'dlsbweb01', '_stamp': '2016-03-02T18:19:36.067528', 'event': 'dlsbweb01 has been deployed at 192.168.40.248'}
[INFO    ] Salt installed on dlsbweb02
[INFO    ] Salt installed on dlsbweb01
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event - data = {'profile': 'cent6_2', 'event': 'created instance', '_stamp': '2016-03-02T18:19:36.922794', 'name': 'dlsbweb01', 'provider': 'vcenter02:vmware'}
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event - data = {'profile': 'cent6_2', 'event': 'created instance', '_stamp': '2016-03-02T18:19:36.932306', 'name': 'dlsbweb02', 'provider': 'vcenter02:vmware'}
[ERROR   ] There was a query error: itervalues() takes exactly 1 argument (2 given)
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/cloud/cli.py", line 339, in run
ret = mapper.run_map(dmap)
File "/usr/lib/python2.6/site-packages/salt/cloud/__init__.py", line 2211, in run_map
lambda x: x['level']):
TypeError: itervalues() takes exactly 1 argument (2 given)

salt --versions-report
Salt Version:
Salt: 2015.8.5

Dependency Versions:
Jinja2: 2.2.1
M2Crypto: 0.20.2
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.5.0
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.4.1
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed

System Versions:
dist: centos 6.7 Final
machine: x86_64
release: 2.6.32-504.el6.x86_64
system: CentOS 6.7 Final

# Fixed code
def present(
    name,
    listeners,
    availability_zones=None,
    subnets=None,
    security_groups=None,
    scheme="internet-facing",
    health_check=None,
    attributes=None,
    attributes_from_pillar="boto_elb_attributes",
    cnames=None,
    alarms=None,
    alarms_from_pillar="boto_elb_alarms",
    policies=None,
    policies_from_pillar="boto_elb_policies",
    backends=None,
    region=None,
    key=None,
    keyid=None,
    profile=None,
    wait_for_sync=True,
    tags=None,
):
    """
    Ensure the ELB exists.

    name
        Name of the ELB.

    availability_zones
        A list of availability zones for this ELB.

    listeners
        A list of listener lists; example::

            [
                ['443', 'HTTPS', 'arn:aws:iam::1111111:server-certificate/mycert'],
                ['8443', '80', 'HTTPS', 'HTTP', 'arn:aws:iam::1111111:server-certificate/mycert']
            ]

    subnets
        A list of subnet IDs in your VPC to attach to your LoadBalancer.

    security_groups
        The security groups assigned to your LoadBalancer within your VPC.

    scheme
        The type of a LoadBalancer, ``internet-facing`` or ``internal``. Once
        set, can not be modified.

    health_check
        A dict defining the health check for this ELB.

    attributes
        A dict defining the attributes to set on this ELB.

    attributes_from_pillar
        name of pillar dict that contains attributes.   Attributes defined for this specific
        state will override those from pillar.

    cnames
        A list of cname dicts with attributes needed for the DNS add_record state.
        By default the boto_route53.add_record state will be used, which requires: name, zone, ttl, and identifier.
        See the boto_route53 state for information about these attributes.
        Other DNS modules can be called by specifying the provider keyword.
        the cnames dict will be passed to the state as kwargs.

        See the :mod:`salt.states.boto_route53` state for information about
        these attributes.

    alarms:
        a dictionary of name->boto_cloudwatch_alarm sections to be associated with this ELB.
        All attributes should be specified except for dimension which will be
        automatically set to this ELB.

        See the :mod:`salt.states.boto_cloudwatch_alarm` state for information
        about these attributes.

    alarms_from_pillar:
        name of pillar dict that contains alarm settings.   Alarms defined for this specific
        state will override those from pillar.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.

    wait_for_sync
        Wait for an INSYNC change status from Route53.

    tags
        dict of tags
    """

    # load data from attributes_from_pillar and merge with attributes
    tmp = __salt__["config.option"](attributes_from_pillar, {})
    if attributes:
        attributes = dictupdate.update(tmp, attributes)
    else:
        attributes = tmp

    ret = {"name": name, "result": True, "comment": "", "changes": {}}
    _ret = _elb_present(
        name,
        availability_zones,
        listeners,
        subnets,
        security_groups,
        scheme,
        region,
        key,
        keyid,
        profile,
    )
    ret["changes"] = _ret["changes"]
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret

    if attributes:
        _ret = _attributes_present(name, attributes, region, key, keyid, profile)
        ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
        ret["comment"] = " ".join([ret["comment"], _ret["comment"]])

        if not _ret["result"]:
            ret["result"] = _ret["result"]
            if ret["result"] is False:
                return ret

    _ret = _health_check_present(name, health_check, region, key, keyid, profile)
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    if cnames:
        lb = __salt__["boto_elb.get_elb_config"](name, region, key, keyid, profile)
        if len(lb) > 0:
            for cname in cnames:
                _ret = None
                dns_provider = "boto_route53"
                cname["record_type"] = "CNAME"
                cname["value"] = lb["dns_name"]
                if "provider" in cname:
                    dns_provider = cname.pop("provider")
                if dns_provider == "boto_route53":
                    if "profile" not in cname:
                        cname["profile"] = profile
                    if "key" not in cname:
                        cname["key"] = key
                    if "keyid" not in cname:
                        cname["keyid"] = keyid
                    if "region" not in cname:
                        cname["region"] = region
                    if "wait_for_sync" not in cname:
                        cname["wait_for_sync"] = wait_for_sync
                _ret = __states__[".".join([dns_provider, "present"])](**cname)
                ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
                ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
                if not _ret["result"]:
                    ret["result"] = _ret["result"]
                    if ret["result"] is False:
                        return ret

    _ret = _alarms_present(
        name, alarms, alarms_from_pillar, region, key, keyid, profile
    )
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    _ret = _policies_present(
        name,
        policies,
        policies_from_pillar,
        listeners,
        backends,
        region,
        key,
        keyid,
        profile,
    )
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    _ret = _tags_present(name, tags, region, key, keyid, profile)
    ret["changes"] = dictupdate.update(ret["changes"], _ret["changes"])
    ret["comment"] = " ".join([ret["comment"], _ret["comment"]])
    if not _ret["result"]:
        ret["result"] = _ret["result"]
        if ret["result"] is False:
            return ret
    return ret