MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Execute

Method Execute

cf/commands/buildpack/update_buildpack.go:73–162  ·  view source on GitHub ↗
(c flags.FlagContext)

Source from the content-addressed store, hash-verified

71}
72
73func (cmd *UpdateBuildpack) Execute(c flags.FlagContext) error {
74 buildpack := cmd.buildpackReq.GetBuildpack()
75
76 cmd.ui.Say(T("Updating buildpack {{.BuildpackName}} with stack {{.BuildpackStack}}...", map[string]interface{}{"BuildpackName": terminal.EntityNameColor(buildpack.Name), "BuildpackStack": terminal.EntityNameColor(buildpack.Stack)}))
77
78 updateBuildpack := false
79
80 if c.IsSet("i") {
81 position := c.Int("i")
82
83 buildpack.Position = &position
84 updateBuildpack = true
85 }
86
87 enabled := c.Bool("enable")
88 disabled := c.Bool("disable")
89 if enabled && disabled {
90 return errors.New(T("Cannot specify both {{.Enabled}} and {{.Disabled}}.", map[string]interface{}{
91 "Enabled": "enabled",
92 "Disabled": "disabled",
93 }))
94 }
95
96 if enabled {
97 buildpack.Enabled = &enabled
98 updateBuildpack = true
99 }
100 if disabled {
101 disabled = false
102 buildpack.Enabled = &disabled
103 updateBuildpack = true
104 }
105
106 lock := c.Bool("lock")
107 unlock := c.Bool("unlock")
108 if lock && unlock {
109 return errors.New(T("Cannot specify both lock and unlock options."))
110 }
111
112 path := c.String("p")
113
114 if path != "" && (lock || unlock) {
115 return errors.New(T("Cannot specify buildpack bits and lock/unlock."))
116 }
117
118 if lock {
119 buildpack.Locked = &lock
120 updateBuildpack = true
121 }
122 if unlock {
123 unlock = false
124 buildpack.Locked = &unlock
125 updateBuildpack = true
126 }
127 var (
128 buildpackFile *os.File
129 buildpackFileName string
130 err error

Callers

nothing calls this directly

Calls 13

EntityNameColorFunction · 0.92
GetBuildpackMethod · 0.65
SayMethod · 0.65
IsSetMethod · 0.65
IntMethod · 0.65
BoolMethod · 0.65
StringMethod · 0.65
WarnMethod · 0.65
UpdateMethod · 0.65
ErrorMethod · 0.65
UploadBuildpackMethod · 0.65

Tested by

no test coverage detected