MCPcopy Index your code
hub / github.com/cloudfoundry/multiapps-cli-plugin / executeInternal

Method executeInternal

commands/deploy_command.go:250–423  ·  view source on GitHub ↗
(positionalArgs []string, dsHost string, flags *flag.FlagSet, cfTarget util.CloudFoundryTarget)

Source from the content-addressed store, hash-verified

248}
249
250func (c *DeployCommand) executeInternal(positionalArgs []string, dsHost string, flags *flag.FlagSet, cfTarget util.CloudFoundryTarget) ExecutionStatus {
251 operationID := GetStringOpt(operationIDOpt, flags)
252 action := GetStringOpt(actionOpt, flags)
253 retries := GetUintOpt(retriesOpt, flags)
254
255 if operationID != "" || action != "" {
256 return c.ExecuteAction(operationID, action, retries, dsHost, cfTarget)
257 }
258
259 mtaElementsCalculator := createMtaElementsCalculator(flags)
260
261 rawMtaArchive, err := c.getMtaArchive(positionalArgs, mtaElementsCalculator)
262 if err != nil {
263 ui.Failed("Error retrieving MTA: %s", err.Error())
264 return Failure
265 }
266
267 isUrl, mtaArchive := parseMtaArchiveArgument(rawMtaArchive)
268
269 mtaNameToPrint := terminal.EntityNameColor(mtaArchive)
270 if isUrl {
271 mtaNameToPrint = "from url"
272 }
273
274 // Print initial message
275 ui.Say("Deploying multi-target app archive %s in org %s / space %s as %s...\n",
276 mtaNameToPrint, terminal.EntityNameColor(cfTarget.Org.Name), terminal.EntityNameColor(cfTarget.Space.Name),
277 terminal.EntityNameColor(cfTarget.Username))
278
279 var uploadedArchivePartIds []string
280 var uploadStatus ExecutionStatus
281 var mtaId string
282 var disposableUserProvidedServiceName string
283
284 // Check SLMP metadata
285 // TODO: ensure session
286 mtaClient := c.NewMtaClient(dsHost, cfTarget)
287
288 namespace := strings.TrimSpace(GetStringOpt(namespaceOpt, flags))
289 force := GetBoolOpt(forceOpt, flags)
290 conf := configuration.NewSnapshot()
291 uploadChunkSize := conf.GetUploadChunkSizeInMB()
292 sequentialUpload := conf.GetUploadChunksSequentially()
293 disableProgressBar := conf.GetDisableUploadProgressBar()
294 fileUploader := NewFileUploader(mtaClient, namespace, uploadChunkSize, sequentialUpload, disableProgressBar)
295 var yamlBytes []byte
296
297 if isUrl {
298 var fileId string
299 var schemaVersion string
300
301 asyncUploadJobResult := c.uploadFromUrl(mtaArchive, mtaClient, namespace, disableProgressBar)
302 if asyncUploadJobResult.ExecutionStatus == Failure {
303 return Failure
304 }
305 mtaId, fileId, schemaVersion = asyncUploadJobResult.MtaId, asyncUploadJobResult.FileId, asyncUploadJobResult.SchemaVersion
306 // Check for an ongoing operation for this MTA ID and abort it
307 wasAborted, err := c.CheckOngoingOperation(mtaId, namespace, dsHost, force, cfTarget)

Callers

nothing calls this directly

Calls 15

getMtaArchiveMethod · 0.95
uploadFromUrlMethod · 0.95
uploadFilesMethod · 0.95
UploadBytesMethod · 0.95
FailedFunction · 0.92
SayFunction · 0.92
NewSnapshotFunction · 0.92
NewClientErrorFunction · 0.92
OkFunction · 0.92

Tested by

no test coverage detected