Skip to content

Commit

Permalink
For bonus safety, redundantly check for dryRun here
Browse files Browse the repository at this point in the history
The logic up top should make this check unnecessary, but we want
to be extra certain that in dryRun mode no changes are made, so
we'll explicitly guard on it every time. This protects the code
less from itself, and more from future modifications.
  • Loading branch information
nflynt committed Aug 9, 2023
1 parent e17d56f commit 16715df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/agent/clean/active_directory.go
Expand Up @@ -346,7 +346,7 @@ func UnmigrateAdGUIDUsers(clientConfig *restclient.Config, dryRun bool, deleteMi
logrus.Errorf("[%v] unable to migrate user '%v' due to a connection failure; this user will be skipped", migrateAdUserOperation, user.originalUser.Name)
}
for _, missingUser := range missingUsers {
if deleteMissingUsers {
if deleteMissingUsers && !dryRun {
logrus.Infof("[%v] user '%v' with GUID '%v' does not seem to exist in Active Directory. deleteMissingUsers is true, proceeding to delete this user permanently", migrateAdUserOperation, missingUser.originalUser.Name, missingUser.guid)
err = sc.Management.Users("").Delete(missingUser.originalUser.Name, &metav1.DeleteOptions{})
if err != nil {
Expand Down

0 comments on commit 16715df

Please sign in to comment.