forked from toolshed/abra
NOT WORKING: WIP on adding server-wide logs functionality
This commit is contained in:
@ -112,6 +112,35 @@ func ValidateApp(c *cli.Context) config.App {
|
||||
return app
|
||||
}
|
||||
|
||||
// ValidateAppByName ensures the app is valid and takes an app name as an argument, not context.
|
||||
func ValidateAppByName(c *cli.Context, appName string) config.App {
|
||||
if AppName != "" {
|
||||
appName = AppName
|
||||
logrus.Debugf("programmatically setting app name to %s", appName)
|
||||
}
|
||||
|
||||
if appName == "" {
|
||||
ShowSubcommandHelpAndError(c, errors.New("no app provided"))
|
||||
}
|
||||
|
||||
app, err := app.Get(appName)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := recipe.EnsureExists(app.Type); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := ssh.EnsureHostKey(app.Server); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
logrus.Debugf("validated '%s' as app argument", appName)
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
// ValidateDomain ensures the domain name arg is valid.
|
||||
func ValidateDomain(c *cli.Context) (string, error) {
|
||||
domainName := c.Args().First()
|
||||
|
Reference in New Issue
Block a user