Skip to content

Commit

Permalink
skip copy enable if copy already enabled
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
bcambl committed Jun 17, 2020
1 parent 5634338 commit 3b550c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/pkg/rpa/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ func (a *App) EnableAll() {
GroupName := a.getGroupName(g.ID)
groupCopiesSettings := a.getGroupCopiesSettings(g.ID)
copySettings := a.getRequestedCopy(groupCopiesSettings)
// skip if copy is already 'enabled'
if copySettings.RoleInfo.Role == "ACTIVE" {
fmt.Printf("Image Access already enabled for %s -> %s\n", a.Group, copySettings.Name)
return
}
t.GroupName = GroupName
t.GroupUID = copySettings.CopyUID.GroupUID.ID
t.ClusterUID = copySettings.CopyUID.GlobalCopyUID.ClusterUID.ID
Expand All @@ -329,6 +334,11 @@ func (a *App) EnableOne() {
var t Task
groupCopiesSettings := a.getGroupCopiesSettings(groupID)
copySettings := a.getRequestedCopy(groupCopiesSettings)
// skip if copy is already 'enabled'
if copySettings.RoleInfo.Role == "ACTIVE" {
fmt.Printf("Image Access already enabled for %s -> %s\n", a.Group, copySettings.Name)
return
}
t.GroupName = a.Group
t.GroupUID = copySettings.CopyUID.GroupUID.ID
t.ClusterUID = copySettings.CopyUID.GlobalCopyUID.ClusterUID.ID
Expand Down

0 comments on commit 3b550c3

Please sign in to comment.