@@ -24,19 +24,23 @@ import (
2424)
2525
2626const (
27+ // PlatformInstallCommand is shorthand for "all the Deis components."
2728 PlatformInstallCommand string = "platform"
2829)
2930
31+ // ListUnits prints a list of installed units.
3032func ListUnits (b backend.Backend ) error {
31- err := b .ListUnits ()
32- return err
33+ return b .ListUnits ()
3334}
3435
36+ // ListUnitFiles prints the contents of all defined unit files.
3537func ListUnitFiles (b backend.Backend ) error {
3638 err := b .ListUnitFiles ()
3739 return err
3840}
3941
42+ // Scale grows or shrinks the number of running components.
43+ // Currently "router" is the only type that can be scaled.
4044func Scale (b backend.Backend , targets []string ) error {
4145 outchan := make (chan string )
4246 errchan := make (chan error )
@@ -60,6 +64,7 @@ func Scale(b backend.Backend, targets []string) error {
6064 return nil
6165}
6266
67+ // Start activates the specified components.
6368func Start (b backend.Backend , targets []string ) error {
6469
6570 if len (targets ) == 1 && targets [0 ] == PlatformInstallCommand {
@@ -94,6 +99,7 @@ deisctl config platform set sshPrivateKey=<path-to-key>
9499 return nil
95100}
96101
102+ // StartPlatform activates all components.
97103func StartPlatform (b backend.Backend ) error {
98104
99105 outchan := make (chan string )
@@ -165,6 +171,7 @@ func startDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan st
165171 wg .Wait ()
166172}
167173
174+ // Stop deactivates the specified components.
168175func Stop (b backend.Backend , targets []string ) error {
169176
170177 if len (targets ) == 1 && targets [0 ] == PlatformInstallCommand {
@@ -184,6 +191,7 @@ func Stop(b backend.Backend, targets []string) error {
184191 return nil
185192}
186193
194+ // StopPlatform deactivates all components.
187195func StopPlatform (b backend.Backend ) error {
188196
189197 outchan := make (chan string )
@@ -234,13 +242,15 @@ func stopDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan str
234242 wg .Wait ()
235243}
236244
245+ // Restart stops and then starts components.
237246func Restart (b backend.Backend , targets []string ) error {
238247 if err := Stop (b , targets ); err != nil {
239248 return err
240249 }
241250 return Start (b , targets )
242251}
243252
253+ // Status prints the current state of components.
244254func Status (b backend.Backend , targets []string ) error {
245255 for _ , target := range targets {
246256 if err := b .Status (target ); err != nil {
@@ -250,6 +260,7 @@ func Status(b backend.Backend, targets []string) error {
250260 return nil
251261}
252262
263+ // Journal prints log output for the specified components.
253264func Journal (b backend.Backend , targets []string ) error {
254265 for _ , target := range targets {
255266 if err := b .Journal (target ); err != nil {
@@ -259,6 +270,8 @@ func Journal(b backend.Backend, targets []string) error {
259270 return nil
260271}
261272
273+ // Install loads components' definitions from local unit files.
274+ // After Install, the components will be available to Start.
262275func Install (b backend.Backend , targets []string ) error {
263276
264277 // if target is platform, install all services
@@ -280,6 +293,8 @@ func Install(b backend.Backend, targets []string) error {
280293 return nil
281294}
282295
296+ // InstallPlatform loads all components' definitions from local unit files.
297+ // After InstallPlatform, all components will be available for StartPlatform.
283298func InstallPlatform (b backend.Backend ) error {
284299
285300 if err := checkRequiredKeys (); err != nil {
@@ -328,6 +343,8 @@ func installDefaultServices(b backend.Backend, wg *sync.WaitGroup, outchan chan
328343 wg .Wait ()
329344}
330345
346+ // Uninstall unloads components' definitions.
347+ // After Uninstall, the component will be unavailable until Install is called.
331348func Uninstall (b backend.Backend , targets []string ) error {
332349
333350 // if target is platform, uninstall all services
@@ -349,6 +366,8 @@ func Uninstall(b backend.Backend, targets []string) error {
349366 return nil
350367}
351368
369+ // UninstallPlatform unloads all components' definitions.
370+ // After UninstallPlatform, all components will be unavailable.
352371func UninstallPlatform (b backend.Backend ) error {
353372
354373 outchan := make (chan string )
@@ -432,13 +451,15 @@ func splitScaleTarget(target string) (c string, num int, err error) {
432451 return
433452}
434453
454+ // Config gets or sets a configuration value in the cluster.
435455func Config () error {
436456 if err := config .Config (); err != nil {
437457 return err
438458 }
439459 return nil
440460}
441461
462+ // Update changes the platform version on a cluster host.
442463func Update () error {
443464 if err := utils .Execute (constant .HooksDir + "pre-update" ); err != nil {
444465 fmt .Println ("pre-updatehook failed" )
@@ -455,6 +476,9 @@ func Update() error {
455476 return nil
456477}
457478
479+ // RefreshUnits overwrites local unit files with those requested.
480+ // Downloading from the Deis project GitHub URL by tag or SHA is the only mechanism
481+ // currently supported.
458482func RefreshUnits () error {
459483 usage := `Refreshes local unit files from the master repository.
460484
0 commit comments