From 672819f3af2618d8000d22c87aa5a2ef12cd4e9d Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 24 Jan 2018 21:58:58 +0100 Subject: [PATCH] refactor(api): remove CLI deprecation related code (#1602) --- api/cli/cli.go | 22 +++------------------- api/portainer.go | 11 +++++------ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/api/cli/cli.go b/api/cli/cli.go index 5df0ce974..db0d80603 100644 --- a/api/cli/cli.go +++ b/api/cli/cli.go @@ -1,7 +1,6 @@ package cli import ( - "log" "time" "github.com/portainer/portainer" @@ -48,10 +47,9 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) { SyncInterval: kingpin.Flag("sync-interval", "Duration between each synchronization via the external endpoints source").Default(defaultSyncInterval).String(), AdminPassword: kingpin.Flag("admin-password", "Hashed admin password").String(), AdminPasswordFile: kingpin.Flag("admin-password-file", "Path to the file containing the password for the admin user").String(), - // Deprecated flags - Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')), - Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(), - Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Short('t').String(), + Labels: pairs(kingpin.Flag("hide-label", "Hide containers with a specific label in the UI").Short('l')), + Logo: kingpin.Flag("logo", "URL for the logo displayed in the UI").String(), + Templates: kingpin.Flag("templates", "URL to the templates (apps) definitions").Short('t').String(), } kingpin.Parse() @@ -97,8 +95,6 @@ func (*Service) ValidateFlags(flags *portainer.CLIFlags) error { return errAdminPassExcludeAdminPassFile } - displayDeprecationWarnings(*flags.Templates, *flags.Logo, *flags.Labels) - return nil } @@ -142,15 +138,3 @@ func validateSyncInterval(syncInterval string) error { } return nil } - -func displayDeprecationWarnings(templates, logo string, labels []portainer.Pair) { - if templates != "" { - log.Println("Warning: the --templates / -t flag is deprecated and will be removed in future versions.") - } - if logo != "" { - log.Println("Warning: the --logo flag is deprecated and will be removed in future versions.") - } - if labels != nil { - log.Println("Warning: the --hide-label / -l flag is deprecated and will be removed in future versions.") - } -} diff --git a/api/portainer.go b/api/portainer.go index cdfd3f2ff..e898d2909 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -12,12 +12,17 @@ type ( // CLIFlags represents the available flags on the CLI. CLIFlags struct { Addr *string + AdminPassword *string + AdminPasswordFile *string Assets *string Data *string Endpoint *string ExternalEndpoints *string + Labels *[]Pair + Logo *string NoAuth *bool NoAnalytics *bool + Templates *string TLSVerify *bool TLSCacert *string TLSCert *string @@ -26,12 +31,6 @@ type ( SSLCert *string SSLKey *string SyncInterval *string - AdminPassword *string - AdminPasswordFile *string - // Deprecated fields - Labels *[]Pair - Logo *string - Templates *string } // Status represents the application status.