@@ -16,7 +16,7 @@ package convert
16
16
17
17
import (
18
18
"github.com/Masterminds/semver"
19
- "github.com/mongodb-labs/pcgc/cloudmanager "
19
+ om "github.com/mongodb/go-client-mongodb-ops-manager/opsmngr "
20
20
"github.com/mongodb/mongocli/internal/search"
21
21
)
22
22
@@ -39,8 +39,8 @@ type ClusterConfig struct {
39
39
40
40
// PatchAutomationConfig add the ClusterConfig to a cloudmanager.AutomationConfig
41
41
// this method will modify the given AutomationConfig to add the new replica set information
42
- func (c * ClusterConfig ) PatchAutomationConfig (out * cloudmanager .AutomationConfig ) error {
43
- newProcesses := make ([]* cloudmanager .Process , len (c .ProcessConfigs ))
42
+ func (c * ClusterConfig ) PatchAutomationConfig (out * om .AutomationConfig ) error {
43
+ newProcesses := make ([]* om .Process , len (c .ProcessConfigs ))
44
44
45
45
newReplicaSet , err := c .toReplicaSet ()
46
46
if err != nil {
@@ -67,15 +67,15 @@ func (c *ClusterConfig) PatchAutomationConfig(out *cloudmanager.AutomationConfig
67
67
}
68
68
69
69
// toReplicaSet convert from cli config to cloudmanager.ReplicaSet
70
- func (c * ClusterConfig ) toReplicaSet () (* cloudmanager .ReplicaSet , error ) {
70
+ func (c * ClusterConfig ) toReplicaSet () (* om .ReplicaSet , error ) {
71
71
protocolVer , err := protocolVer (c .FCVersion )
72
72
if err != nil {
73
73
return nil , err
74
74
}
75
75
76
- rs := & cloudmanager .ReplicaSet {
76
+ rs := & om .ReplicaSet {
77
77
ID : c .Name ,
78
- Members : make ([]cloudmanager .Member , len (c .ProcessConfigs )),
78
+ Members : make ([]om .Member , len (c .ProcessConfigs )),
79
79
ProtocolVersion : protocolVer ,
80
80
}
81
81
@@ -85,13 +85,13 @@ func (c *ClusterConfig) toReplicaSet() (*cloudmanager.ReplicaSet, error) {
85
85
// patchProcesses replace replica set processes with new configuration
86
86
// this will disable all existing processes for the given replica set and remove the association
87
87
// Then try to patch then with the new config if one config exists for the same host:port
88
- func patchProcesses (out * cloudmanager .AutomationConfig , newReplicaSetID string , newProcesses []* cloudmanager .Process ) {
88
+ func patchProcesses (out * om .AutomationConfig , newReplicaSetID string , newProcesses []* om .Process ) {
89
89
for i , oldProcess := range out .Processes {
90
90
if oldProcess .Args26 .Replication != nil && oldProcess .Args26 .Replication .ReplSetName == newReplicaSetID {
91
91
oldProcess .Disabled = true
92
- oldProcess .Args26 .Replication = new (cloudmanager .Replication )
92
+ oldProcess .Args26 .Replication = new (om .Replication )
93
93
}
94
- pos , found := search .Processes (newProcesses , func (p * cloudmanager .Process ) bool {
94
+ pos , found := search .Processes (newProcesses , func (p * om .Process ) bool {
95
95
return p .Name == oldProcess .Name
96
96
})
97
97
if found {
@@ -105,8 +105,8 @@ func patchProcesses(out *cloudmanager.AutomationConfig, newReplicaSetID string,
105
105
}
106
106
107
107
// patchReplicaSet if the replica set exists try to patch it if not add it
108
- func patchReplicaSet (out * cloudmanager .AutomationConfig , newReplicaSet * cloudmanager .ReplicaSet ) {
109
- pos , found := search .ReplicaSets (out .ReplicaSets , func (r * cloudmanager .ReplicaSet ) bool {
108
+ func patchReplicaSet (out * om .AutomationConfig , newReplicaSet * om .ReplicaSet ) {
109
+ pos , found := search .ReplicaSets (out .ReplicaSets , func (r * om .ReplicaSet ) bool {
110
110
return r .ID == newReplicaSet .ID
111
111
})
112
112
@@ -118,7 +118,7 @@ func patchReplicaSet(out *cloudmanager.AutomationConfig, newReplicaSet *cloudman
118
118
oldReplicaSet := out .ReplicaSets [pos ]
119
119
lastID := oldReplicaSet .Members [len (oldReplicaSet .Members )- 1 ].ID
120
120
for j , newMember := range newReplicaSet .Members {
121
- k , found := search .Members (oldReplicaSet .Members , func (m cloudmanager .Member ) bool {
121
+ k , found := search .Members (oldReplicaSet .Members , func (m om .Member ) bool {
122
122
return m .Host == newMember .Host
123
123
})
124
124
if found {
0 commit comments