func (this *ServiceDeployWebSocketController) operateAppOnPaaS(ws *websocket.Conn, onPaaS entity.OnPaaS, deployDir string, operate string) bool {
	writeStringMessage(ws, "============================================")
	writeStringMessage(ws, "Operate app ")

	var out bytes.Buffer
	mapps, err := utils.ReadYamlFile(deployDir + "/manifest.yml")
	var apps []string
	if err != nil {
		writeStringMessage(ws, fmt.Sprintf("Operate app failed ,errors :%v", err))
		return false
	}

	if err == nil {
		apps, err = utils.GetValuesByKey(mapps, "name")
		if err != nil {
			writeStringMessage(ws, fmt.Sprintf("Operate app failed ,errors :%v", err))
			return false
		}
		if err == nil {
			for _, app := range apps {
				if app != "" {
					cfOperateCommand := utils.Command{Name: "cf", Args: []string{operate, app}, Dir: deployDir, Stdin: "", Env: []string{"CF_COLOR=false"}}
					cmdRunner := utils.NewDeployCmdRunner()
					cmdRunner.RunCommandAsyncCmd(cfOperateCommand, &out)
					writeBytesBufferMessage(&out, &cmdRunner, ws)
				}
			}
			writeStringMessage(ws, "Operate app successful")
		}
	}

	writeStringMessage(ws, "============================================")

	return true
}
package utils_test

import (
	"github.com/citycloud/citycloud.cf-deploy-ui/utils"

	"fmt"
	. "github.com/onsi/ginkgo"
)

var _ = Describe("Yamlhelper", func() {
	It("Test read key", func() {
		mapp, err := utils.ReadYamlFile("/home/ubuntu/deploy/example/manifest.yml")
		str, err := utils.GetValuesByKey(mapp, "name")
		if err != nil {
			fmt.Println(err)
		}
		for _, v := range str {
			fmt.Println(v)
		}
	})
})