Defer error checking to ansible layer
diff --git a/planetstack/openstack_observer/steps/sync_controller_users.py b/planetstack/openstack_observer/steps/sync_controller_users.py
index 0c35047..ca2909c 100644
--- a/planetstack/openstack_observer/steps/sync_controller_users.py
+++ b/planetstack/openstack_observer/steps/sync_controller_users.py
@@ -65,20 +65,12 @@
'tenant':controller_user.user.site.login_base}
rendered = template.render(user_fields)
- res = run_template('sync_controller_users.yaml', user_fields,path='controller_users')
-
- # results is an array in which each element corresponds to an
- # "ok" string received per operation. If we get as many oks as
- # the number of operations we issued, that means a grand success.
- # Otherwise, the number of oks tell us which operation failed.
expected_length = len(roles) + 1
- if (len(res)==expected_length):
- controller_user.kuser_id = res[0]['id']
- controller_user.save()
- elif (len(res)):
- raise Exception('Could not assign roles for user %s'%user_fields['name'])
- else:
- raise Exception('Could not create or update user %s'%user_fields['name'])
+
+ res = run_template('sync_controller_users.yaml', user_fields,path='controller_users', expected_num=expected_length)
+
+ controller_user.kuser_id = res[0]['id']
+ controller_user.save()
def delete_record(self, controller_user):
if controller_user.kuser_id: