sambot 0.1.104 → 0.1.105
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bf476d1d26fedc75e7af52b286dd4afc62f550e
|
4
|
+
data.tar.gz: a3faf0302e3e640f36acc8efc2eb6f8573c6c626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b50102c8892b7fd83feb15f1954e4a870b035e0948af32ef9056db11d08673ede99e6406aeed3d3c3f67cf9a92e1526d2016d188e53a9130bb4031b9c5459025
|
7
|
+
data.tar.gz: 0ec80be8220908bb3395e834c0ff082001681347f1c1447a31fc34c51cc5837a65b2b1eba05bacd6adc26ec40ab86e988b74e986944ef38f924205b1a8a0a20d
|
data/lib/sambot/chef/kitchen.rb
CHANGED
@@ -17,7 +17,21 @@ module Sambot
|
|
17
17
|
"#{KITCHEN_RACKSPACE_YML}": read_template(KITCHEN_RACKSPACE_YML, cookbook_name, platforms)
|
18
18
|
}
|
19
19
|
test_kitchen_configs.each do |key, value|
|
20
|
-
|
20
|
+
if suites
|
21
|
+
value['suites'] = Marshal.load(Marshal.dump(suites))
|
22
|
+
case key.to_s
|
23
|
+
when KITCHEN_GCP_YML
|
24
|
+
value['suites'].each do |config|
|
25
|
+
config['attributes'] = config['attributes'] || {}
|
26
|
+
config['attributes']['cloud_platform'] = 'GCP'
|
27
|
+
end
|
28
|
+
when KITCHEN_RACKSPACE_YML
|
29
|
+
value['suites'].each do |config|
|
30
|
+
config['attributes'] = config['attributes'] || {}
|
31
|
+
config['attributes']['cloud_platform'] = 'RACKSPACE'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
21
35
|
test_kitchen_configs[key] = value.to_yaml
|
22
36
|
end
|
23
37
|
test_kitchen_configs
|
@@ -60,13 +60,26 @@ module Sambot
|
|
60
60
|
|
61
61
|
no_commands do
|
62
62
|
|
63
|
-
def execute
|
63
|
+
def execute(access = :standard)
|
64
|
+
if access == :sudo
|
65
|
+
ensure_running_as_sudo
|
66
|
+
else
|
67
|
+
ensure_not_running_as_sudo
|
68
|
+
end
|
64
69
|
Runtime.ensure_latest
|
65
70
|
yield
|
66
71
|
rescue ApplicationError => e
|
67
72
|
UI.error(e.message)
|
68
73
|
end
|
69
74
|
|
75
|
+
def ensure_not_running_as_sudo
|
76
|
+
raise ApplicationError, "This command should not be run as sudo" unless ENV['USER'] != 'root'
|
77
|
+
end
|
78
|
+
|
79
|
+
def ensure_running_as_sudo
|
80
|
+
raise ApplicationError, "This command needs to be run as sudo" unless ENV['USER'] == 'root'
|
81
|
+
end
|
82
|
+
|
70
83
|
def config
|
71
84
|
Config.new.read
|
72
85
|
end
|
data/lib/sambot/commands/dns.rb
CHANGED
@@ -11,7 +11,7 @@ module Sambot
|
|
11
11
|
desc 'remove', 'Removes the given DNS entry'
|
12
12
|
option :hostname, :required => true, :desc => 'The DNS name for the A record'
|
13
13
|
def remove
|
14
|
-
execute do
|
14
|
+
execute(:sudo) do
|
15
15
|
Sambot::DNS::Repository.new.records.remove(options[:hostname])
|
16
16
|
end
|
17
17
|
end
|
@@ -37,7 +37,7 @@ module Sambot
|
|
37
37
|
option :team, :desc => 'The team owning the instance pointed to. Leave blank if the hostname contains stable, patch or unstable i.e. stable-api'
|
38
38
|
long_desc docs('cookbook/clean')
|
39
39
|
def add
|
40
|
-
execute { Sambot::DNS::Repository.new.records.add(options[:hostname], options[:address], options[:team]) }
|
40
|
+
execute(:sudo) { Sambot::DNS::Repository.new.records.add(options[:hostname], options[:address], options[:team]) }
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
@@ -8,7 +8,7 @@ module Sambot
|
|
8
8
|
|
9
9
|
desc 'start', 'Start a new DEV/QE session'
|
10
10
|
def start
|
11
|
-
execute do
|
11
|
+
execute(:sudo) do
|
12
12
|
username = ENV['SAMBOT_SESSION_USERNAME']
|
13
13
|
password = ENV['SAMBOT_SESSION_PASSWORD']
|
14
14
|
unless username && password
|
@@ -22,7 +22,7 @@ module Sambot
|
|
22
22
|
|
23
23
|
desc 'stop', 'Stop the DEV/QE session'
|
24
24
|
def stop
|
25
|
-
execute { DeveloperWorkflow::Session.new.stop }
|
25
|
+
execute(:sudo) { DeveloperWorkflow::Session.new.stop }
|
26
26
|
end
|
27
27
|
|
28
28
|
end
|
@@ -45,7 +45,6 @@ module Sambot
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def kill_active_sessions
|
48
|
-
ensure_running_as_sudo
|
49
48
|
Dante::Runner.new('sambot-session').execute(:kill => true)
|
50
49
|
UI.debug("All active Sambot sessions have been closed.")
|
51
50
|
end
|
@@ -67,10 +66,6 @@ module Sambot
|
|
67
66
|
return false
|
68
67
|
end
|
69
68
|
|
70
|
-
def ensure_running_as_sudo
|
71
|
-
raise ApplicationError, "This command needs to be run as sudo" unless ENV['USER'] == 'root'
|
72
|
-
end
|
73
|
-
|
74
69
|
def start_daemon_for_tunneling(username, password)
|
75
70
|
Dante::Runner.new('sambot-session').execute(:daemonize => true, :log_path => 'sambot-session.log') do
|
76
71
|
setup_ssh_tunnels(username, password)
|
data/lib/sambot/version.rb
CHANGED