From 4fdb0934cbfe4abf05f3ffc470a6aa2fa37c8ad4 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Mon, 11 May 2020 12:36:30 +1200 Subject: [PATCH] feat(cli): remove the --no-snapshot CLI flag (#3814) --- api/cli/cli.go | 9 --------- api/cli/defaults.go | 1 - api/cli/defaults_windows.go | 1 - api/cmd/portainer/main.go | 13 +++++-------- api/portainer.go | 2 -- app/portainer/services/stateManager.js | 1 - 6 files changed, 5 insertions(+), 22 deletions(-) diff --git a/api/cli/cli.go b/api/cli/cli.go index 91d4b3f47..88d73b411 100644 --- a/api/cli/cli.go +++ b/api/cli/cli.go @@ -50,7 +50,6 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) { SSLCert: kingpin.Flag("sslcert", "Path to the SSL certificate used to secure the Portainer instance").Default(defaultSSLCertPath).String(), SSLKey: kingpin.Flag("sslkey", "Path to the SSL key used to secure the Portainer instance").Default(defaultSSLKeyPath).String(), SyncInterval: kingpin.Flag("sync-interval", "Duration between each synchronization via the external endpoints source (deprecated)").Default(defaultSyncInterval).String(), - Snapshot: kingpin.Flag("snapshot", "Start a background job to create endpoint snapshots (deprecated)").Default(defaultSnapshot).Bool(), SnapshotInterval: kingpin.Flag("snapshot-interval", "Duration between each endpoint snapshot job").Default(defaultSnapshotInterval).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(), @@ -124,14 +123,6 @@ func displayDeprecationWarnings(flags *portainer.CLIFlags) { if *flags.NoAuth { log.Println("Warning: the --no-auth flag is deprecated and will likely be removed in a future version of Portainer.") } - - if !*flags.Snapshot { - log.Println("Warning: the --no-snapshot flag is deprecated and will likely be removed in a future version of Portainer.") - } - - if *flags.TemplateFile != "" { - log.Println("Warning: the --template-file flag is deprecated and will likely be removed in a future version of Portainer.") - } } func validateEndpointURL(endpointURL string) error { diff --git a/api/cli/defaults.go b/api/cli/defaults.go index f644e1ff6..40e29292f 100644 --- a/api/cli/defaults.go +++ b/api/cli/defaults.go @@ -19,6 +19,5 @@ const ( defaultSSLCertPath = "/certs/portainer.crt" defaultSSLKeyPath = "/certs/portainer.key" defaultSyncInterval = "60s" - defaultSnapshot = "true" defaultSnapshotInterval = "5m" ) diff --git a/api/cli/defaults_windows.go b/api/cli/defaults_windows.go index b9e13d571..5fd6b10a7 100644 --- a/api/cli/defaults_windows.go +++ b/api/cli/defaults_windows.go @@ -17,6 +17,5 @@ const ( defaultSSLCertPath = "C:\\certs\\portainer.crt" defaultSSLKeyPath = "C:\\certs\\portainer.key" defaultSyncInterval = "60s" - defaultSnapshot = "true" defaultSnapshotInterval = "5m" ) diff --git a/api/cmd/portainer/main.go b/api/cmd/portainer/main.go index 795c2b473..10010050a 100644 --- a/api/cmd/portainer/main.go +++ b/api/cmd/portainer/main.go @@ -225,12 +225,11 @@ func loadSchedulesFromDatabase(jobScheduler portainer.JobScheduler, jobService p return nil } -func initStatus(endpointManagement, snapshot bool, flags *portainer.CLIFlags) *portainer.Status { +func initStatus(endpointManagement bool, flags *portainer.CLIFlags) *portainer.Status { return &portainer.Status{ Analytics: !*flags.NoAnalytics, Authentication: !*flags.NoAuth, EndpointManagement: endpointManagement, - Snapshot: snapshot, Version: portainer.APIVersion, } } @@ -492,16 +491,14 @@ func main() { log.Fatal(err) } - if *flags.Snapshot { - err = loadSnapshotSystemSchedule(jobScheduler, snapshotter, store.ScheduleService, store.EndpointService, store.SettingsService) - if err != nil { - log.Fatal(err) - } + err = loadSnapshotSystemSchedule(jobScheduler, snapshotter, store.ScheduleService, store.EndpointService, store.SettingsService) + if err != nil { + log.Fatal(err) } jobScheduler.Start() - applicationStatus := initStatus(endpointManagement, *flags.Snapshot, flags) + applicationStatus := initStatus(endpointManagement, flags) err = initEndpoint(flags, store.EndpointService, snapshotter) if err != nil { diff --git a/api/portainer.go b/api/portainer.go index c1f4f9d47..ee1ff157f 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -57,7 +57,6 @@ type ( SSLCert *string SSLKey *string SyncInterval *string - Snapshot *bool SnapshotInterval *string } @@ -493,7 +492,6 @@ type ( Status struct { Authentication bool `json:"Authentication"` EndpointManagement bool `json:"EndpointManagement"` - Snapshot bool `json:"Snapshot"` Analytics bool `json:"Analytics"` Version string `json:"Version"` } diff --git a/app/portainer/services/stateManager.js b/app/portainer/services/stateManager.js index 1fda3ae68..e65c8d224 100644 --- a/app/portainer/services/stateManager.js +++ b/app/portainer/services/stateManager.js @@ -80,7 +80,6 @@ angular.module('portainer.app').factory('StateManager', [ state.application.authentication = status.Authentication; state.application.analytics = status.Analytics; state.application.endpointManagement = status.EndpointManagement; - state.application.snapshot = status.Snapshot; state.application.version = status.Version; state.application.logo = settings.LogoURL; state.application.snapshotInterval = settings.SnapshotInterval;