Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow security_groups kwarg for boto_elb.present to be string or list #33053

Merged
merged 1 commit into from May 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 28 additions & 1 deletion salt/states/boto_elb.py
Expand Up @@ -70,6 +70,8 @@
ttl: 60
- name: myothercname.example.com.
zone: example.com.
- security_groups:
- my-security-group

# Using a profile from pillars
Ensure myelb ELB exists:
Expand Down Expand Up @@ -249,7 +251,22 @@ def present(
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.
The security groups assigned to your LoadBalancer within your VPC. Must
be passed either as a list or a comma-separated string.

For example, a list:

.. code-block:: yaml

- security_groups:
- secgroup-one
- secgroup-two

Or as a comma-separated string:

.. code-block:: yaml

- security_groups: secgroup-one,secgroup-two

scheme
The type of a LoadBalancer, ``internet-facing`` or ``internal``. Once
Expand Down Expand Up @@ -308,6 +325,16 @@ def present(
attributes = tmp

ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

if security_groups:
if isinstance(security_groups, six.string_types):
security_groups = security_groups.split(',')
elif not isinstance(security_groups, list):
ret['result'] = False
ret['comment'] = 'The \'security_group\' parameter must either be a list or ' \
'a comma-separated string.'
return ret

_ret = _elb_present(name, availability_zones, listeners, subnets,
security_groups, scheme, region, key, keyid, profile)
ret['changes'] = _ret['changes']
Expand Down