dtk-client 0.5.14 → 0.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/commands/common/thor/assembly_workspace.rb +95 -0
- data/lib/commands/common/thor/common.rb +7 -4
- data/lib/commands/common/thor/edit.rb +1 -1
- data/lib/commands/common/thor/inventory_parser.rb +78 -0
- data/lib/commands/common/thor/pull_from_remote.rb +14 -10
- data/lib/commands/common/thor/push_to_remote.rb +0 -21
- data/lib/commands/thor/account.rb +2 -2
- data/lib/commands/thor/component_module.rb +45 -42
- data/lib/commands/thor/library.rb +2 -1
- data/lib/commands/thor/provider.rb +42 -36
- data/lib/commands/thor/service.rb +39 -30
- data/lib/commands/thor/service_module.rb +59 -60
- data/lib/commands/thor/target.rb +85 -15
- data/lib/commands/thor/workspace.rb +1 -1
- data/lib/config/disk_cacher.rb +4 -1
- data/lib/configurator.rb +1 -8
- data/lib/core.rb +4 -2
- data/lib/domain/response.rb +13 -2
- data/lib/dtk-client/version.rb +1 -1
- data/lib/dtk_logger.rb +4 -4
- data/lib/shell/context.rb +96 -77
- data/lib/shell/help_monkey_patch.rb +19 -17
- data/lib/util/os_util.rb +12 -12
- data/lib/util/remote_dependency_util.rb +36 -0
- data/lib/util/ssh_util.rb +2 -1
- data/spec/component_module_spec.rb +34 -0
- data/spec/dtk_spec.rb +1 -1
- data/spec/node_template_spec.rb +0 -1
- data/spec/service_module_spec.rb +38 -0
- data/spec/service_spec.rb +20 -11
- metadata +12 -16
- data/spec/assembly_spec.rb +0 -50
- data/spec/assembly_template_spec.rb +0 -51
- data/spec/component_template_spec.rb +0 -40
- data/spec/module_spec.rb +0 -35
- data/spec/node_spec.rb +0 -43
data/lib/util/os_util.rb
CHANGED
@@ -28,7 +28,6 @@ module DTK
|
|
28
28
|
is_windows? ? genv(:temp) : '/tmp'
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
31
|
def pop_readline_history(number_of_last_commands)
|
33
32
|
number_of_last_commands.downto(1) do
|
34
33
|
Readline::HISTORY.pop
|
@@ -98,13 +97,13 @@ module DTK
|
|
98
97
|
|
99
98
|
system("#{editor} #{file}")
|
100
99
|
end
|
101
|
-
|
100
|
+
|
102
101
|
def module_location(module_type,module_name,version=nil,opts={})
|
103
|
-
#compact used because module_name can be nil
|
102
|
+
# compact used because module_name can be nil
|
104
103
|
module_location_parts(module_type,module_name,version,opts).compact.join('/')
|
105
104
|
end
|
106
|
-
|
107
|
-
#if module location is /a/b/d/mod it returns ['/a/b/d','mod']
|
105
|
+
|
106
|
+
# if module location is /a/b/d/mod it returns ['/a/b/d','mod']
|
108
107
|
def module_location_parts(module_type,module_name,version=nil,opts={})
|
109
108
|
base_path = clone_base_path(opts[:assembly_module] ? :assembly_module : module_type)
|
110
109
|
if assembly_module = opts[:assembly_module]
|
@@ -141,7 +140,7 @@ module DTK
|
|
141
140
|
|
142
141
|
def clone_base_path(module_type)
|
143
142
|
|
144
|
-
path =
|
143
|
+
path =
|
145
144
|
case module_type
|
146
145
|
when :service_module then Config[:service_location]
|
147
146
|
when :component_module then Config[:module_location]
|
@@ -174,12 +173,12 @@ module DTK
|
|
174
173
|
component_module_dir = module_clone_location()
|
175
174
|
Dir.entries(component_module_dir).select {|entry| File.directory? File.join(component_module_dir,entry) and !(entry =='.' || entry == '..') }
|
176
175
|
end
|
177
|
-
|
176
|
+
|
178
177
|
# Public method will convert given string, to string with colorize output
|
179
178
|
#
|
180
179
|
# message - String to be colorized
|
181
180
|
# color - Symbol describing color to be used
|
182
|
-
#
|
181
|
+
#
|
183
182
|
# Returns String with colorize output
|
184
183
|
def colorize(message, color)
|
185
184
|
# at the moment we do not support colors in windows
|
@@ -200,15 +199,15 @@ module DTK
|
|
200
199
|
#
|
201
200
|
# Example
|
202
201
|
# suspend_output do
|
203
|
-
# # some calls
|
202
|
+
# # some calls
|
204
203
|
# end
|
205
204
|
def suspend_output
|
206
205
|
if is_windows?
|
207
206
|
retval = yield
|
208
207
|
else
|
208
|
+
orig_stderr = $stderr.clone
|
209
|
+
orig_stdout = $stdout.clone
|
209
210
|
begin
|
210
|
-
orig_stderr = $stderr.clone
|
211
|
-
orig_stdout = $stdout.clone
|
212
211
|
$stderr.reopen File.new('/dev/null', 'w')
|
213
212
|
$stdout.reopen File.new('/dev/null', 'w')
|
214
213
|
retval = yield
|
@@ -239,6 +238,7 @@ module DTK
|
|
239
238
|
suspend_output do
|
240
239
|
load File.expand_path('../../lib/util/os_util.rb', File.dirname(__FILE__))
|
241
240
|
load File.expand_path('../../lib/util/ssh_util.rb', File.dirname(__FILE__))
|
241
|
+
load File.expand_path('../../lib/util/remote_dependency_util.rb', File.dirname(__FILE__))
|
242
242
|
load File.expand_path('../../lib/shell/help_monkey_patch.rb', File.dirname(__FILE__))
|
243
243
|
load File.expand_path('../../lib/shell/domain.rb', File.dirname(__FILE__))
|
244
244
|
load File.expand_path('../../lib/domain/git_adapter.rb', File.dirname(__FILE__))
|
@@ -291,7 +291,7 @@ module DTK
|
|
291
291
|
end
|
292
292
|
|
293
293
|
private
|
294
|
-
|
294
|
+
|
295
295
|
def seperator
|
296
296
|
return (is_windows? ? "\\" : "/")
|
297
297
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Managment of remote dependencies detection (print warning) or providing data from local resources
|
3
|
+
#
|
4
|
+
module DTK
|
5
|
+
module Client
|
6
|
+
module RemoteDependencyUtil
|
7
|
+
|
8
|
+
MODULE_REF_FILE = 'module_refs.yaml'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
def print_dependency_warnings(response, success_msg=nil)
|
13
|
+
return if response.nil? || response.data.nil?
|
14
|
+
warnings = response.data['dependency_warnings']
|
15
|
+
if warnings && !warnings.empty?
|
16
|
+
print_out "Following warnings have been detected for current module by Repo Manager:\n"
|
17
|
+
warnings.each { |w| print_out(" - #{w}") }
|
18
|
+
puts
|
19
|
+
end
|
20
|
+
print_out success_msg, :green if success_msg
|
21
|
+
end
|
22
|
+
|
23
|
+
def module_ref_content(location)
|
24
|
+
abs_location = File.join(location, MODULE_REF_FILE)
|
25
|
+
File.exists?(abs_location) ? File.read(abs_location) : nil
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def print_out(message, color=:yellow)
|
31
|
+
DTK::Client::OsUtil.print(message, color)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/util/ssh_util.rb
CHANGED
@@ -48,7 +48,7 @@ module DTK
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def self.ssh_base_dir()
|
51
|
-
"#{
|
51
|
+
"#{OsUtil.dtk_home_dir}/.ssh"
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.ssh_known_hosts_path()
|
@@ -66,6 +66,7 @@ module DTK
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def self.is_ssh_key_content_valid?(rsa_pub_key)
|
69
|
+
# checking know ssh rsa pub key content
|
69
70
|
if(rsa_pub_key.empty? || !rsa_pub_key.include?("AAAAB3NzaC1yc2EA"))
|
70
71
|
raise DtkError, "[ERROR] SSH public key (#{path_to_key}) does not have valid content. Please check your key and try again."
|
71
72
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/component_module', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::ComponentModule do
|
8
|
+
$component_module_id = nil
|
9
|
+
|
10
|
+
context '#list' do
|
11
|
+
$component_module_list = run_from_dtk_shell('component-module list')
|
12
|
+
|
13
|
+
it "should have component module listing" do
|
14
|
+
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
15
|
+
end
|
16
|
+
|
17
|
+
unless $component_module_list.nil?
|
18
|
+
unless $component_module_list['data'].nil?
|
19
|
+
$component_module_id = $component_module_list['data'].first['id'] unless $component_module_list['data'].empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "#list/command" do
|
25
|
+
unless $component_module_id.nil?
|
26
|
+
output = run_from_dtk_shell("component-module #{$component_module_id} list-components")
|
27
|
+
|
28
|
+
it "should list all components for component module with id #{$component_module_id}" do
|
29
|
+
$component_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/spec/dtk_spec.rb
CHANGED
data/spec/node_template_spec.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'lib/spec_thor'
|
2
|
+
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
+
require File.expand_path('../lib/commands/thor/service_module', File.dirname(__FILE__))
|
4
|
+
|
5
|
+
include SpecThor
|
6
|
+
|
7
|
+
describe DTK::Client::ServiceModule do
|
8
|
+
$about = ['assemblies']
|
9
|
+
$service_module_id = nil
|
10
|
+
|
11
|
+
context '#list' do
|
12
|
+
$service_module_list = run_from_dtk_shell('service-module list')
|
13
|
+
|
14
|
+
it "should have service modules listing" do
|
15
|
+
$service_module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
16
|
+
end
|
17
|
+
|
18
|
+
unless $service_module_list.nil?
|
19
|
+
unless $service_module_list['data'].nil?
|
20
|
+
$service_module_id = $service_module_list['data'].first['id'] unless $service_module_list['data'].empty?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "#list/command" do
|
26
|
+
unless $service_module_id.nil?
|
27
|
+
$about.each do |type|
|
28
|
+
output = run_from_dtk_shell("service-module #{$service_module_id} list #{type}")
|
29
|
+
|
30
|
+
it "should list all #{type} for service module with id #{$service_module_id}" do
|
31
|
+
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
data/spec/service_spec.rb
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
require 'lib/spec_thor'
|
2
2
|
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/
|
3
|
+
require File.expand_path('../lib/commands/thor/assembly', File.dirname(__FILE__))
|
4
4
|
|
5
5
|
include SpecThor
|
6
6
|
|
7
|
-
describe DTK::Client::
|
8
|
-
$about = ['
|
7
|
+
describe DTK::Client::Assembly do
|
8
|
+
$about = ['nodes', 'components', 'attributes','tasks']
|
9
9
|
$service_id = nil
|
10
10
|
|
11
|
-
|
12
|
-
#list
|
13
|
-
|
14
|
-
$service_list = run_from_dtk_shell('service-module list')
|
11
|
+
#list all services and take one service_id
|
12
|
+
context "#list" do
|
13
|
+
$service_list = run_from_dtk_shell('service list')
|
15
14
|
|
16
15
|
it "should have service listing" do
|
17
16
|
$service_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
18
17
|
end
|
19
|
-
|
18
|
+
|
20
19
|
unless $service_list.nil?
|
21
20
|
unless $service_list['data'].nil?
|
22
21
|
$service_id = $service_list['data'].first['id'] unless $service_list['data'].empty?
|
@@ -24,11 +23,11 @@ describe DTK::Client::ServiceModule do
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
|
26
|
+
# for previously taken service_id, do list nodes|components|tasks
|
28
27
|
context "#list/command" do
|
29
28
|
unless $service_id.nil?
|
30
29
|
$about.each do |type|
|
31
|
-
output = run_from_dtk_shell("service
|
30
|
+
output = run_from_dtk_shell("service #{$service_id} list #{type}")
|
32
31
|
|
33
32
|
it "should list all #{type} for service with id #{$service_id}" do
|
34
33
|
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
@@ -37,5 +36,15 @@ describe DTK::Client::ServiceModule do
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
# for previously taken service_id, do info
|
40
|
+
context "#info" do
|
41
|
+
unless $service_id.nil?
|
42
|
+
output = run_from_dtk_shell("service #{$service_id} info")
|
41
43
|
|
44
|
+
it "should show information about service with id #{$service_id}" do
|
45
|
+
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich PELAVIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.2.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.2.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/commands/common/thor/clone.rb
|
211
211
|
- lib/commands/common/thor/common.rb
|
212
212
|
- lib/commands/common/thor/edit.rb
|
213
|
+
- lib/commands/common/thor/inventory_parser.rb
|
213
214
|
- lib/commands/common/thor/list_diffs.rb
|
214
215
|
- lib/commands/common/thor/pull_clone_changes.rb
|
215
216
|
- lib/commands/common/thor/pull_from_remote.rb
|
@@ -277,6 +278,7 @@ files:
|
|
277
278
|
- lib/util/dtk_puppet.rb
|
278
279
|
- lib/util/os_util.rb
|
279
280
|
- lib/util/permission_util.rb
|
281
|
+
- lib/util/remote_dependency_util.rb
|
280
282
|
- lib/util/ssh_util.rb
|
281
283
|
- lib/view_processor.rb
|
282
284
|
- lib/view_processor/augmented_simple_list.rb
|
@@ -289,20 +291,17 @@ files:
|
|
289
291
|
- puppet/templates/bash_profile.erb
|
290
292
|
- puppet/templates/client.conf.erb
|
291
293
|
- puppet/templates/dtkclient.erb
|
292
|
-
- spec/
|
293
|
-
- spec/assembly_template_spec.rb
|
294
|
-
- spec/component_template_spec.rb
|
294
|
+
- spec/component_module_spec.rb
|
295
295
|
- spec/dependency_spec.rb
|
296
296
|
- spec/dtk_shell_spec.rb
|
297
297
|
- spec/dtk_spec.rb
|
298
298
|
- spec/lib/spec_helper.rb
|
299
299
|
- spec/lib/spec_thor.rb
|
300
|
-
- spec/module_spec.rb
|
301
|
-
- spec/node_spec.rb
|
302
300
|
- spec/node_template_spec.rb
|
303
301
|
- spec/project_spec.rb
|
304
302
|
- spec/repo_spec.rb
|
305
303
|
- spec/response_spec.rb
|
304
|
+
- spec/service_module_spec.rb
|
306
305
|
- spec/service_spec.rb
|
307
306
|
- spec/state_change_spec.rb
|
308
307
|
- spec/table_print_spec.rb
|
@@ -321,12 +320,12 @@ require_paths:
|
|
321
320
|
- lib
|
322
321
|
required_ruby_version: !ruby/object:Gem::Requirement
|
323
322
|
requirements:
|
324
|
-
- -
|
323
|
+
- - '>='
|
325
324
|
- !ruby/object:Gem::Version
|
326
325
|
version: '0'
|
327
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
328
327
|
requirements:
|
329
|
-
- -
|
328
|
+
- - '>='
|
330
329
|
- !ruby/object:Gem::Version
|
331
330
|
version: '0'
|
332
331
|
requirements: []
|
@@ -336,20 +335,17 @@ signing_key:
|
|
336
335
|
specification_version: 4
|
337
336
|
summary: DTK CLI client for DTK server interaction.
|
338
337
|
test_files:
|
339
|
-
- spec/
|
340
|
-
- spec/assembly_template_spec.rb
|
341
|
-
- spec/component_template_spec.rb
|
338
|
+
- spec/component_module_spec.rb
|
342
339
|
- spec/dependency_spec.rb
|
343
340
|
- spec/dtk_shell_spec.rb
|
344
341
|
- spec/dtk_spec.rb
|
345
342
|
- spec/lib/spec_helper.rb
|
346
343
|
- spec/lib/spec_thor.rb
|
347
|
-
- spec/module_spec.rb
|
348
|
-
- spec/node_spec.rb
|
349
344
|
- spec/node_template_spec.rb
|
350
345
|
- spec/project_spec.rb
|
351
346
|
- spec/repo_spec.rb
|
352
347
|
- spec/response_spec.rb
|
348
|
+
- spec/service_module_spec.rb
|
353
349
|
- spec/service_spec.rb
|
354
350
|
- spec/state_change_spec.rb
|
355
351
|
- spec/table_print_spec.rb
|
data/spec/assembly_spec.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/assembly', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
describe DTK::Client::Assembly do
|
8
|
-
$about = ['nodes', 'components', 'attributes','tasks']
|
9
|
-
$assembly_id = nil
|
10
|
-
|
11
|
-
#list all assemblies and take one assembly_id
|
12
|
-
context "#list" do
|
13
|
-
$assembly_list = run_from_dtk_shell('service list')
|
14
|
-
|
15
|
-
it "should have assembly listing" do
|
16
|
-
$assembly_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
17
|
-
end
|
18
|
-
|
19
|
-
unless $assembly_list.nil?
|
20
|
-
unless $assembly_list['data'].nil?
|
21
|
-
$assembly_id = $assembly_list['data'].first['id'] unless $assembly_list['data'].empty?
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# for previously taken assembly_id, do list nodes|components|tasks
|
27
|
-
context "#list/command" do
|
28
|
-
unless $assembly_id.nil?
|
29
|
-
$about.each do |type|
|
30
|
-
output = run_from_dtk_shell("service #{$assembly_id} list #{type}")
|
31
|
-
|
32
|
-
it "should list all #{type} for assembly with id #{$assembly_id}" do
|
33
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# for previously taken assembly_id, do info
|
40
|
-
context "#info" do
|
41
|
-
unless $assembly_id.nil?
|
42
|
-
output = run_from_dtk_shell("service #{$assembly_id} info")
|
43
|
-
|
44
|
-
it "should show information about assembly with id #{$assembly_id}" do
|
45
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/assembly', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
#Currently disabled because this context does not exist anymore
|
8
|
-
=begin
|
9
|
-
describe DTK::Client::AssemblyTemplate do
|
10
|
-
$about = ['nodes', 'components']
|
11
|
-
$assembly_template_id = nil
|
12
|
-
|
13
|
-
context '#list' do
|
14
|
-
$assembly_template_list = run_from_dtk_shell('assembly-template list')
|
15
|
-
|
16
|
-
it "should have assembly-template listing" do
|
17
|
-
$assembly_template_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id|Missing)/)
|
18
|
-
end
|
19
|
-
|
20
|
-
unless $assembly_template_list.nil?
|
21
|
-
unless $assembly_template_list['data'].nil?
|
22
|
-
puts $assembly_template_list['data']
|
23
|
-
$assembly_template_id = $assembly_template_list['data'].first['id'] unless $assembly_template_list['data'].empty?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "#list/command" do
|
29
|
-
unless $assembly_template_id.nil?
|
30
|
-
$about.each do |type|
|
31
|
-
output = run_from_dtk_shell("assembly-template #{$assembly_template_id} list #{type}")
|
32
|
-
|
33
|
-
it "should list all #{type} for assembly-template with id #{$assembly_template_id}" do
|
34
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "#info" do
|
41
|
-
unless $assembly_template_id.nil?
|
42
|
-
output = run_from_dtk_shell("assembly-template #{$assembly_template_id} info")
|
43
|
-
|
44
|
-
it "should show information about assembly-template with id #{$assembly_template_id}" do
|
45
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
=end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/component_template', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
#Currently disabled because this context does not exist anymore
|
8
|
-
=begin
|
9
|
-
describe DTK::Client::ComponentTemplate do
|
10
|
-
$about = ['none', 'nodes']
|
11
|
-
$component_template_id = nil
|
12
|
-
|
13
|
-
context '#list' do
|
14
|
-
$component_template_list = run_from_dtk_shell('component-template list')
|
15
|
-
|
16
|
-
it "should have assembly listing" do
|
17
|
-
$component_template_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
18
|
-
end
|
19
|
-
|
20
|
-
unless $component_template_list.nil?
|
21
|
-
unless $component_template_list['data'].nil?
|
22
|
-
$component_template_id = $component_template_list['data'].first['id'] unless $component_template_list['data'].empty?
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "#list/command" do
|
28
|
-
unless $component_template_id.nil?
|
29
|
-
$about.each do |type|
|
30
|
-
output = run_from_dtk_shell("component-template #{$component_template_id} list #{type}")
|
31
|
-
|
32
|
-
it "should list all #{type} for component-template with id #{$component_template_id}" do
|
33
|
-
output.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
=end
|
data/spec/module_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/component_module', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
describe DTK::Client::ComponentModule do
|
8
|
-
$module_id = nil
|
9
|
-
|
10
|
-
#list all assemblies and take one assembly_id
|
11
|
-
context '#list' do
|
12
|
-
$module_list = run_from_dtk_shell('component-module list')
|
13
|
-
|
14
|
-
it "should have module listing" do
|
15
|
-
$module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
16
|
-
end
|
17
|
-
|
18
|
-
unless $module_list.nil?
|
19
|
-
unless $module_list['data'].nil?
|
20
|
-
$module_id = $module_list['data'].first['id'] unless $module_list['data'].empty?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "#list/command" do
|
26
|
-
unless $module_id.nil?
|
27
|
-
output = run_from_dtk_shell("component-module #{$module_id} list-components")
|
28
|
-
|
29
|
-
it "should list all components for module with id #{$module_id}" do
|
30
|
-
$module_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
data/spec/node_spec.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'lib/spec_thor'
|
2
|
-
require File.expand_path('../lib/require_first', File.dirname(__FILE__))
|
3
|
-
require File.expand_path('../lib/commands/thor/node', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
include SpecThor
|
6
|
-
|
7
|
-
#Currently disabled because this context does not exist anymore
|
8
|
-
=begin
|
9
|
-
describe DTK::Client::Node do
|
10
|
-
$about = ['components', 'attributes']
|
11
|
-
$node_id = nil
|
12
|
-
|
13
|
-
#list all assemblies and take one assembly_id
|
14
|
-
context '#list' do
|
15
|
-
$node_list = run_from_dtk_shell('node list')
|
16
|
-
|
17
|
-
it "should list all nodes" do
|
18
|
-
$node_list.to_s.should match(/(ok|status|empty|INFO|WARNING|name|id)/)
|
19
|
-
end
|
20
|
-
|
21
|
-
unless $node_list.nil?
|
22
|
-
unless $node_list['data'].nil?
|
23
|
-
$node_id = $node_list['data'].first['id'] unless $node_list['data'].empty?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#current dtk-client code for this test is not implemented
|
29
|
-
|
30
|
-
# context "#list/command" do
|
31
|
-
# unless $node_id.nil?
|
32
|
-
# $about.each do |type|
|
33
|
-
# output = run_from_dtk_shell("node #{$node_id} list #{type}")
|
34
|
-
|
35
|
-
# it "should list all #{type} for node with id #{$node_id}" do
|
36
|
-
# output.to_s.should match(/(ok|status|id|name|empty|error|WARNING)/)
|
37
|
-
# end
|
38
|
-
# end
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
end
|
43
|
-
=end
|