Esempio n. 1
0
func manifestWithServicesAndEnv() *manifest.Manifest {
	return &manifest.Manifest{
		Applications: []cf.AppParams{
			cf.NewAppParams(generic.NewMap(map[interface{}]interface{}{
				"name":     "app1",
				"services": []string{"app1-service", "global-service"},
				"env": generic.NewMap(map[string]interface{}{
					"SOMETHING": "definitely-something",
				}),
			})),
			cf.NewAppParams(generic.NewMap(map[interface{}]interface{}{
				"name":     "app2",
				"services": []string{"app2-service", "global-service"},
				"env": generic.NewMap(map[string]interface{}{
					"SOMETHING": "nothing",
				}),
			})),
		},
	}
}
Esempio n. 2
0
File: push.go Progetto: nsnt/cli
func (cmd *Push) createAppSetFromContextAndManifest(c *cli.Context, contextParams cf.AppParams, rootAppPath string, m *manifest.Manifest) (appSet cf.AppSet, err error) {
	if contextParams.Has("name") && len(m.Applications) > 1 {
		err = errors.New("APP_NAME command line argument is not allowed when pushing multiple apps from a manifest file.")
		return
	}

	appSet = make([]cf.AppParams, 0, len(m.Applications))
	if len(m.Applications) == 0 {
		if !contextParams.Has("name") || contextParams.Get("name") == "" {
			cmd.ui.FailWithUsage(c, "push")
			return
		}
		appSet = append(appSet, contextParams)
	} else {
		for _, manifestAppParams := range m.Applications {
			appFields := cf.NewAppParams(generic.Merge(manifestAppParams, contextParams))

			path := rootAppPath
			if manifestAppParams.Has("path") {
				pathFromManifest := manifestAppParams.Get("path").(string)
				if filepath.IsAbs(pathFromManifest) {
					path = filepath.Clean(pathFromManifest)
				} else {
					path = filepath.Join(rootAppPath, pathFromManifest)
				}
			}
			appFields.Set("path", path)

			appSet = append(appSet, appFields)
		}
	}

	for _, appParams := range appSet {
		if !appParams.Has("name") {
			err = errors.New("app name is a required field")
		}
	}

	return
}
Esempio n. 3
0
func singleAppManifest() *manifest.Manifest {
	return &manifest.Manifest{
		Applications: []cf.AppParams{
			cf.NewAppParams(generic.NewMap(map[interface{}]interface{}{
				"name":      "manifest-app-name",
				"memory":    uint64(128),
				"instances": 1,
				"host":      "manifest-host",
				"domain":    "manifest-example.com",
				"stack":     "custom-stack",
				"timeout":   uint64(360),
				"buildpack": "some-buildpack",
				"command":   `JAVA_HOME=$PWD/.openjdk JAVA_OPTS="-Xss995K" ./bin/start.sh run`,
				"path":      "../../fixtures/example-app",
				"env": generic.NewMap(map[string]interface{}{
					"FOO":  "baz",
					"PATH": "/u/apps/my-app/bin",
				}),
			})),
		},
	}
}