@@ -105,46 +105,34 @@ func createMicroshift(kmd *cobra.Command, cliCtx cliutils.SoftwareFactoryConfigC
105
105
msAnsibleMicroshiftRolePath = rootDir + "/ansible-microshift-role"
106
106
ctrl .Log .Info ("No path to ansible-microshift-role provided, the role will be cloned into " + msAnsibleMicroshiftRolePath )
107
107
}
108
- defaultSFOperatorRepositoryPath , _ := os .Getwd ()
109
- msSFOperatorRepositoryPath := cliCtx .Dev .SFOperatorRepositoryPath
110
- if msSFOperatorRepositoryPath == "" {
111
- if defaultSFOperatorRepositoryPath != "" {
112
- msSFOperatorRepositoryPath = defaultSFOperatorRepositoryPath
113
- ctrl .Log .Info ("Using current working directory for sf-operator-repository-path: " + msSFOperatorRepositoryPath )
114
- } else {
115
- ctrl .Log .Error (errMissingArg , "The path to the sf-operator repository must be set in `dev` section of the configuration file" )
116
- os .Exit (1 )
117
- }
118
- }
119
-
120
108
options := ms .MkAnsiblePlaybookOptions (msHost , msUser , msOpenshiftPullSecret , rootDir )
121
109
varsFile := ms .MkTemporaryVarsFile (
122
110
cliCtx .FQDN , msDiskFileSize , msAnsibleMicroshiftRolePath , rootDir , msEtcdOnRamdisk )
123
111
options .ExtraVarsFile = []string {"@" + varsFile }
124
112
// Ensure ansible-microshift-role is available
125
113
ms .MkMicroshiftRoleSetupPlaybook (rootDir )
126
114
if ! dryRun {
127
- ms .RunMicroshiftRoleSetup (rootDir , msSFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
115
+ ms .RunMicroshiftRoleSetup (rootDir , cliCtx . Dev . SFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
128
116
}
129
117
// Ensure tooling and prerequisites are installed
130
118
if ! skipLocalSetup {
131
119
ms .MkLocalSetupPlaybook (rootDir )
132
120
if ! dryRun {
133
- ms .RunLocalSetup (rootDir , msSFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
121
+ ms .RunLocalSetup (rootDir , cliCtx . Dev . SFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
134
122
}
135
123
}
136
124
// Deploy MicroShift
137
125
if ! skipDeploy {
138
126
ms .MkDeployMicroshiftPlaybook (rootDir )
139
127
if ! dryRun {
140
- ms .RunDeploy (rootDir , msSFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
128
+ ms .RunDeploy (rootDir , cliCtx . Dev . SFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
141
129
}
142
130
}
143
131
// Configure cluster for development and testing
144
132
if ! skipPostInstall {
145
133
ms .MkPostInstallPlaybook (rootDir )
146
134
if ! dryRun {
147
- ms .RunPostInstall (rootDir , msSFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
135
+ ms .RunPostInstall (rootDir , cliCtx . Dev . SFOperatorRepositoryPath , msAnsibleMicroshiftRolePath , options )
148
136
}
149
137
}
150
138
if ! dryRun {
@@ -157,7 +145,6 @@ func createMicroshift(kmd *cobra.Command, cliCtx cliutils.SoftwareFactoryConfigC
157
145
func devRunTests (kmd * cobra.Command , args []string ) {
158
146
cliCtx := cliutils .GetCLIctxOrDie (kmd , args , runTestsAllowedArgs )
159
147
target := args [0 ]
160
- sfOperatorRepositoryPath := cliCtx .Dev .SFOperatorRepositoryPath
161
148
vars , _ := kmd .Flags ().GetStringSlice ("extra-var" )
162
149
extraVars := cliutils .VarListToMap (vars )
163
150
if len (extraVars ) == 0 {
@@ -166,10 +153,6 @@ func devRunTests(kmd *cobra.Command, args []string) {
166
153
if extraVars == nil {
167
154
extraVars = make (map [string ]string )
168
155
}
169
- if sfOperatorRepositoryPath == "" {
170
- ctrl .Log .Error (errMissingArg , "The path to the sf-operator repository must be set in `dev` section of the configuration" )
171
- os .Exit (1 )
172
- }
173
156
var verbosity string
174
157
verbose , _ := kmd .Flags ().GetBool ("v" )
175
158
debug , _ := kmd .Flags ().GetBool ("vvv" )
@@ -196,7 +179,7 @@ func devRunTests(kmd *cobra.Command, args []string) {
196
179
reposPath = "deploy"
197
180
}
198
181
extraVars ["demo_repos_path" ] = reposPath
199
- createDemoEnv (env , restConfig , fqdn , reposPath , sfOperatorRepositoryPath , false )
182
+ createDemoEnv (env , restConfig , fqdn , reposPath , cliCtx . Dev . SFOperatorRepositoryPath , false )
200
183
}
201
184
// use config file and context for CLI calls in the tests
202
185
var cliGlobalFlags string
@@ -212,11 +195,11 @@ func devRunTests(kmd *cobra.Command, args []string) {
212
195
}
213
196
extraVars ["cli_global_flags" ] = cliGlobalFlags
214
197
if target == "olm" {
215
- runTestOLM (extraVars , sfOperatorRepositoryPath , verbosity )
198
+ runTestOLM (extraVars , cliCtx . Dev . SFOperatorRepositoryPath , verbosity )
216
199
} else if target == "standalone" {
217
- runTestStandalone (extraVars , sfOperatorRepositoryPath , verbosity )
200
+ runTestStandalone (extraVars , cliCtx . Dev . SFOperatorRepositoryPath , verbosity )
218
201
} else if target == "upgrade" {
219
- runTestUpgrade (extraVars , sfOperatorRepositoryPath , verbosity )
202
+ runTestUpgrade (extraVars , cliCtx . Dev . SFOperatorRepositoryPath , verbosity )
220
203
}
221
204
}
222
205
@@ -260,13 +243,8 @@ func devCreate(kmd *cobra.Command, args []string) {
260
243
ctrl .Log .Info ("Demo repos path unset; repos will be cloned into ./deploy" )
261
244
reposPath = "deploy"
262
245
}
263
- sfOperatorRepositoryPath := cliCtx .Dev .SFOperatorRepositoryPath
264
- if sfOperatorRepositoryPath == "" {
265
- ctrl .Log .Error (errMissingArg , "The path to the sf-operator repository must be set in `dev` section of the configuration" )
266
- os .Exit (1 )
267
- }
268
246
keepDemoTenantDefinition , _ := kmd .Flags ().GetBool ("keep-demo-tenant" )
269
- createDemoEnv (env , restConfig , fqdn , reposPath , sfOperatorRepositoryPath , keepDemoTenantDefinition )
247
+ createDemoEnv (env , restConfig , fqdn , reposPath , cliCtx . Dev . SFOperatorRepositoryPath , keepDemoTenantDefinition )
270
248
271
249
} else {
272
250
ctrl .Log .Error (errors .New ("unsupported target" ), "Invalid argument '" + target + "'" )
0 commit comments