In order to uniquely identify the users in Rally we want to update the Display Name field of users so that 2 people with same name can be identified.
e.g. John D([email protected])
John G([email protected])
Tried below code snippet to get all the users in Rally and then will use update()
OR post()
method to change the displyname is above format.
import sys
from pyral import Rally, rallyWorkset
options = [arg for arg in sys.argv[1:] if arg.startswith('--')]
args = [arg for arg in sys.argv[1:] if arg not in options]
server = "rally1.rallydev.com"
apikey = "<rally_api_key>"
workspace = "<myworkspace>"
#project = "<myproject>"
rally = Rally(server,apikey=apikey, workspace=workspace)
rally.enableLogging('mypyral.log')
all_users = rally.getAllUsers()
for user in all_users:
tz = user.UserProfile.TimeZone or 'default'
role = user.Role or '-No Role-'
values = (int(user.oid), user.Name, user.UserName, role, tz)
print("%12.12d %-24.24s %-30.30s %-12.12s" % values)
Does not give any output - the logic turns into infinite loop
Is there any alternate way to update the Display Name field for all the users.
I was able to update the displayname field with below code.
require 'rally_api'
#require 'rally_user_management'
require 'csv'
require './lib/go_update_user_attributes.rb'
$input_filename_arg = ARGV[0]
if $input_filename_arg == nil
# This is the default of the file to be used for uploading user permissions
$input_filename = 'update_user_attributes_template.txt'
else
$input_filename = File.dirname(__FILE__) + "/" + $input_filename_arg
end
begin
go_update_user_attributes($input_filename)
end
The only thing you need to make sure is the input file which you provide as a parameter should be a text file not a CSV,Excel etc. Your input file - update_user_attributes_template.txt
UserID LastName FirstName DisplayName Role OfficeLocation Department CostCenter Phone NetworkID DefaultWorkspaceName DefaultProjectName TimeZone
[email protected] dummy name (testuser)
$ update_user_attributes.rb update_user_attributes_template.txt