Skip to content

Commit

Permalink
Merge pull request #36 from ssssam/ssssam/allow-no-rules-update
Browse files Browse the repository at this point in the history
neutron_sec_group: Fix error if 'rules' parameter isn't supplied
  • Loading branch information
lorin committed Mar 7, 2015
2 parents 451dcde + da68aab commit bfe8dcc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions neutron_sec_group
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,21 @@ def _update_sg(module, network_client, sg):
sg = sg['security_group']
changed = True

# Security rules group update
if module.params['rules'] is not None:
rules_changed = _update_sg_rules(module, network_client, sg,
module.params['rules'])
changed |= rules_changed

return changed, sg


def _update_sg_rules(module, network_client, sg, wanted_rules):
"""
Updates rules of a security group.
"""

changed = False
existing_rules = sg['security_group_rules']
wanted_rules = module.params['rules']

#check ok
ok_rules = []
Expand Down Expand Up @@ -286,7 +298,8 @@ def _update_sg(module, network_client, sg):
sg = network_client.delete_security_group_rule(rule['id'])
changed = True

return changed, sg
return changed


def _create_sg_rules(network_client, sg, rules):
"""
Expand Down

0 comments on commit bfe8dcc

Please sign in to comment.