aristanetworks / cvprac

Other
46 stars 48 forks source link

add_users_from_csv_cvaas.py only works with default group #207

Open philippebureau opened 2 years ago

philippebureau commented 2 years ago

User creation works with default groups (network-admin, network-operator...) but not work user created roles

This is the error : POST: https://www.cv-prod-na-northeast1-b.arista.io:443/cvpservice/user/addUser.do : Request Error: Failure - Unable to add new entity

noredistribution commented 2 years ago

That's because the addUser.do expects role IDs, the default roles have the same name as their role IDs, whereas user created roles have role_<unixtime> as their ID. On cvprac side we could fix this by running /role/getRoles.do to fetch all roles and swap the name with the id in the call, ie validate if the name the user has input is a roleId or not, and if not push the roleID. Would that help?

philippebureau commented 2 years ago

On cvprac side we could fix this by running /role/getRoles.do to fetch all roles and swap the name with the id in the call, ie validate if the name the user has input is a roleId or not, and if not push the roleID. Would that help?

That would help yes