Problem
- Unable to delete TFE users
- User created logon with wrong info, then created a new logon.
- Invitation is sent but not received by user
- Trying to delete accounts option is dimmed as Users were not properly added
As per screenshot below it will be displayed awkwardly .Without clear details
Cause
-
Users details are not added properly
- Compare information of working user and non-working user by connection to
Rails
and compare the attributes
Solutions:
-
Solution 1
- Access the TFE instance using a protocol such as ssh
- Next, connect to
Rails
utilizing the following command:$ sudo docker exec -it ptfe_atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
# Terraform Enterprise v202205-1(619) and newer$ sudo docker exec -it tfe-atlas /usr/bin/init.sh /app/scripts/wait-for-token -- bash -i -c 'cd /app && ./bin/rails c'
- Then from the prompt check for the existence of the users by initiating one of these commands, please note the
User id
from the output for each user as it will be necessary for the delete command to appropriate the user:User.all
(Will list all created users) orUser.find_by(email: "email address of user")
(List individual users by email) - Gather the
User id
from the output when listing the user - Run the delete command to delete the user plugging in the
User Id
as the criteria:User.delete(User id number)
- Repeat step 3 to ensure the delete was accomplished
- Rerun the process as necessary for each user
-
Solution 2
In some cases Solution 1 is not enough as we need to havepassword
andpassword_confirmation
to match for.save
to work.Save should return
true
.
We should be able to do auser.valid?
before the save, and it should returntrue
.Steps to follow
- Access the TFE instance using a protocol such as ssh. Next, connect to
Rails
via Docker as instructed above. - Run the following block
user.username = 'username' user.password = user.password_confirmation = "username" user.save! # this runs the validations
- Access the TFE instance using a protocol such as ssh. Next, connect to
Outcome
Now Users are no longer showing in GUI and can be re-added with correct information