Frank Schroeder
cd837b0b18
pkg refactor
...
command/agent/* -> agent/*
command/consul/* -> agent/consul/*
command/agent/command{,_test}.go -> command/agent{,_test}.go
command/base/command.go -> command/base.go
command/base/* -> command/*
commands.go -> command/commands.go
The script which did the refactor is:
(
cd $GOPATH/src/github.com/hashicorp/consul
git mv command/agent/command.go command/agent.go
git mv command/agent/command_test.go command/agent_test.go
git mv command/agent/flag_slice_value{,_test}.go command/
git mv command/agent .
git mv command/base/command.go command/base.go
git mv command/base/config_util{,_test}.go command/
git mv commands.go command/
git mv consul agent
rmdir command/base/
gsed -i -e 's|package agent|package command|' command/agent{,_test}.go
gsed -i -e 's|package agent|package command|' command/flag_slice_value{,_test}.go
gsed -i -e 's|package base|package command|' command/base.go command/config_util{,_test}.go
gsed -i -e 's|package main|package command|' command/commands.go
gsed -i -e 's|base.Command|BaseCommand|' command/commands.go
gsed -i -e 's|agent.Command|AgentCommand|' command/commands.go
gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/commands.go
gsed -i -e 's|base\.||' command/commands.go
gsed -i -e 's|command\.||' command/commands.go
gsed -i -e 's|command|c|' main.go
gsed -i -e 's|range Commands|range command.Commands|' main.go
gsed -i -e 's|Commands: Commands|Commands: command.Commands|' main.go
gsed -i -e 's|base\.BoolValue|BoolValue|' command/operator_autopilot_set.go
gsed -i -e 's|base\.DurationValue|DurationValue|' command/operator_autopilot_set.go
gsed -i -e 's|base\.StringValue|StringValue|' command/operator_autopilot_set.go
gsed -i -e 's|base\.UintValue|UintValue|' command/operator_autopilot_set.go
gsed -i -e 's|\bCommand\b|BaseCommand|' command/base.go
gsed -i -e 's|BaseCommand Options|Command Options|' command/base.go
gsed -i -e 's|base.Command|BaseCommand|' command/*.go
gsed -i -e 's|c\.Command|c.BaseCommand|g' command/*.go
gsed -i -e 's|\tCommand:|\tBaseCommand:|' command/*_test.go
gsed -i -e 's|base\.||' command/*_test.go
gsed -i -e 's|\bCommand\b|AgentCommand|' command/agent{,_test}.go
gsed -i -e 's|cmd.AgentCommand|cmd.BaseCommand|' command/agent.go
gsed -i -e 's|cli.AgentCommand = new(Command)|cli.Command = new(AgentCommand)|' command/agent_test.go
gsed -i -e 's|exec.AgentCommand|exec.Command|' command/agent_test.go
gsed -i -e 's|exec.BaseCommand|exec.Command|' command/agent_test.go
gsed -i -e 's|NewTestAgent|agent.NewTestAgent|' command/agent_test.go
gsed -i -e 's|= TestConfig|= agent.TestConfig|' command/agent_test.go
gsed -i -e 's|: RetryJoin|: agent.RetryJoin|' command/agent_test.go
gsed -i -e 's|\.\./\.\./|../|' command/config_util_test.go
gsed -i -e 's|\bverifyUniqueListeners|VerifyUniqueListeners|' agent/config{,_test}.go command/agent.go
gsed -i -e 's|\bserfLANKeyring\b|SerfLANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
gsed -i -e 's|\bserfWANKeyring\b|SerfWANKeyring|g' agent/{agent,keyring,testagent}.go command/agent.go
gsed -i -e 's|\bNewAgent\b|agent.New|g' command/agent{,_test}.go
gsed -i -e 's|\bNewAgent|New|' agent/{acl_test,agent,testagent}.go
gsed -i -e 's|\bAgent\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bBool\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bConfig\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bDefaultConfig\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bDevConfig\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bMergeConfig\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bReadConfigPaths\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bParseMetaPair\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bSerfLANKeyring\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|\bSerfWANKeyring\b|agent.&|g' command/agent{,_test}.go
gsed -i -e 's|circonus\.agent|circonus|g' command/agent{,_test}.go
gsed -i -e 's|logger\.agent|logger|g' command/agent{,_test}.go
gsed -i -e 's|metrics\.agent|metrics|g' command/agent{,_test}.go
gsed -i -e 's|// agent.Agent|// agent|' command/agent{,_test}.go
gsed -i -e 's|a\.agent\.Config|a.Config|' command/agent{,_test}.go
gsed -i -e 's|agent\.AppendSliceValue|AppendSliceValue|' command/{configtest,validate}.go
gsed -i -e 's|consul/consul|agent/consul|' GNUmakefile
gsed -i -e 's|\.\./test|../../test|' agent/consul/server_test.go
# fix imports
f=$(grep -rl 'github.com/hashicorp/consul/command/agent' * | grep '\.go')
gsed -i -e 's|github.com/hashicorp/consul/command/agent|github.com/hashicorp/consul/agent|' $f
goimports -w $f
f=$(grep -rl 'github.com/hashicorp/consul/consul' * | grep '\.go')
gsed -i -e 's|github.com/hashicorp/consul/consul|github.com/hashicorp/consul/agent/consul|' $f
goimports -w $f
goimports -w command/*.go main.go
)
2017-06-10 18:52:45 +02:00
Frank Schroeder
8c7bb7b65a
golint: Rename fields and structs
2017-04-25 09:26:13 -07:00
Kyle Havlovitz
9e38fc1c84
Move command Meta to base.Command and split http options
2017-02-07 19:16:41 -05:00
Kyle Havlovitz
0f796f0cba
Convert configtest and force-leave commands to use Meta
2017-02-06 20:50:51 -05:00
Seth Vargo
6f01227963
Centralize command-line parsing
2016-10-13 18:03:29 -04:00
James Phillips
6dd0835319
Makes the timeout behavior more intuitive.
...
Previously, it would try once "up to" the timeout, but in practice it would
just fall through. This modifies the behavior to block until the timeout has
been reached.
2016-01-06 09:40:20 -08:00
James Phillips
87dd758199
Defaults monitor retries to 3 retries @ 1s for the consul lock command.
2016-01-05 18:34:22 -08:00
James Phillips
9323276b58
Adds monitor retries to the consul lock command.
2016-01-05 18:22:36 -08:00
James Phillips
3348cf4c0b
Adds "try" support to locks and semaphores.
2016-01-05 18:22:36 -08:00
Anthony Scalisi
8d733b7fca
remove various typos
2015-09-11 12:29:54 -07:00
Michael S. Fischer
01ec256c7e
lock.go: fix another race condition
...
The previous fix to `consul lock` (commit 6875e8d) didn't completely
eliminate the race that could occur if the lock was acquired around the
same time SIGTERM was received: It was still possible for
Run() to spawn the process via startChild() after killChild() had
released the shared mutex.
Now, when SIGTERM is received, we acquire a mutex that prevents
spawning a new process and never release it.
We've tested this fix pretty thoroughly and believe it completely
resolves the issue.
2015-09-01 14:27:23 -07:00
Ryota Arai
c45f2971e7
command/lock: Pass stdin to child process when -pass-stdin passed.
2015-08-26 16:27:21 +09:00
Armon Dadgar
c2a865686c
Merge pull request #1158 from mfischer-zd/fix_1155
...
lock.go: fix race condition
2015-08-05 14:56:13 -07:00
Michael S. Fischer
9e0e9e389d
lock.go: fix race condition
...
Fix a race condition between startChild() and killChild() that could
lead to an orphaned managed process.
Fixes #1155
2015-08-05 09:06:51 -07:00
J.R. Garcia
f95ba4b8eb
Remove trailing slash from lock
...
Lock command will remove trailing slash from path (as it is invalid).
Fixes #1136 .
2015-07-30 12:14:17 -05:00
Armon Dadgar
6f42f6640c
command/lock: Check for shutdown during lock acquisition. Fixes #800
2015-07-22 16:07:44 -07:00
Benjamin Abbott-Scott
eece6e4848
Return every time lock acquisition fails
2015-07-22 10:44:47 -07:00
Emil Hessman
2a80aacb86
docs: describe child process handling on Windows for lock command
...
Add website documentation for how the lock command handles child
process termination on Windows.
2015-01-25 11:42:29 +01:00
Emil Hessman
c8224b3f94
command: fix Windows build
...
Add a per GOOS implementation to send signals to PIDs
since syscall.Kill does not exist on Windows.
It will always send a SIGKILL on Windows since there
seems to be no POSIX compatible notion.
Fixes build on Windows.
2015-01-25 05:00:52 +01:00
Armon Dadgar
2502398481
command/lock: Fixing mixed spaces and tabs
2015-01-20 12:58:29 -08:00
Armon Dadgar
b52c14d1b2
command/lock: Calculate name, use provided token
2015-01-19 15:38:00 -10:00
Armon Dadgar
cdfaaac3ac
command/lock: Ensure a conflict between lock and semaphore with shared prefix
2015-01-19 15:26:17 -10:00
Armon Dadgar
1aa8b0fc23
command/lock: First pass at lock
2015-01-19 14:37:48 -10:00