X-Git-Url: http://git.onelab.eu/?p=plstackapi.git;a=blobdiff_plain;f=planetstack%2Fopenstack_observer%2Fsteps%2Fsync_controller_users.py;h=ca2909ca5c755c21a3348576d138dfb27e175c9d;hp=0c35047d8fff08a6aa1d69af0031b9364db0d28d;hb=50c795217b2327793eff678bb456bacd702c9c5f;hpb=0e6906f17ae49614e566fb0f251d559bde59d188 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 @@ class SyncControllerUsers(OpenStackSyncStep): '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: