agent/common: fix hobo_notify (#8425)

two trivial bugs found using the new tests
This commit is contained in:
Benjamin Dauvergne 2015-09-30 14:19:41 +02:00
parent fd62795a7d
commit 0127af64a7
1 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ class Command(BaseCommand):
assert cls.check_valid_role(o)
uuids.add(o['uuid'])
if action == 'provision':
role, created = Role.objects.create(
role, created = Role.objects.get_or_create(
uuid=o['uuid'], defaults={
'name': o['name'],
'description': o['description']})
@ -93,5 +93,5 @@ class Command(BaseCommand):
for role in Role.objects.exclude(uuid__in=uuids):
role.delete()
elif action == 'deprovision':
for role in Role.objects.filter(uuid_in=uuids):
for role in Role.objects.filter(uuid__in=uuids):
role.delete()