mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Small fixes and UX changes
This commit is contained in:
@@ -42,7 +42,7 @@ func (c *DeploymentFailCommand) Synopsis() string {
|
||||
func (c *DeploymentFailCommand) Run(args []string) int {
|
||||
var detach, verbose bool
|
||||
|
||||
flags := c.Meta.FlagSet("deployment resume", FlagSetClient)
|
||||
flags := c.Meta.FlagSet("deployment fail", FlagSetClient)
|
||||
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
||||
flags.BoolVar(&detach, "detach", false, "")
|
||||
flags.BoolVar(&verbose, "verbose", false, "")
|
||||
|
||||
@@ -30,12 +30,9 @@ General Options:
|
||||
|
||||
Promote Options:
|
||||
|
||||
-all
|
||||
All promotes all task groups in the deployment.
|
||||
|
||||
-group
|
||||
Group may be specified many times and is used to promote that particular
|
||||
group.
|
||||
group. If no specific groups are specified, all groups are promoted.
|
||||
|
||||
-detach
|
||||
Return immediately instead of entering monitor mode. After deployment
|
||||
@@ -49,16 +46,15 @@ Promote Options:
|
||||
}
|
||||
|
||||
func (c *DeploymentPromoteCommand) Synopsis() string {
|
||||
return "Manually fail a deployment"
|
||||
return "Promote canaries in a deployment"
|
||||
}
|
||||
|
||||
func (c *DeploymentPromoteCommand) Run(args []string) int {
|
||||
var all, detach, verbose bool
|
||||
var detach, verbose bool
|
||||
var groups []string
|
||||
|
||||
flags := c.Meta.FlagSet("deployment resume", FlagSetClient)
|
||||
flags := c.Meta.FlagSet("deployment promote", FlagSetClient)
|
||||
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
||||
flags.BoolVar(&all, "all", false, "")
|
||||
flags.BoolVar(&detach, "detach", false, "")
|
||||
flags.BoolVar(&verbose, "verbose", false, "")
|
||||
flags.Var((*flaghelper.StringFlag)(&groups), "group", "")
|
||||
@@ -73,10 +69,6 @@ func (c *DeploymentPromoteCommand) Run(args []string) int {
|
||||
c.Ui.Error(c.Help())
|
||||
return 1
|
||||
}
|
||||
if !all && len(groups) == 0 {
|
||||
c.Ui.Error("Either -all or one or more -group flags must be specified.")
|
||||
return 1
|
||||
}
|
||||
dID := args[0]
|
||||
|
||||
// Truncate the id unless full length is requested
|
||||
@@ -105,14 +97,14 @@ func (c *DeploymentPromoteCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
var u *api.DeploymentUpdateResponse
|
||||
if all {
|
||||
if len(groups) == 0 {
|
||||
u, _, err = client.Deployments().PromoteAll(deploy.ID, nil)
|
||||
} else {
|
||||
u, _, err = client.Deployments().PromoteGroups(deploy.ID, groups, nil)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error failing deployment: %s", err))
|
||||
c.Ui.Error(fmt.Sprintf("Error promoting deployment: %s", err))
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -177,9 +177,12 @@ func formatDeploymentGroups(d *api.Deployment, uuidLength int) string {
|
||||
if autorevert {
|
||||
rowString += "Auto Revert|"
|
||||
}
|
||||
if canaries {
|
||||
rowString += "Promoted|"
|
||||
}
|
||||
rowString += "Desired|"
|
||||
if canaries {
|
||||
rowString += "Canaries|Promoted|"
|
||||
rowString += "Canaries|"
|
||||
}
|
||||
rowString += "Placed|Healthy|Unhealthy"
|
||||
|
||||
@@ -191,10 +194,12 @@ func formatDeploymentGroups(d *api.Deployment, uuidLength int) string {
|
||||
if autorevert {
|
||||
row += fmt.Sprintf("%v|", state.AutoRevert)
|
||||
}
|
||||
if canaries {
|
||||
row += fmt.Sprintf("%v|", state.Promoted)
|
||||
}
|
||||
row += fmt.Sprintf("%d|", state.DesiredTotal)
|
||||
if canaries {
|
||||
row += fmt.Sprintf("%d|", state.DesiredCanaries)
|
||||
row += fmt.Sprintf("%v|", state.Promoted)
|
||||
}
|
||||
row += fmt.Sprintf("%d|%d|%d", state.PlacedAllocs, state.HealthyAllocs, state.UnhealthyAllocs)
|
||||
rows[i] = row
|
||||
|
||||
@@ -122,7 +122,11 @@ func (d *Deployment) Pause(args *structs.DeploymentPauseRequest, reply *structs.
|
||||
}
|
||||
|
||||
if !deploy.Active() {
|
||||
return fmt.Errorf("can't pause terminal deployment")
|
||||
if args.Pause {
|
||||
return fmt.Errorf("can't pause terminal deployment")
|
||||
}
|
||||
|
||||
return fmt.Errorf("can't resume terminal deployment")
|
||||
}
|
||||
|
||||
// Call into the deployment watcher
|
||||
|
||||
Reference in New Issue
Block a user