From 51a27b758bd822b5f1ad1f0db45aedc74a25ce3d Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 20 Sep 2017 15:05:00 -0500 Subject: [PATCH] Resolve the most painful merge conflict known on earth --- cli/commands.go | 389 -------------- command/commands.go | 24 +- command/remount.go | 116 ----- command/server.go | 64 +-- website/source/_ember_steps.html.erb | 2 +- website/source/api/secret/aws/index.html.md | 22 +- .../source/api/secret/cassandra/index.html.md | 12 +- .../source/api/secret/consul/index.html.md | 20 +- .../source/api/secret/cubbyhole/index.html.md | 20 +- .../api/secret/databases/cassandra.html.md | 18 +- .../api/secret/databases/hanadb.html.md | 14 +- .../source/api/secret/databases/index.html.md | 22 +- .../api/secret/databases/mongodb.html.md | 16 +- .../source/api/secret/databases/mssql.html.md | 10 +- .../api/secret/databases/mysql-maria.html.md | 10 +- .../api/secret/databases/oracle.html.md | 10 +- .../api/secret/databases/postgresql.html.md | 10 +- .../source/api/secret/identity/index.html.md | 27 +- website/source/api/secret/index.html.md | 19 +- website/source/api/secret/kv/index.html.md | 26 +- .../source/api/secret/mongodb/index.html.md | 29 +- website/source/api/secret/mssql/index.html.md | 24 +- website/source/api/secret/mysql/index.html.md | 24 +- website/source/api/secret/pki/index.html.md | 42 +- .../api/secret/postgresql/index.html.md | 26 +- .../source/api/secret/rabbitmq/index.html.md | 18 +- website/source/api/secret/ssh/index.html.md | 20 +- website/source/api/secret/totp/index.html.md | 19 +- .../source/api/secret/transit/index.html.md | 18 +- website/source/api/system/mounts.html.md | 18 +- website/source/docs/auth/aws.html.md | 2 +- website/source/docs/commands/delete.html.md | 2 +- .../source/docs/commands/lease/revoke.html.md | 2 +- website/source/docs/commands/list.html.md | 6 +- .../source/docs/commands/path-help.html.md | 4 +- website/source/docs/commands/secrets.html.md | 6 +- .../source/docs/commands/secrets/list.html.md | 8 +- .../source/docs/commands/secrets/move.html.md | 4 +- website/source/docs/commands/write.html.md | 4 +- .../source/docs/concepts/dev-server.html.md | 2 +- website/source/docs/concepts/lease.html.md | 2 +- .../docs/enterprise/replication/index.html.md | 4 +- .../docs/internals/architecture.html.md | 4 +- .../source/docs/internals/telemetry.html.md | 4 +- website/source/docs/plugin/index.html.md | 2 +- website/source/docs/secrets/aws/index.html.md | 223 ++++---- .../docs/secrets/cassandra/index.html.md | 49 +- .../source/docs/secrets/consul/index.html.md | 138 +++-- .../docs/secrets/cubbyhole/index.html.md | 72 +-- .../docs/secrets/databases/cassandra.html.md | 95 ++-- .../docs/secrets/databases/custom.html.md | 42 +- .../docs/secrets/databases/hanadb.html.md | 138 ++--- .../docs/secrets/databases/index.html.md | 143 +++--- .../docs/secrets/databases/mongodb.html.md | 89 ++-- .../docs/secrets/databases/mssql.html.md | 110 ++-- .../secrets/databases/mysql-maria.html.md | 104 ++-- .../docs/secrets/databases/oracle.html.md | 108 ++-- .../docs/secrets/databases/postgresql.html.md | 92 ++-- .../docs/secrets/identity/index.html.md | 16 +- website/source/docs/secrets/index.html.md | 99 ++-- website/source/docs/secrets/kv/index.html.md | 116 +++-- .../source/docs/secrets/mongodb/index.html.md | 52 +- .../source/docs/secrets/mssql/index.html.md | 47 +- .../source/docs/secrets/mysql/index.html.md | 45 +- website/source/docs/secrets/pki/index.html.md | 481 ++++++------------ .../docs/secrets/postgresql/index.html.md | 45 +- .../docs/secrets/rabbitmq/index.html.md | 150 +++--- .../docs/secrets/ssh/dynamic-ssh-keys.html.md | 14 +- website/source/docs/secrets/ssh/index.html.md | 22 +- .../ssh/one-time-ssh-passwords.html.md | 29 +- .../ssh/signed-ssh-certificates.html.md | 22 +- .../source/docs/secrets/totp/index.html.md | 153 ++++-- .../source/docs/secrets/transit/index.html.md | 197 +++---- website/source/guides/plugin-backends.html.md | 8 +- .../guides/upgrading/upgrade-to-0.5.0.html.md | 2 +- .../getting-started/authentication.html.md | 2 +- .../getting-started/dynamic-secrets.html.md | 6 +- .../getting-started/first-secret.html.md | 2 +- .../source/intro/getting-started/help.html.md | 2 +- .../getting-started/secret-backends.html.md | 12 +- website/source/intro/vs/kms.html.md | 2 +- website/source/layouts/api.erb | 2 +- website/source/layouts/docs.erb | 2 +- website/source/layouts/intro.erb | 2 +- 84 files changed, 1762 insertions(+), 2316 deletions(-) delete mode 100644 cli/commands.go delete mode 100644 command/remount.go diff --git a/cli/commands.go b/cli/commands.go deleted file mode 100644 index 22c8640a9..000000000 --- a/cli/commands.go +++ /dev/null @@ -1,389 +0,0 @@ -package cli - -import ( - "os" - - auditFile "github.com/hashicorp/vault/builtin/audit/file" - auditSocket "github.com/hashicorp/vault/builtin/audit/socket" - auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog" - "github.com/hashicorp/vault/physical" - "github.com/hashicorp/vault/version" - - credGcp "github.com/hashicorp/vault-plugin-auth-gcp/plugin" - credKube "github.com/hashicorp/vault-plugin-auth-kubernetes" - credAppId "github.com/hashicorp/vault/builtin/credential/app-id" - credAppRole "github.com/hashicorp/vault/builtin/credential/approle" - credAws "github.com/hashicorp/vault/builtin/credential/aws" - credCert "github.com/hashicorp/vault/builtin/credential/cert" - credGitHub "github.com/hashicorp/vault/builtin/credential/github" - credLdap "github.com/hashicorp/vault/builtin/credential/ldap" - credOkta "github.com/hashicorp/vault/builtin/credential/okta" - credRadius "github.com/hashicorp/vault/builtin/credential/radius" - credUserpass "github.com/hashicorp/vault/builtin/credential/userpass" - - physAzure "github.com/hashicorp/vault/physical/azure" - physCassandra "github.com/hashicorp/vault/physical/cassandra" - physCockroachDB "github.com/hashicorp/vault/physical/cockroachdb" - physConsul "github.com/hashicorp/vault/physical/consul" - physCouchDB "github.com/hashicorp/vault/physical/couchdb" - physDynamoDB "github.com/hashicorp/vault/physical/dynamodb" - physEtcd "github.com/hashicorp/vault/physical/etcd" - physFile "github.com/hashicorp/vault/physical/file" - physGCS "github.com/hashicorp/vault/physical/gcs" - physInmem "github.com/hashicorp/vault/physical/inmem" - physMSSQL "github.com/hashicorp/vault/physical/mssql" - physMySQL "github.com/hashicorp/vault/physical/mysql" - physPostgreSQL "github.com/hashicorp/vault/physical/postgresql" - physS3 "github.com/hashicorp/vault/physical/s3" - physSwift "github.com/hashicorp/vault/physical/swift" - physZooKeeper "github.com/hashicorp/vault/physical/zookeeper" - - "github.com/hashicorp/vault/builtin/logical/aws" - "github.com/hashicorp/vault/builtin/logical/cassandra" - "github.com/hashicorp/vault/builtin/logical/consul" - "github.com/hashicorp/vault/builtin/logical/database" - "github.com/hashicorp/vault/builtin/logical/mongodb" - "github.com/hashicorp/vault/builtin/logical/mssql" - "github.com/hashicorp/vault/builtin/logical/mysql" - "github.com/hashicorp/vault/builtin/logical/pki" - "github.com/hashicorp/vault/builtin/logical/postgresql" - "github.com/hashicorp/vault/builtin/logical/rabbitmq" - "github.com/hashicorp/vault/builtin/logical/ssh" - "github.com/hashicorp/vault/builtin/logical/totp" - "github.com/hashicorp/vault/builtin/logical/transit" - "github.com/hashicorp/vault/builtin/plugin" - - "github.com/hashicorp/vault/audit" - "github.com/hashicorp/vault/command" - "github.com/hashicorp/vault/logical" - "github.com/hashicorp/vault/meta" - "github.com/mitchellh/cli" -) - -// Commands returns the mapping of CLI commands for Vault. The meta -// parameter lets you set meta options for all commands. -func Commands(metaPtr *meta.Meta) map[string]cli.CommandFactory { - if metaPtr == nil { - metaPtr = &meta.Meta{ - TokenHelper: command.DefaultTokenHelper, - } - } - - if metaPtr.Ui == nil { - metaPtr.Ui = &cli.BasicUi{ - Writer: os.Stdout, - ErrorWriter: os.Stderr, - } - } - - return map[string]cli.CommandFactory{ - "init": func() (cli.Command, error) { - return &command.InitCommand{ - Meta: *metaPtr, - }, nil - }, - "server": func() (cli.Command, error) { - c := &command.ServerCommand{ - Meta: *metaPtr, - AuditBackends: map[string]audit.Factory{ - "file": auditFile.Factory, - "syslog": auditSyslog.Factory, - "socket": auditSocket.Factory, - }, - CredentialBackends: map[string]logical.Factory{ - "approle": credAppRole.Factory, - "cert": credCert.Factory, - "aws": credAws.Factory, - "app-id": credAppId.Factory, - "gcp": credGcp.Factory, - "github": credGitHub.Factory, - "userpass": credUserpass.Factory, - "ldap": credLdap.Factory, - "okta": credOkta.Factory, - "radius": credRadius.Factory, - "kubernetes": credKube.Factory, - "plugin": plugin.Factory, - }, - LogicalBackends: map[string]logical.Factory{ - "aws": aws.Factory, - "consul": consul.Factory, - "postgresql": postgresql.Factory, - "cassandra": cassandra.Factory, - "pki": pki.Factory, - "transit": transit.Factory, - "mongodb": mongodb.Factory, - "mssql": mssql.Factory, - "mysql": mysql.Factory, - "ssh": ssh.Factory, - "rabbitmq": rabbitmq.Factory, - "database": database.Factory, - "totp": totp.Factory, - "plugin": plugin.Factory, - }, - - ShutdownCh: command.MakeShutdownCh(), - SighupCh: command.MakeSighupCh(), - } - - c.PhysicalBackends = map[string]physical.Factory{ - "azure": physAzure.NewAzureBackend, - "cassandra": physCassandra.NewCassandraBackend, - "cockroachdb": physCockroachDB.NewCockroachDBBackend, - "consul": physConsul.NewConsulBackend, - "couchdb": physCouchDB.NewCouchDBBackend, - "couchdb_transactional": physCouchDB.NewTransactionalCouchDBBackend, - "dynamodb": physDynamoDB.NewDynamoDBBackend, - "etcd": physEtcd.NewEtcdBackend, - "file": physFile.NewFileBackend, - "file_transactional": physFile.NewTransactionalFileBackend, - "gcs": physGCS.NewGCSBackend, - "inmem": physInmem.NewInmem, - "inmem_ha": physInmem.NewInmemHA, - "inmem_transactional": physInmem.NewTransactionalInmem, - "inmem_transactional_ha": physInmem.NewTransactionalInmemHA, - "mssql": physMSSQL.NewMSSQLBackend, - "mysql": physMySQL.NewMySQLBackend, - "postgresql": physPostgreSQL.NewPostgreSQLBackend, - "s3": physS3.NewS3Backend, - "swift": physSwift.NewSwiftBackend, - "zookeeper": physZooKeeper.NewZooKeeperBackend, - } - - return c, nil - }, - - "ssh": func() (cli.Command, error) { - return &command.SSHCommand{ - Meta: *metaPtr, - }, nil - }, - - "path-help": func() (cli.Command, error) { - return &command.PathHelpCommand{ - Meta: *metaPtr, - }, nil - }, - - "auth": func() (cli.Command, error) { - return &command.AuthCommand{ - Meta: *metaPtr, - Handlers: map[string]command.AuthHandler{ - "github": &credGitHub.CLIHandler{}, - "userpass": &credUserpass.CLIHandler{DefaultMount: "userpass"}, - "ldap": &credLdap.CLIHandler{}, - "okta": &credOkta.CLIHandler{}, - "cert": &credCert.CLIHandler{}, - "aws": &credAws.CLIHandler{}, - "radius": &credUserpass.CLIHandler{DefaultMount: "radius"}, - }, - }, nil - }, - - "auth-enable": func() (cli.Command, error) { - return &command.AuthEnableCommand{ - Meta: *metaPtr, - }, nil - }, - - "auth-disable": func() (cli.Command, error) { - return &command.AuthDisableCommand{ - Meta: *metaPtr, - }, nil - }, - - "audit-list": func() (cli.Command, error) { - return &command.AuditListCommand{ - Meta: *metaPtr, - }, nil - }, - - "audit-disable": func() (cli.Command, error) { - return &command.AuditDisableCommand{ - Meta: *metaPtr, - }, nil - }, - - "audit-enable": func() (cli.Command, error) { - return &command.AuditEnableCommand{ - Meta: *metaPtr, - }, nil - }, - - "key-status": func() (cli.Command, error) { - return &command.KeyStatusCommand{ - Meta: *metaPtr, - }, nil - }, - - "policies": func() (cli.Command, error) { - return &command.PolicyListCommand{ - Meta: *metaPtr, - }, nil - }, - - "policy-delete": func() (cli.Command, error) { - return &command.PolicyDeleteCommand{ - Meta: *metaPtr, - }, nil - }, - - "policy-write": func() (cli.Command, error) { - return &command.PolicyWriteCommand{ - Meta: *metaPtr, - }, nil - }, - - "read": func() (cli.Command, error) { - return &command.ReadCommand{ - Meta: *metaPtr, - }, nil - }, - - "unwrap": func() (cli.Command, error) { - return &command.UnwrapCommand{ - Meta: *metaPtr, - }, nil - }, - - "list": func() (cli.Command, error) { - return &command.ListCommand{ - Meta: *metaPtr, - }, nil - }, - - "write": func() (cli.Command, error) { - return &command.WriteCommand{ - Meta: *metaPtr, - }, nil - }, - - "delete": func() (cli.Command, error) { - return &command.DeleteCommand{ - Meta: *metaPtr, - }, nil - }, - - "rekey": func() (cli.Command, error) { - return &command.RekeyCommand{ - Meta: *metaPtr, - }, nil - }, - - "generate-root": func() (cli.Command, error) { - return &command.GenerateRootCommand{ - Meta: *metaPtr, - }, nil - }, - - "renew": func() (cli.Command, error) { - return &command.RenewCommand{ - Meta: *metaPtr, - }, nil - }, - - "revoke": func() (cli.Command, error) { - return &command.RevokeCommand{ - Meta: *metaPtr, - }, nil - }, - - "seal": func() (cli.Command, error) { - return &command.SealCommand{ - Meta: *metaPtr, - }, nil - }, - - "status": func() (cli.Command, error) { - return &command.StatusCommand{ - Meta: *metaPtr, - }, nil - }, - - "unseal": func() (cli.Command, error) { - return &command.UnsealCommand{ - Meta: *metaPtr, - }, nil - }, - - "step-down": func() (cli.Command, error) { - return &command.StepDownCommand{ - Meta: *metaPtr, - }, nil - }, - - "mount": func() (cli.Command, error) { - return &command.MountCommand{ - Meta: *metaPtr, - }, nil - }, - - "mounts": func() (cli.Command, error) { - return &command.MountsCommand{ - Meta: *metaPtr, - }, nil - }, - - "mount-tune": func() (cli.Command, error) { - return &command.MountTuneCommand{ - Meta: *metaPtr, - }, nil - }, - - "remount": func() (cli.Command, error) { - return &command.RemountCommand{ - Meta: *metaPtr, - }, nil - }, - - "rotate": func() (cli.Command, error) { - return &command.RotateCommand{ - Meta: *metaPtr, - }, nil - }, - - "unmount": func() (cli.Command, error) { - return &command.UnmountCommand{ - Meta: *metaPtr, - }, nil - }, - - "token-create": func() (cli.Command, error) { - return &command.TokenCreateCommand{ - Meta: *metaPtr, - }, nil - }, - - "token-lookup": func() (cli.Command, error) { - return &command.TokenLookupCommand{ - Meta: *metaPtr, - }, nil - }, - - "token-renew": func() (cli.Command, error) { - return &command.TokenRenewCommand{ - Meta: *metaPtr, - }, nil - }, - - "token-revoke": func() (cli.Command, error) { - return &command.TokenRevokeCommand{ - Meta: *metaPtr, - }, nil - }, - - "capabilities": func() (cli.Command, error) { - return &command.CapabilitiesCommand{ - Meta: *metaPtr, - }, nil - }, - - "version": func() (cli.Command, error) { - versionInfo := version.GetVersion() - - return &command.VersionCommand{ - VersionInfo: versionInfo, - Ui: metaPtr.Ui, - }, nil - }, - } -} diff --git a/command/commands.go b/command/commands.go index 06a57a53d..751d66e7c 100644 --- a/command/commands.go +++ b/command/commands.go @@ -32,6 +32,7 @@ import ( auditSyslog "github.com/hashicorp/vault/builtin/audit/syslog" credGcp "github.com/hashicorp/vault-plugin-auth-gcp/plugin" + credKube "github.com/hashicorp/vault-plugin-auth-kubernetes" credAppId "github.com/hashicorp/vault/builtin/credential/app-id" credAppRole "github.com/hashicorp/vault/builtin/credential/approle" credAws "github.com/hashicorp/vault/builtin/credential/aws" @@ -410,17 +411,18 @@ func init() { "syslog": auditSyslog.Factory, }, CredentialBackends: map[string]logical.Factory{ - "app-id": credAppId.Factory, - "approle": credAppRole.Factory, - "aws": credAws.Factory, - "cert": credCert.Factory, - "gcp": credGcp.Factory, - "github": credGitHub.Factory, - "ldap": credLdap.Factory, - "okta": credOkta.Factory, - "plugin": plugin.Factory, - "radius": credRadius.Factory, - "userpass": credUserpass.Factory, + "app-id": credAppId.Factory, + "approle": credAppRole.Factory, + "aws": credAws.Factory, + "cert": credCert.Factory, + "gcp": credGcp.Factory, + "github": credGitHub.Factory, + "kubernetes": credKube.Factory, + "ldap": credLdap.Factory, + "okta": credOkta.Factory, + "plugin": plugin.Factory, + "radius": credRadius.Factory, + "userpass": credUserpass.Factory, }, LogicalBackends: map[string]logical.Factory{ "aws": aws.Factory, diff --git a/command/remount.go b/command/remount.go deleted file mode 100644 index 999e5ac3a..000000000 --- a/command/remount.go +++ /dev/null @@ -1,116 +0,0 @@ -package command - -import ( - "fmt" - "strings" - - "github.com/hashicorp/vault-enterprise/meta" - "github.com/mitchellh/cli" - "github.com/posener/complete" -) - -// Ensure we are implementing the right interfaces. -var _ cli.Command = (*RemountCommand)(nil) -var _ cli.CommandAutocomplete = (*RemountCommand)(nil) - -// RemountCommand is a Command that remounts a mounted secret backend -// to a new endpoint. -type RemountCommand struct { - *BaseCommand -} - -func (c *RemountCommand) Synopsis() string { - return "Remounts a secret backend to a new path" -} - -func (c *RemountCommand) Help() string { - helpText := ` -Usage: vault remount [options] SOURCE DESTINATION - - Remounts an existing secret backend to a new path. Any leases from the old - backend are revoked, but the data associated with the backend (such as - configuration), is preserved. - - Move the existing mount at secret/ to generic/: - - $ vault remount secret/ generic/ - - For a full list of examples, please see the documentation. - -` + c.Flags().Help() - - return strings.TrimSpace(helpText) -} - -func (c *RemountCommand) Flags() *FlagSets { - return c.flagSet(FlagSetHTTP) -} - -func (c *RemountCommand) AutocompleteArgs() complete.Predictor { - return c.PredictVaultMounts() -} - -func (c *RemountCommand) AutocompleteFlags() complete.Flags { - return c.Flags().Completions() -} - -func (c *RemountCommand) Run(args []string) int { - f := c.Flags() - - if err := f.Parse(args); err != nil { - c.UI.Error(err.Error()) - return 1 - } - - args = f.Args() - switch len(args) { - case 0, 1: - c.UI.Error(fmt.Sprintf("Not enough arguments (expected 2, got %d)", len(args))) - return 1 - case 2: - default: - c.UI.Error(fmt.Sprintf("Too many arguments (expected 2, got %d)", len(args))) - return 1 - } - - // Grab the source and destination - source := ensureTrailingSlash(args[0]) - destination := ensureTrailingSlash(args[1]) - - client, err := c.Client() - if err != nil { - c.UI.Error(err.Error()) - return 2 - } - - if err := client.Sys().Remount(source, destination); err != nil { - c.UI.Error(fmt.Sprintf("Error remounting %s to %s: %s", source, destination, err)) - return 2 - } - - c.UI.Output(fmt.Sprintf("Success! Remounted %s to: %s", source, destination)) - return 0 -} - -func (c *RemountCommand) Synopsis() string { - return "Remount a secret backend to a new path" -} - -func (c *RemountCommand) Help() string { - helpText := ` -Usage: vault remount [options] from to - - Remount a mounted secret backend to a new path. - - This command remounts a secret backend that is already mounted to - a new path. All the secrets from the old path will be revoked, but - the data associated with the backend (such as configuration), will - be preserved. - - Example: vault remount secret/ kv/ - -General Options: -` + meta.GeneralOptionsUsage() - - return strings.TrimSpace(helpText) -} diff --git a/command/server.go b/command/server.go index 0160776dc..180a2fae6 100644 --- a/command/server.go +++ b/command/server.go @@ -8,14 +8,12 @@ import ( "net/http" "net/url" "os" - "os/signal" "path/filepath" "runtime" "sort" "strconv" "strings" "sync" - "syscall" "time" "golang.org/x/net/http2" @@ -84,6 +82,8 @@ type ServerCommand struct { flagDevPluginDir string flagDevHA bool + flagDevLatency int + flagDevLatencyJitter int flagDevTransactional bool flagDevLeasedKV bool flagDevThreeNode bool @@ -204,8 +204,20 @@ func (c *ServerCommand) Flags() *FlagSets { Hidden: true, }) + f.IntVar(&IntVar{ + Name: "dev-latency", + Target: &c.flagDevLatency, + Hidden: true, + }) + + f.IntVar(&IntVar{ + Name: "dev-latency-jitter", + Target: &c.flagDevLatencyJitter, + Hidden: true, + }) + f.BoolVar(&BoolVar{ - Name: "dev-leased-generic", + Name: "dev-leased-kv", Target: &c.flagDevLeasedKV, Default: false, Hidden: true, @@ -442,12 +454,12 @@ func (c *ServerCommand) Run(args []string) int { if devPluginDir != "" { coreConfig.PluginDirectory = devPluginDir } - if devLatency > 0 { - injectLatency := time.Duration(devLatency) * time.Millisecond + if c.flagDevLatency > 0 { + injectLatency := time.Duration(c.flagDevLatency) * time.Millisecond if _, txnOK := backend.(physical.Transactional); txnOK { - coreConfig.Physical = physical.NewTransactionalLatencyInjector(backend, injectLatency, devLatencyJitter, c.logger) + coreConfig.Physical = physical.NewTransactionalLatencyInjector(backend, injectLatency, c.flagDevLatencyJitter, c.logger) } else { - coreConfig.Physical = physical.NewLatencyInjector(backend, injectLatency, devLatencyJitter, c.logger) + coreConfig.Physical = physical.NewLatencyInjector(backend, injectLatency, c.flagDevLatencyJitter, c.logger) } } } @@ -859,13 +871,13 @@ CLUSTER_SYNTHESIS_COMPLETE: // Write out the PID to the file now that server has successfully started if err := c.storePidFile(config.PidFile); err != nil { - c.Ui.Output(fmt.Sprintf("Error storing PID: %v", err)) + c.UI.Error(fmt.Sprintf("Error storing PID: %s", err)) return 1 } defer func() { if err := c.removePidFile(config.PidFile); err != nil { - c.Ui.Output(fmt.Sprintf("Error deleting the PID file: %v", err)) + c.UI.Error(fmt.Sprintf("Error deleting the PID file: %s", err)) } }() @@ -1456,6 +1468,8 @@ func (c *ServerCommand) AutocompleteFlags() complete.Flags { "-dev-listen-address": complete.PredictNothing, "-log-level": complete.PredictSet("trace", "debug", "info", "warn", "err"), } + + return reloadErrors.ErrorOrNil() } // storePidFile is used to write out our PID to a file if necessary @@ -1489,38 +1503,6 @@ func (c *ServerCommand) removePidFile(pidPath string) error { return os.Remove(pidPath) } -// MakeShutdownCh returns a channel that can be used for shutdown -// notifications for commands. This channel will send a message for every -// SIGINT or SIGTERM received. -func MakeShutdownCh() chan struct{} { - resultCh := make(chan struct{}) - - shutdownCh := make(chan os.Signal, 4) - signal.Notify(shutdownCh, os.Interrupt, syscall.SIGTERM) - go func() { - <-shutdownCh - close(resultCh) - }() - return resultCh -} - -// MakeSighupCh returns a channel that can be used for SIGHUP -// reloading. This channel will send a message for every -// SIGHUP received. -func MakeSighupCh() chan struct{} { - resultCh := make(chan struct{}) - - signalCh := make(chan os.Signal, 4) - signal.Notify(signalCh, syscall.SIGHUP) - go func() { - for { - <-signalCh - resultCh <- struct{}{} - } - }() - return resultCh -} - type grpclogFaker struct { logger log.Logger log bool diff --git a/website/source/_ember_steps.html.erb b/website/source/_ember_steps.html.erb index c28a008e8..7980f25c1 100644 --- a/website/source/_ember_steps.html.erb +++ b/website/source/_ember_steps.html.erb @@ -95,7 +95,7 @@