testlab 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/tl-console +19 -0
- data/bin/tl-knife +61 -0
- data/lib/testlab/version.rb +1 -1
- metadata +5 -3
data/bin/tl-console
CHANGED
@@ -1,4 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
################################################################################
|
3
|
+
#
|
4
|
+
# Author: Zachary Patten <zachary AT jovelabs DOT com>
|
5
|
+
# Copyright: Copyright (c) Zachary Patten
|
6
|
+
# License: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
################################################################################
|
2
21
|
require 'rubygems'
|
3
22
|
require 'bundler/setup'
|
4
23
|
require 'pry'
|
data/bin/tl-knife
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
################################################################################
|
3
|
+
#
|
4
|
+
# Author: Zachary Patten <zachary AT jovelabs DOT com>
|
5
|
+
# Copyright: Copyright (c) Zachary Patten
|
6
|
+
# License: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
################################################################################
|
21
|
+
require 'rubygems'
|
22
|
+
require 'bundler/setup'
|
23
|
+
require 'testlab'
|
24
|
+
require 'ztk'
|
25
|
+
|
26
|
+
REGEX_ESCAPES = /([\[\]])/
|
27
|
+
REGEX_ESCAPES_PREFIX = %(\\)
|
28
|
+
|
29
|
+
current_dir = File.dirname(__FILE__)
|
30
|
+
logger = ZTK::Logger.new(%(/tmp/tl-knife.log))
|
31
|
+
|
32
|
+
ui = ZTK::UI.new(:logger => logger) # ui interface class
|
33
|
+
l = TestLab.new(:ui => ui) # lab
|
34
|
+
l.boot # boot lab
|
35
|
+
chef_server = l.containers.find('chef-server').first
|
36
|
+
|
37
|
+
verbose_flags = %w(-V --verbose)
|
38
|
+
verbose = ARGV.any?{ |arg| verbose_flags.include?(arg) }
|
39
|
+
user = ENV['USER']
|
40
|
+
key = File.join(l.config_dir, "#{chef_server.primary_user.username}.pem")
|
41
|
+
knife_rb = File.join(l.config_dir, "knife.rb")
|
42
|
+
|
43
|
+
argv = ARGV.collect{ |arg| arg.gsub(REGEX_ESCAPES) { |match| "#{REGEX_ESCAPES_PREFIX}#{match}"} }
|
44
|
+
|
45
|
+
arguments = Array.new
|
46
|
+
arguments << %(/usr/bin/env knife)
|
47
|
+
arguments << [argv]
|
48
|
+
arguments << %(--user #{chef_server.primary_user.username})
|
49
|
+
arguments << %(--key #{key})
|
50
|
+
arguments << %(--server-url http://#{chef_server.ip}:4000)
|
51
|
+
arguments << %(--config #{knife_rb})
|
52
|
+
arguments = arguments.flatten.compact.join(' ')
|
53
|
+
|
54
|
+
if verbose
|
55
|
+
puts("-" * 80)
|
56
|
+
puts(arguments)
|
57
|
+
puts("-" * 80)
|
58
|
+
end
|
59
|
+
|
60
|
+
command = ZTK::Command.new(:ui => ui, :replace_current_process => true)
|
61
|
+
command.exec(arguments)
|
data/lib/testlab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -209,6 +209,7 @@ email:
|
|
209
209
|
executables:
|
210
210
|
- tl
|
211
211
|
- tl-console
|
212
|
+
- tl-knife
|
212
213
|
extensions: []
|
213
214
|
extra_rdoc_files: []
|
214
215
|
files:
|
@@ -224,6 +225,7 @@ files:
|
|
224
225
|
- Rakefile
|
225
226
|
- bin/tl
|
226
227
|
- bin/tl-console
|
228
|
+
- bin/tl-knife
|
227
229
|
- features/step_definitions/container_steps.rb
|
228
230
|
- features/step_definitions/network_steps.rb
|
229
231
|
- features/step_definitions/node_steps.rb
|
@@ -338,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
338
340
|
version: '0'
|
339
341
|
segments:
|
340
342
|
- 0
|
341
|
-
hash:
|
343
|
+
hash: -2474252664721327804
|
342
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
345
|
none: false
|
344
346
|
requirements:
|
@@ -347,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
347
349
|
version: '0'
|
348
350
|
segments:
|
349
351
|
- 0
|
350
|
-
hash:
|
352
|
+
hash: -2474252664721327804
|
351
353
|
requirements: []
|
352
354
|
rubyforge_project:
|
353
355
|
rubygems_version: 1.8.25
|