feat(cli): remove the --no-snapshot CLI flag (#3814)

2.0
Anthony Lapenna 2020-05-11 12:36:30 +12:00 committed by Anthony Lapenna
parent d202660bb8
commit 4fdb0934cb
6 changed files with 5 additions and 22 deletions

View File

@ -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(), 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(), 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(), 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(), SnapshotInterval: kingpin.Flag("snapshot-interval", "Duration between each endpoint snapshot job").Default(defaultSnapshotInterval).String(),
AdminPassword: kingpin.Flag("admin-password", "Hashed admin password").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(), 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 { if *flags.NoAuth {
log.Println("Warning: the --no-auth flag is deprecated and will likely be removed in a future version of Portainer.") 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 { func validateEndpointURL(endpointURL string) error {

View File

@ -19,6 +19,5 @@ const (
defaultSSLCertPath = "/certs/portainer.crt" defaultSSLCertPath = "/certs/portainer.crt"
defaultSSLKeyPath = "/certs/portainer.key" defaultSSLKeyPath = "/certs/portainer.key"
defaultSyncInterval = "60s" defaultSyncInterval = "60s"
defaultSnapshot = "true"
defaultSnapshotInterval = "5m" defaultSnapshotInterval = "5m"
) )

View File

@ -17,6 +17,5 @@ const (
defaultSSLCertPath = "C:\\certs\\portainer.crt" defaultSSLCertPath = "C:\\certs\\portainer.crt"
defaultSSLKeyPath = "C:\\certs\\portainer.key" defaultSSLKeyPath = "C:\\certs\\portainer.key"
defaultSyncInterval = "60s" defaultSyncInterval = "60s"
defaultSnapshot = "true"
defaultSnapshotInterval = "5m" defaultSnapshotInterval = "5m"
) )

View File

@ -225,12 +225,11 @@ func loadSchedulesFromDatabase(jobScheduler portainer.JobScheduler, jobService p
return nil return nil
} }
func initStatus(endpointManagement, snapshot bool, flags *portainer.CLIFlags) *portainer.Status { func initStatus(endpointManagement bool, flags *portainer.CLIFlags) *portainer.Status {
return &portainer.Status{ return &portainer.Status{
Analytics: !*flags.NoAnalytics, Analytics: !*flags.NoAnalytics,
Authentication: !*flags.NoAuth, Authentication: !*flags.NoAuth,
EndpointManagement: endpointManagement, EndpointManagement: endpointManagement,
Snapshot: snapshot,
Version: portainer.APIVersion, Version: portainer.APIVersion,
} }
} }
@ -492,16 +491,14 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
if *flags.Snapshot { err = loadSnapshotSystemSchedule(jobScheduler, snapshotter, store.ScheduleService, store.EndpointService, store.SettingsService)
err = loadSnapshotSystemSchedule(jobScheduler, snapshotter, store.ScheduleService, store.EndpointService, store.SettingsService) if err != nil {
if err != nil { log.Fatal(err)
log.Fatal(err)
}
} }
jobScheduler.Start() jobScheduler.Start()
applicationStatus := initStatus(endpointManagement, *flags.Snapshot, flags) applicationStatus := initStatus(endpointManagement, flags)
err = initEndpoint(flags, store.EndpointService, snapshotter) err = initEndpoint(flags, store.EndpointService, snapshotter)
if err != nil { if err != nil {

View File

@ -57,7 +57,6 @@ type (
SSLCert *string SSLCert *string
SSLKey *string SSLKey *string
SyncInterval *string SyncInterval *string
Snapshot *bool
SnapshotInterval *string SnapshotInterval *string
} }
@ -493,7 +492,6 @@ type (
Status struct { Status struct {
Authentication bool `json:"Authentication"` Authentication bool `json:"Authentication"`
EndpointManagement bool `json:"EndpointManagement"` EndpointManagement bool `json:"EndpointManagement"`
Snapshot bool `json:"Snapshot"`
Analytics bool `json:"Analytics"` Analytics bool `json:"Analytics"`
Version string `json:"Version"` Version string `json:"Version"`
} }

View File

@ -80,7 +80,6 @@ angular.module('portainer.app').factory('StateManager', [
state.application.authentication = status.Authentication; state.application.authentication = status.Authentication;
state.application.analytics = status.Analytics; state.application.analytics = status.Analytics;
state.application.endpointManagement = status.EndpointManagement; state.application.endpointManagement = status.EndpointManagement;
state.application.snapshot = status.Snapshot;
state.application.version = status.Version; state.application.version = status.Version;
state.application.logo = settings.LogoURL; state.application.logo = settings.LogoURL;
state.application.snapshotInterval = settings.SnapshotInterval; state.application.snapshotInterval = settings.SnapshotInterval;