MCPcopy
hub / github.com/cloudfoundry/cli / GetBaseManifest

Method GetBaseManifest

command/v7/push_command.go:287–332  ·  view source on GitHub ↗
(flagOverrides v7pushaction.FlagOverrides)

Source from the content-addressed store, hash-verified

285}
286
287func (cmd PushCommand) GetBaseManifest(flagOverrides v7pushaction.FlagOverrides) (manifestparser.Manifest, error) {
288 defaultManifest := manifestparser.Manifest{
289 Applications: []manifestparser.Application{
290 {Name: flagOverrides.AppName},
291 },
292 }
293 if cmd.NoManifest {
294 log.Debugf("No manifest given, generating manifest")
295 return defaultManifest, nil
296 }
297
298 log.Info("reading manifest if exists")
299 readPath := cmd.CWD
300 if flagOverrides.ManifestPath != "" {
301 log.WithField("manifestPath", flagOverrides.ManifestPath).Debug("reading '-f' provided manifest")
302 readPath = flagOverrides.ManifestPath
303 }
304
305 pathToManifest, exists, err := cmd.ManifestLocator.Path(readPath)
306 if err != nil {
307 return manifestparser.Manifest{}, err
308 }
309
310 if !exists {
311 log.Debugf("No manifest given, generating manifest")
312 return defaultManifest, nil
313 }
314
315 log.WithField("manifestPath", pathToManifest).Debug("path to manifest")
316 rawManifest, err := cmd.ManifestParser.InterpolateManifest(pathToManifest, flagOverrides.PathsToVarsFiles, flagOverrides.Vars)
317 if err != nil {
318 log.Errorln("reading manifest:", err)
319 if _, ok := err.(*yaml.TypeError); ok {
320 return manifestparser.Manifest{}, errors.New(fmt.Sprintf("Unable to push app because manifest %s is not valid yaml.", pathToManifest))
321 }
322 return manifestparser.Manifest{}, err
323 }
324
325 manifest, err := cmd.ManifestParser.ParseManifest(pathToManifest, rawManifest)
326 if err != nil {
327 log.Errorln("parsing manifest:", err)
328 return manifestparser.Manifest{}, err
329 }
330
331 return manifest, nil
332}
333
334func (cmd PushCommand) GetDockerPassword(dockerUsername string, containsPrivateDockerImages bool) (string, error) {
335 if dockerUsername == "" && !containsPrivateDockerImages { // no need for a password without a username

Callers 2

ExecuteMethod · 0.95

Calls 4

NewFunction · 0.92
PathMethod · 0.65
InterpolateManifestMethod · 0.65
ParseManifestMethod · 0.65

Tested by

no test coverage detected