Skip to content

Commit

Permalink
Merge pull request #17 from crobby/migrationreview6
Browse files Browse the repository at this point in the history
Additional changes after review
  • Loading branch information
nflynt committed Aug 10, 2023
2 parents 4e18baa + 344a05d commit ad00983
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cleanup/ad-guid-README.md
Expand Up @@ -37,11 +37,11 @@ Active Directory is not the authentication provider, this utility will take no a
## Usage via Rancher Agent

```bash
./ad-guid-unmigration.sh <AGENT IMAGE> [-dry-run] [-delete-missing]
./ad-guid-unmigration.sh <AGENT IMAGE> [--dry-run] [--delete-missing]
```
* The Agent image can be found at: docker.io/rancher/rancher-agent:/v2.7.6
* The -dry-run flag will run the migration utility, but no changes to Rancher data will take place. The potential changes will be indicated in the log file.
* The -delete-missing flag will delete Rancher users that can not be found by looking them up in Active Directory. If -dry-run is set, that will prevent users from being deleted regardless of this flag.
* The Agent image can be found at: docker.io/rancher/rancher-agent:v2.7.6
* The --dry-run flag will run the migration utility, but no changes to Rancher data will take place. The potential changes will be indicated in the log file.
* The --delete-missing flag will delete Rancher users that can not be found by looking them up in Active Directory. If --dry-run is set, that will prevent users from being deleted regardless of this flag.


## Additional notes
Expand Down
13 changes: 13 additions & 0 deletions cleanup/ad-guid-unmigration.sh
Expand Up @@ -136,6 +136,19 @@ display_banner() {
printf "%-${text_width}s \n" "$text"
echo "$border"
}
# Check the Rancher version before doing anything.
# If it is v2.7.5, make it clear that configuration is not the recommended way to run this utility.
rancher_version=$(kubectl get settings server-version --template='{{.value}}')
if [ "$rancher_version" = "v2.7.5" ]; then
echo -e "${RED}IT IS NOT RECOMMENDED TO RUN THIS UTILITY AGAINST RANCHER VERSION v2.7.5${CLEAR}"
echo -e "${RED}IF RANCHER v.2.7.5 RESTARTS AFTER RUNNING THIS UTILITY, IT WILL UNDO THE EFFECTS OF THIS UTILITY.${CLEAR}"
echo -e "${RED}IF YOU DO WANT TO RUN THIS UTILITY, IT IS RECOMMENDED THAT YOU MAKE A BACKUP PRIOR TO CONTINUING.${CLEAR}"
read -p "Do you want to continue? (y/n): " choice
if [[ ! $choice =~ ^[Yy]$ ]]; then
echo "Exiting..."
exit 0
fi
fi

OPTS=$(getopt -o hnd -l help,dry-run,delete-missing -- "$@")
if [ $? != 0 ]; then
Expand Down

0 comments on commit ad00983

Please sign in to comment.