Commit Graph

9 Commits

Author SHA1 Message Date
James Bardin 305ef43aa6 provide contexts to clistate.Lock calls
Add fields required to create an appropriate context for all calls to
clistate.Lock.

Add missing checks for Meta.stateLock, where we would attempt to lock,
even if locking should be skipped.
2017-04-01 17:09:20 -04:00
James Bardin 3f0dcd1308 Have the clistate Lock use LockWithContext
- Have the ui Lock helper use state.LockWithContext.
- Rename the message package to clistate, since that's how it's imported
  everywhere.
- Use a more idiomatic placement of the Context in the LockWithContext
  args.
2017-04-01 17:09:20 -04:00
James Bardin 9d118325b3 Reject names that aren't url-safe
Environment names can be used in a number of contexts, and should be
properly escaped for safety. Since most state names are store in path
structures, and often in a URL, use `url.PathEscape` to check for
disallowed characters
2017-03-27 18:00:56 -04:00
Mitchell Hashimoto 1f614bd4d6
command: color changes, trimming newlines 2017-03-01 12:59:40 -08:00
James Bardin 39a5ddd381 Split Meta back out of StateMeta
Removing the call to StateMeta.Env, so that it doesn't need an embedded
Meta field. Embed Meta and StateMeta separately in all State commands.
2017-03-01 10:20:32 -05:00
James Bardin b53704ed87 Thread the environment through all commands
Add Env and SetEnv methods to command.Meta to retrieve the current
environment name inside any command.

Make sure all calls to Backend.State contain an environment name, and
make the package compile against the update backend package.
2017-02-28 16:35:46 -05:00
James Bardin 2a73331c62 use State.HasResources rather than State.Empty
Destroying a terraform state can't always create an empty state, as
outputs and the root module may remain. Use HasResources to warn about
deleting an environment with resources.
2017-02-28 16:07:07 -05:00
James Bardin 06663991d1 Add config path argument to env commands
In order to operate in parity with other commands, the env command
should take a path argument to locate the configuration.

This however introduces the issue of a possible name conflict between a
path and subcommand, or printing an incorrect current environment for
the bare `env` command. In favor of simplicity this removes the current
env output and only prints usage when no subcommand is provided.
2017-02-28 16:07:06 -05:00
James Bardin c8526484b3 split the env command into subcommands 2017-02-28 16:07:06 -05:00