Class: HQ::Engine::UnlockCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/hq/engine/unlock-command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hqObject

Returns the value of attribute hq.



5
6
7
# File 'lib/hq/engine/unlock-command.rb', line 5

def hq
  @hq
end

Instance Method Details

#couchObject



7
# File 'lib/hq/engine/unlock-command.rb', line 7

def couch() hq.couch end

#go(command_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/hq/engine/unlock-command.rb', line 10

def go command_name

	locks =
		couch.get "mandar-locks"

	if locks["deploy"]

		if locks["deploy"]["role"] == $deploy_role

			logger.warning "unlocking deployment for role " +
				"#{locks["deploy"]["role"]}"

			locks["deploy"] = nil

		else

			logger.error "not unlocking deployment for role " +
				"#{locks["deploy"]["role"]}"

		end

	end

	locks["changes"].each do
		|role, change|

		next if change["state"] == "stage"

		if role == $deploy_role

			logger.warning "unlocking changes in state " +
				"#{change["state"]} for role #{role}"

			change["state"] = "stage"

		else

			logger.warning "not unlocking changes in state " +
				"#{change["state"]} for role #{role}"

		end

	end

	couch.update locks

end

#loggerObject



8
# File 'lib/hq/engine/unlock-command.rb', line 8

def logger() hq.logger end