dtk-client 0.7.2.1 → 0.7.3
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/dtk-client.gemspec +2 -2
- data/lib/command_helpers/git_repo.rb +26 -12
- data/lib/commands/common/thor/assembly_workspace.rb +55 -0
- data/lib/commands/common/thor/common_base.rb +32 -0
- data/lib/commands/common/thor/create_target.rb +50 -0
- data/lib/commands/common/thor/edit.rb +1 -1
- data/lib/commands/common/thor/module/import.rb +1 -1
- data/lib/commands/common/thor/module.rb +37 -13
- data/lib/commands/common/thor/pull_from_remote.rb +2 -2
- data/lib/commands/common/thor/puppet_forge.rb +1 -1
- data/lib/commands/common/thor/push_clone_changes.rb +2 -0
- data/lib/commands/common/thor/push_to_remote.rb +35 -0
- data/lib/commands/thor/account.rb +3 -3
- data/lib/commands/thor/component_module.rb +9 -5
- data/lib/commands/thor/provider.rb +41 -48
- data/lib/commands/thor/service.rb +12 -0
- data/lib/commands/thor/service_module.rb +13 -4
- data/lib/commands/thor/target.rb +45 -45
- data/lib/commands/thor/test_module.rb +12 -6
- data/lib/commands/thor/workspace.rb +12 -0
- data/lib/core.rb +1 -1
- data/lib/domain/git_adapter.rb +4 -0
- data/lib/domain/response.rb +0 -8
- data/lib/dtk-client/version.rb +1 -1
- data/lib/execute/script/add_tenant.rb +26 -13
- data/lib/execute/script.rb +0 -2
- data/lib/shell/context.rb +14 -0
- data/lib/shell/domain/context_params.rb +1 -2
- data/lib/util/console.rb +19 -0
- data/lib/util/module_util.rb +4 -0
- data/lib/util/os_util.rb +4 -0
- metadata +10 -9
- data/lib/execute/script/add_tenant_without_router.rb +0 -87
@@ -17,7 +17,7 @@ module DTK::Client
|
|
17
17
|
return DTK::Shell::OverrideTasks.new({
|
18
18
|
:command_only => {
|
19
19
|
:target => [
|
20
|
-
['delete-
|
20
|
+
['delete-and-destroy',"delete-and-destroy TARGET-NAME","# Deletes target"],
|
21
21
|
['list',"list","# Lists available targets."]
|
22
22
|
|
23
23
|
]
|
@@ -32,32 +32,35 @@ module DTK::Client
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.valid_child?(name_of_sub_context)
|
35
|
-
|
35
|
+
Provider.valid_children().include?(name_of_sub_context.to_sym)
|
36
36
|
end
|
37
37
|
|
38
|
-
desc "create-ec2
|
38
|
+
desc "create-provider-ec2 PROVIDER-NAME [--keypair KEYPAIR] [--security-group SECURITY-GROUP(S)]", "Create provider for ec2 vpc or classic. Multiple security groups separated with ',' (gr1,gr2,gr3,...)"
|
39
39
|
method_option :keypair, :type => :string
|
40
40
|
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
41
|
+
# TODO: made this a hidden option; needs to be updated because now choice if vpc or classic
|
41
42
|
method_option :bootstrap, :type => :boolean, :default => false
|
42
|
-
def
|
43
|
+
def create_provider_ec2(context_params)
|
43
44
|
provider_name = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
44
45
|
provider_type = 'ec2'
|
45
46
|
|
46
47
|
iaas_properties = Hash.new
|
47
|
-
#TODO: data-driven check if legal provider type and then what options needed depending on provider type
|
48
48
|
|
49
|
-
|
50
|
-
keypair, security_group = context_params.retrieve_thor_options([:keypair!, :security_group!], options)
|
49
|
+
keypair, security_group = context_params.retrieve_thor_options([:keypair, :security_group], options)
|
51
50
|
|
52
|
-
|
51
|
+
iaas_properties.merge!(:keypair => keypair) if keypair
|
52
|
+
if security_group
|
53
|
+
if security_group.end_with?(',')
|
54
|
+
raise ::DTK::Client::DtkValidationError.new("Multiple security groups should be separated with ',' and without spaces between them (e.g. --security_groups gr1,gr2,gr3,...) ")
|
55
|
+
end
|
53
56
|
|
54
|
-
|
55
|
-
iaas_properties.merge!(:keypair_name => keypair)
|
57
|
+
security_groups = security_group.split(',')
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
if (security_groups.empty? || security_groups.size==1)
|
60
|
+
iaas_properties.merge!(:security_group => security_group)
|
61
|
+
else
|
62
|
+
iaas_properties.merge!(:security_group_set => security_groups)
|
63
|
+
end
|
61
64
|
end
|
62
65
|
|
63
66
|
result = DTK::Shell::InteractiveWizard::interactive_user_input(
|
@@ -73,40 +76,37 @@ module DTK::Client
|
|
73
76
|
|
74
77
|
post_body = {
|
75
78
|
:iaas_properties => iaas_properties,
|
76
|
-
:provider_name
|
77
|
-
:iaas_type
|
78
|
-
:no_bootstrap
|
79
|
+
:provider_name => provider_name,
|
80
|
+
:iaas_type => 'ec2',
|
81
|
+
:no_bootstrap => ! options.bootstrap?
|
79
82
|
}
|
80
83
|
|
81
84
|
response = post rest_url("target/create_provider"), post_body
|
82
85
|
@@invalidate_map << :provider
|
83
86
|
|
84
|
-
|
87
|
+
response
|
85
88
|
end
|
86
89
|
|
87
|
-
desc "create-physical
|
88
|
-
|
89
|
-
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
90
|
-
method_option :bootstrap, :type => :boolean, :default => false
|
91
|
-
def create_physical_provider(context_params)
|
90
|
+
desc "create-provider-physical PROVIDER-NAME", "Create provider to manage physical nodes."
|
91
|
+
def create_provider_physical(context_params)
|
92
92
|
provider_name = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
93
|
-
provider_type = 'physical'
|
94
93
|
|
95
94
|
# Remove sensitive readline history
|
96
95
|
OsUtil.pop_readline_history(2)
|
97
96
|
|
98
97
|
post_body = {
|
99
98
|
:provider_name => provider_name,
|
100
|
-
:iaas_type =>
|
101
|
-
:no_bootstrap => ! options.bootstrap?
|
99
|
+
:iaas_type => 'physical'
|
102
100
|
}
|
103
101
|
|
104
102
|
response = post rest_url("target/create_provider"), post_body
|
105
103
|
@@invalidate_map << :provider
|
106
104
|
|
107
|
-
|
105
|
+
response
|
108
106
|
end
|
109
107
|
|
108
|
+
=begin
|
109
|
+
TODO: deprecated until this can be in sync with create-targets from target context where params depend on type
|
110
110
|
|
111
111
|
desc "PROVIDER-ID/NAME create-target [TARGET-NAME] --region REGION --keypair KEYPAIR --security-group SECURITY-GROUP(S)", "Create target based on given provider"
|
112
112
|
method_option :region, :type => :string
|
@@ -142,9 +142,9 @@ module DTK::Client
|
|
142
142
|
response = post rest_url("target/create"), post_body
|
143
143
|
@@invalidate_map << :target
|
144
144
|
|
145
|
-
|
145
|
+
response
|
146
146
|
end
|
147
|
-
|
147
|
+
=end
|
148
148
|
|
149
149
|
desc "list","Lists available providers."
|
150
150
|
def list(context_params)
|
@@ -173,33 +173,26 @@ module DTK::Client
|
|
173
173
|
response.render_table(:target)
|
174
174
|
end
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
# desc "set-default-target TARGET-NAME/ID","Sets the default target."
|
179
|
-
# def set_default_target(context_params)
|
180
|
-
# target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
181
|
-
# post rest_url("target/set_default"), { :target_id => target_id }
|
182
|
-
# end
|
183
|
-
|
184
|
-
desc "delete-provider PROVIDER-IDENTIFIER [-y]","Deletes targets provider"
|
185
|
-
method_option :force, :aliases => '-y', :type => :boolean, :default => false
|
186
|
-
def delete_provider(context_params)
|
176
|
+
desc "delete-and-destroy PROVIDER-NAME","Deletes target provider, its targets, and their assemblies"
|
177
|
+
def delete_and_destroy(context_params)
|
187
178
|
provider_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
188
179
|
|
189
|
-
|
190
|
-
|
191
|
-
end
|
192
|
-
|
193
|
-
# this goes to provider
|
194
|
-
# Console.confirmation_prompt("Are you sure you want to delete target '#{target_id}' (all assemblies that belong to this target will be deleted as well)'"+'?')
|
180
|
+
# require explicit acknowldegement since deletes all targtes under it
|
181
|
+
return unless Console.confirmation_prompt("Are you sure you want to delete provider '#{provider_id}' and all target and service instances under it" +'?')
|
195
182
|
|
196
183
|
post_body = {
|
197
|
-
:
|
184
|
+
:target_id => provider_id,
|
185
|
+
:type => 'template'
|
198
186
|
}
|
199
187
|
|
200
188
|
@@invalidate_map << :provider
|
201
189
|
|
202
|
-
post
|
190
|
+
response = post(rest_url("target/delete_and_destroy"),post_body)
|
191
|
+
return response unless response.ok?
|
192
|
+
if info_array = response.data['info']
|
193
|
+
info_array.each{|info_msg|OsUtil.print(info_msg, :yellow)}
|
194
|
+
end
|
195
|
+
Response::Ok.new()
|
203
196
|
end
|
204
197
|
|
205
198
|
no_tasks do
|
@@ -94,6 +94,11 @@ module DTK::Client
|
|
94
94
|
:delete_node_group => {
|
95
95
|
:endpoint => "assembly",
|
96
96
|
:url => "assembly/get_node_groups"
|
97
|
+
},
|
98
|
+
:pull_base_component_module => {
|
99
|
+
:endpoint => "assembly",
|
100
|
+
:url => "assembly/info_about",
|
101
|
+
:opts => {:subtype=>"instance", :about=>"modules"}
|
97
102
|
}
|
98
103
|
}
|
99
104
|
}
|
@@ -271,6 +276,13 @@ module DTK::Client
|
|
271
276
|
Response::Ok.new()
|
272
277
|
end
|
273
278
|
|
279
|
+
desc "SERVICE-NAME/ID pull-base-component-module COMPONENT-MODULE-NAME [--force] [--revert]", "Pull base component module changes to component module in the service"
|
280
|
+
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
281
|
+
method_option :revert, :type => :boolean, :default => false, :aliases => '-r'
|
282
|
+
def pull_base_component_module(context_params)
|
283
|
+
pull_base_component_module_aux(context_params)
|
284
|
+
end
|
285
|
+
|
274
286
|
desc "SERVICE-NAME/ID push-component-module-updates COMPONENT-MODULE-NAME [--force]", "Push changes made to a component module in the service to its base component module."
|
275
287
|
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
276
288
|
def push_component_module_updates(context_params)
|
@@ -293,11 +293,15 @@ module DTK::Client
|
|
293
293
|
# end
|
294
294
|
|
295
295
|
# desc "SERVICE-MODULE-NAME/ID pull-from-dtkn [-n NAMESPACE] [-v VERSION]", "Update local service module from remote repository."
|
296
|
-
desc "SERVICE-MODULE-NAME/ID pull-dtkn [-n NAMESPACE]", "Update local service module from remote repository."
|
297
|
-
method_option
|
298
|
-
:type
|
296
|
+
desc "SERVICE-MODULE-NAME/ID pull-dtkn [-n NAMESPACE] [--force]", "Update local service module from remote repository."
|
297
|
+
method_option :namespace,:aliases => '-n',
|
298
|
+
:type => :string,
|
299
299
|
:banner => "NAMESPACE",
|
300
|
-
:desc
|
300
|
+
:desc => "Remote namespace"
|
301
|
+
method_option :force,:aliases => '-f',
|
302
|
+
:type => :boolean,
|
303
|
+
:desc => "Force pull",
|
304
|
+
:default => false
|
301
305
|
def pull_dtkn(context_params)
|
302
306
|
pull_dtkn_aux(context_params)
|
303
307
|
end
|
@@ -605,6 +609,11 @@ module DTK::Client
|
|
605
609
|
remote_remove_aux(context_params)
|
606
610
|
end
|
607
611
|
|
612
|
+
desc "SERVICE-MODULE-NAME/ID fork NAMESPACE", "Fork service module to new namespace"
|
613
|
+
def fork(context_params)
|
614
|
+
fork_aux(context_params)
|
615
|
+
end
|
616
|
+
|
608
617
|
#
|
609
618
|
# DEVELOPMENT MODE METHODS
|
610
619
|
#
|
data/lib/commands/thor/target.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
dtk_require_common_commands('thor/common_base')
|
1
2
|
dtk_require_common_commands('thor/inventory_parser')
|
3
|
+
dtk_require_common_commands('thor/create_target')
|
2
4
|
module DTK::Client
|
3
5
|
class Target < CommandBaseThor
|
6
|
+
include Commands
|
4
7
|
include InventoryParserMixin
|
5
|
-
|
8
|
+
|
6
9
|
def self.pretty_print_cols()
|
7
10
|
PPColumns.get(:target)
|
8
11
|
end
|
@@ -31,8 +34,7 @@ module DTK::Client
|
|
31
34
|
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
32
35
|
|
33
36
|
post_body = {:target_id => target_id}
|
34
|
-
|
35
|
-
response.render_custom_info("target")
|
37
|
+
post rest_url('target/info'), post_body
|
36
38
|
end
|
37
39
|
|
38
40
|
desc "TARGET-NAME/ID import-nodes --source SOURCE","Reads from inventory dsl and populates the node instance objects (SOURCE: file:/path/to/file.yaml)."
|
@@ -42,12 +44,12 @@ module DTK::Client
|
|
42
44
|
source = context_params.retrieve_thor_options([:source!], options)
|
43
45
|
|
44
46
|
parsed_source = source.match(/^(\w+):(.+)/)
|
45
|
-
raise
|
47
|
+
raise DtkValidationError, "Invalid source! Valid source should contain source_type:source_path (e.g. --source file:path/to/file.yaml)." unless parsed_source
|
46
48
|
|
47
49
|
import_type = parsed_source[1]
|
48
50
|
path = parsed_source[2]
|
49
51
|
|
50
|
-
raise
|
52
|
+
raise DtkValidationError, "We do not support '#{import_type}' as import source at the moment. Valid sources: #{ValidImportTypes}" unless ValidImportTypes.include?(import_type)
|
51
53
|
|
52
54
|
post_body = {:target_id => target_id}
|
53
55
|
|
@@ -70,7 +72,7 @@ module DTK::Client
|
|
70
72
|
end
|
71
73
|
ValidImportTypes = ["file"]
|
72
74
|
|
73
|
-
desc "set-default-target TARGET-
|
75
|
+
desc "set-default-target TARGET-NAME","Sets the default target."
|
74
76
|
def set_default_target(context_params)
|
75
77
|
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
76
78
|
post rest_url("target/set_default"), { :target_id => target_id }
|
@@ -84,44 +86,32 @@ module DTK::Client
|
|
84
86
|
post rest_url("target/install_agents"), post_body
|
85
87
|
end
|
86
88
|
|
87
|
-
desc "create-target [TARGET-NAME] --provider PROVIDER --region REGION --keypair KEYPAIR --security-group SECURITY-GROUP(S)", "Create target based on given provider"
|
89
|
+
desc "create-target-ec2-classic [TARGET-NAME] --provider PROVIDER --region REGION [--keypair KEYPAIR] [--security-group SECURITY-GROUP(S)]", "Create target based on given provider"
|
88
90
|
method_option :provider, :type => :string
|
89
91
|
method_option :region, :type => :string
|
90
92
|
method_option :keypair, :type => :string
|
91
93
|
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
92
|
-
def
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
iaas_properties = Hash.new
|
99
|
-
DTK::Shell::InteractiveWizard.validate_region(region) if region
|
100
|
-
|
101
|
-
security_groups = []
|
102
|
-
raise ::DTK::Client::DtkValidationError.new("Multiple security groups should be separated with ',' and without spaces between them (e.g. --security_groups gr1,gr2,gr3,...) ") if security_group.end_with?(',')
|
103
|
-
|
104
|
-
security_groups = security_group.split(',')
|
105
|
-
iaas_properties.merge!(:keypair => keypair)
|
106
|
-
|
107
|
-
if (security_groups.empty? || security_groups.size==1)
|
108
|
-
iaas_properties.merge!(:security_group => security_group)
|
109
|
-
else
|
110
|
-
iaas_properties.merge!(:security_group_set => security_groups)
|
111
|
-
end
|
112
|
-
|
113
|
-
post_body = {
|
114
|
-
:provider_id => provider,
|
115
|
-
:iaas_properties => iaas_properties
|
116
|
-
}
|
117
|
-
post_body.merge!(:target_name => target_name) if target_name
|
118
|
-
post_body.merge!(:region => region) if region
|
119
|
-
response = post rest_url("target/create"), post_body
|
94
|
+
def create_target_ec2_classic(context_params)
|
95
|
+
option_list = [:provider!, :region!, :keypair, :security_group]
|
96
|
+
response = Common::CreateTarget.new(self,context_params).execute(:ec2_classic,option_list)
|
97
|
+
@@invalidate_map << :target
|
98
|
+
response
|
99
|
+
end
|
120
100
|
|
101
|
+
desc "create-target-ec2-vpc [TARGET-NAME] --provider PROVIDER --region REGION --subnet SUBNET-ID [--keypair KEYPAIR] [--security-group SECURITY-GROUP(S)]", "Create target based on given provider"
|
102
|
+
method_option :provider, :type => :string
|
103
|
+
method_option :subnet, :type => :string
|
104
|
+
method_option :region, :type => :string
|
105
|
+
method_option :keypair, :type => :string
|
106
|
+
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
107
|
+
def create_target_ec2_vpc(context_params)
|
108
|
+
option_list = [:provider!, :subnet!, :region!, :keypair, :security_group]
|
109
|
+
response = Common::CreateTarget.new(self,context_params).execute(:ec2_vpc,option_list)
|
121
110
|
@@invalidate_map << :target
|
122
|
-
|
111
|
+
response
|
123
112
|
end
|
124
113
|
|
114
|
+
|
125
115
|
desc "TARGET-NAME/ID list-services","Lists service instances in given targets."
|
126
116
|
def list_services(context_params)
|
127
117
|
context_params.method_arguments = ["assemblies"]
|
@@ -181,27 +171,36 @@ module DTK::Client
|
|
181
171
|
end
|
182
172
|
end
|
183
173
|
|
184
|
-
desc "delete-
|
185
|
-
|
186
|
-
|
187
|
-
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
174
|
+
desc "delete-and-destroy TARGET-NAME","Deletes target or provider"
|
175
|
+
def delete_and_destroy(context_params)
|
176
|
+
target_id = context_params.retrieve_arguments([:option_1!],method_argument_names)
|
188
177
|
|
189
178
|
# No -y options since risk is too great
|
190
179
|
return unless Console.confirmation_prompt("Are you sure you want to delete target '#{target_id}' (all assemblies/nodes that belong to this target will be deleted as well)'"+'?')
|
191
180
|
|
192
181
|
post_body = {
|
193
|
-
:target_id => target_id
|
182
|
+
:target_id => target_id,
|
183
|
+
:type => 'instance'
|
194
184
|
}
|
195
185
|
|
196
186
|
@@invalidate_map << :target
|
197
187
|
|
198
|
-
|
188
|
+
response = post(rest_url("target/delete_and_destroy"),post_body)
|
189
|
+
return response unless response.ok?
|
190
|
+
if info_array = response.data['info']
|
191
|
+
info_array.each{|info_msg|OsUtil.print(info_msg, :yellow)}
|
192
|
+
end
|
193
|
+
Response::Ok.new()
|
199
194
|
end
|
200
195
|
|
201
|
-
|
196
|
+
=begin
|
197
|
+
# TODO: DTK-2056: rewite
|
198
|
+
also put in list property
|
199
|
+
desc "TARGET-NAME/ID set-property PROPERTY VALUE
|
202
200
|
method_option :keypair, :type => :string
|
203
201
|
method_option :security_group, :type => :string, :aliases => '--security-groups'
|
204
|
-
def
|
202
|
+
def set_property(context_params)
|
203
|
+
raise "change so that param is seperated key value parts"
|
205
204
|
target_id = context_params.retrieve_arguments([:target_id!],method_argument_names)
|
206
205
|
keypair, security_group = context_params.retrieve_thor_options([:keypair, :security_group], options)
|
207
206
|
|
@@ -225,7 +224,8 @@ module DTK::Client
|
|
225
224
|
:target_id => target_id,
|
226
225
|
:iaas_properties => iaas_properties
|
227
226
|
}
|
228
|
-
|
227
|
+
post rest_url("target/set_properties"), post_body
|
229
228
|
end
|
229
|
+
=end
|
230
230
|
end
|
231
231
|
end
|
@@ -116,7 +116,9 @@ module DTK::Client
|
|
116
116
|
#
|
117
117
|
desc "import-git GIT-SSH-REPO-URL [NAMESPACE:]TEST-MODULE-NAME", "Create new local test module by importing from provided git repo URL"
|
118
118
|
def import_git(context_params)
|
119
|
-
import_git_module_aux(context_params)
|
119
|
+
response = import_git_module_aux(context_params)
|
120
|
+
@@invalidate_map << :test_module
|
121
|
+
response
|
120
122
|
end
|
121
123
|
|
122
124
|
desc "install NAMESPACE/REMOTE-TEST-MODULE-NAME","Install remote test module into local environment"
|
@@ -147,11 +149,15 @@ module DTK::Client
|
|
147
149
|
publish_module_aux(context_params)
|
148
150
|
end
|
149
151
|
|
150
|
-
desc "TEST-MODULE-NAME/ID pull-dtkn [-n NAMESPACE]", "Update local test module from remote repository."
|
151
|
-
method_option
|
152
|
-
:type
|
152
|
+
desc "TEST-MODULE-NAME/ID pull-dtkn [-n NAMESPACE] [--force]", "Update local test module from remote repository."
|
153
|
+
method_option :namespace,:aliases => '-n',
|
154
|
+
:type => :string,
|
153
155
|
:banner => "NAMESPACE",
|
154
|
-
:desc
|
156
|
+
:desc => "Remote namespace"
|
157
|
+
method_option :force,:aliases => '-f',
|
158
|
+
:type => :boolean,
|
159
|
+
:desc => "Force pull",
|
160
|
+
:default => false
|
155
161
|
def pull_dtkn(context_params)
|
156
162
|
pull_dtkn_aux(context_params)
|
157
163
|
end
|
@@ -281,4 +287,4 @@ module DTK::Client
|
|
281
287
|
end
|
282
288
|
end
|
283
289
|
end
|
284
|
-
end
|
290
|
+
end
|
@@ -72,6 +72,11 @@ module DTK::Client
|
|
72
72
|
:delete_node_group => {
|
73
73
|
:endpoint => "assembly",
|
74
74
|
:url => "assembly/get_node_groups"
|
75
|
+
},
|
76
|
+
:pull_base_component_module => {
|
77
|
+
:endpoint => "assembly",
|
78
|
+
:url => "assembly/info_about",
|
79
|
+
:opts => {:subtype=>"instance", :about=>"modules"}
|
75
80
|
}
|
76
81
|
}
|
77
82
|
}
|
@@ -191,6 +196,13 @@ module DTK::Client
|
|
191
196
|
push_module_updates_aux(context_params)
|
192
197
|
end
|
193
198
|
|
199
|
+
desc "WORKSPACE-NAME/ID pull-base-component-module COMPONENT-MODULE-NAME [--force] [--revert]", "Pull base component module changes to component module in workspace"
|
200
|
+
method_option :force, :type => :boolean, :default => false, :aliases => '-f'
|
201
|
+
method_option :revert, :type => :boolean, :default => false, :aliases => '-r'
|
202
|
+
def pull_base_component_module(context_params)
|
203
|
+
pull_base_component_module_aux(context_params)
|
204
|
+
end
|
205
|
+
|
194
206
|
desc "WORKSPACE-NAME/ID push-assembly-updates [NAMESPACE:]SERVICE-MODULE-NAME/ASSEMBLY-NAME", "Push changes made to this workspace to the designated assembly."
|
195
207
|
def push_assembly_updates(context_params)
|
196
208
|
workspace_id, qualified_assembly_name = context_params.retrieve_arguments([:workspace_id!,:option_1!],method_argument_names)
|
data/lib/core.rb
CHANGED
@@ -131,7 +131,7 @@ end
|
|
131
131
|
def resolve_direct_access(params, config_exists=nil)
|
132
132
|
return if params[:username_exists]
|
133
133
|
|
134
|
-
puts "Processing..." if config_exists
|
134
|
+
puts "Processing ..." if config_exists
|
135
135
|
# check to see if catalog credentials are set
|
136
136
|
conn = DTK::Client::Session.get_connection()
|
137
137
|
response = conn.post DTK::Client::CommandBase.class, conn.rest_url("account/check_catalog_credentials"), {}
|
data/lib/domain/git_adapter.rb
CHANGED
data/lib/domain/response.rb
CHANGED
@@ -148,14 +148,6 @@ module DTK
|
|
148
148
|
"dsl_parsed" => "DSL PARSED:"
|
149
149
|
}
|
150
150
|
|
151
|
-
mappings["target"] = {
|
152
|
-
"id" => "ID:",
|
153
|
-
"display_name" => "NAME:",
|
154
|
-
"type" => "TYPE:",
|
155
|
-
"iaas_type" => "PROVIDER_TYPE:",
|
156
|
-
"provider_name" => "PROVIDER_NAME:"
|
157
|
-
}
|
158
|
-
|
159
151
|
mappings[type][label] if mappings[type]
|
160
152
|
end
|
161
153
|
|
data/lib/dtk-client/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class DTK::Client::Execute::Script
|
2
2
|
class AddTenant < self
|
3
3
|
def self.ret_params_from_argv()
|
4
|
-
banner = "Usage: dtk-execute add-tenant TENANT-NAME CATALOG-USERNAME -p PASSWORD [-s SERVICE-INSTANCE]"
|
5
|
-
tenant_name = catalog_username = tenant_number = nil
|
6
|
-
if ARGV.size >
|
4
|
+
banner = "Usage: dtk-execute add-tenant TENANT-NAME CATALOG-USERNAME -p PASSWORD -v VERSION [-s SERVICE-INSTANCE]"
|
5
|
+
version = tenant_name = catalog_username = tenant_number = nil
|
6
|
+
if ARGV.size > 3
|
7
7
|
tenant_name = ARGV[1]
|
8
8
|
if tenant_name =~ /^dtk([0-9]+)$/
|
9
9
|
tenant_number = $1
|
10
10
|
else
|
11
|
-
raise ErrorUsage.new("TENANT-NAME must be of form '
|
11
|
+
raise ErrorUsage.new("TENANT-NAME must be of form 'dtkNUM', like dtk601")
|
12
12
|
end
|
13
13
|
catalog_username = ARGV[2]
|
14
14
|
else
|
@@ -23,12 +23,19 @@ class DTK::Client::Execute::Script
|
|
23
23
|
opts.on( '-s', '--service SERVICE-INSTANCE', "Name of Service instance" ) do |s|
|
24
24
|
params[:service_instance] = s
|
25
25
|
end
|
26
|
+
opts.on( '-v', '--version VERSION', "Version of code" ) do |v|
|
27
|
+
params[:version] = v
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
|
-
# TODO: use opt parser to enforce that :password
|
29
|
-
unless
|
31
|
+
# TODO: use opt parser to enforce that :password and :version options are manditory
|
32
|
+
unless params[:password]
|
30
33
|
raise ErrorUsage.new("Password is mandatory; use -p commnd line option")
|
31
34
|
end
|
35
|
+
unless params[:version]
|
36
|
+
raise ErrorUsage.new("Version is mandatory; use -v commnd line option")
|
37
|
+
end
|
38
|
+
|
32
39
|
service_instance = params[:service_instance] || "dtkhost#{tenant_number[0]}"
|
33
40
|
to_add = {
|
34
41
|
:tenant_name => tenant_name,
|
@@ -43,6 +50,7 @@ class DTK::Client::Execute::Script
|
|
43
50
|
catalog_username = params[:catalog_username]
|
44
51
|
service = params[:service_instance]
|
45
52
|
password = params[:password]
|
53
|
+
version = params[:version]
|
46
54
|
server_node = params[:server_node_name] || 'server'
|
47
55
|
router_node = params[:router_node_name] || 'router'
|
48
56
|
|
@@ -52,8 +60,16 @@ class DTK::Client::Execute::Script
|
|
52
60
|
av_pairs = {
|
53
61
|
:catalog_username => catalog_username,
|
54
62
|
:tenant_password => password,
|
55
|
-
:catalog_password => password
|
63
|
+
:catalog_password => password,
|
64
|
+
:server_branch => version,
|
56
65
|
}
|
66
|
+
|
67
|
+
linked_component_instances =
|
68
|
+
[
|
69
|
+
"#{router_node}/dtk_nginx::vhosts_for_router",
|
70
|
+
"#{server_node}/dtk_postgresql::databases",
|
71
|
+
"#{server_node}/host::hostname"
|
72
|
+
]
|
57
73
|
|
58
74
|
ExecuteContext(:print_results => true) do
|
59
75
|
result = call 'service/add_component',
|
@@ -70,16 +86,13 @@ class DTK::Client::Execute::Script
|
|
70
86
|
:value => v
|
71
87
|
end
|
72
88
|
|
89
|
+
linked_component_instances.each do |linked_component_instance|
|
73
90
|
result = call 'service/link_components',
|
74
91
|
:service => service,
|
75
92
|
:input_component => "#{server_node}/#{component}",
|
76
|
-
:output_component =>
|
93
|
+
:output_component => linked_component_instance
|
94
|
+
end
|
77
95
|
|
78
|
-
result = call 'service/link_components',
|
79
|
-
:service => service,
|
80
|
-
:input_component => "#{server_node}/#{component}",
|
81
|
-
:output_component => "#{router_node}/dtk_nginx::vhosts_for_router"
|
82
|
-
|
83
96
|
result = call 'service/execute_workflow',
|
84
97
|
:service => service,
|
85
98
|
:workflow_name => 'add_tenant',
|
data/lib/execute/script.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
class DTK::Client::Execute
|
2
2
|
class Script < self
|
3
3
|
dtk_require('script/add_tenant')
|
4
|
-
dtk_require('script/add_tenant_without_router')
|
5
4
|
def self.execute()
|
6
5
|
script_class().execute_script()
|
7
6
|
end
|
@@ -9,7 +8,6 @@ class DTK::Client::Execute
|
|
9
8
|
private
|
10
9
|
Scripts = {
|
11
10
|
'add-tenant' => AddTenant,
|
12
|
-
'add-tenant-without-router' => AddTenantWithoutRouter
|
13
11
|
}
|
14
12
|
|
15
13
|
def self.script_class()
|
data/lib/shell/context.rb
CHANGED
@@ -297,9 +297,23 @@ module DTK
|
|
297
297
|
# we remove '..' from our entries
|
298
298
|
entries = entries.select { |e| !(e.empty? || DTK::Shell::ContextAux.is_double_dot?(e)) }
|
299
299
|
|
300
|
+
# need this for autocomplete from service/node to service/utils
|
301
|
+
is_utils = active_context_copy.last_command_name.eql?('utils')
|
302
|
+
|
300
303
|
# we go back in context based on '..'
|
301
304
|
active_context_copy.pop_context(double_dots_count)
|
302
305
|
|
306
|
+
# if cd ../utils from service/node
|
307
|
+
if active_context_copy.current_command? && active_context_copy.last_command_name.eql?('node')
|
308
|
+
active_context_copy.pop_context(1)
|
309
|
+
entries = Context.check_invisible_context(active_context_copy, entries, root?, line_buffer, args, self)
|
310
|
+
end
|
311
|
+
|
312
|
+
# need this for autocomplete from service/node to service/utils
|
313
|
+
if is_utils
|
314
|
+
entries = Context.check_invisible_context(active_context_copy, entries, root?, line_buffer, args, self)
|
315
|
+
end
|
316
|
+
|
303
317
|
# if cd .. back to node, skip node context and go to assembly/workspace context
|
304
318
|
if (active_context_copy.last_context && entries)
|
305
319
|
active_context_copy.pop_context(1) if (node_specific && active_context_copy.last_context.is_command? && active_context_copy.last_command_name.eql?("node") && on_complete)
|
@@ -9,8 +9,7 @@ module DTK::Shell
|
|
9
9
|
@method_arguments = override_method_arguments
|
10
10
|
@thor_options = Hash.new
|
11
11
|
|
12
|
-
|
13
|
-
#@method_arguments.freeze
|
12
|
+
@method_arguments
|
14
13
|
end
|
15
14
|
|
16
15
|
def add_context_to_params(context_name, entity_name, context_value = nil)
|
data/lib/util/console.rb
CHANGED
@@ -33,6 +33,25 @@ module DTK::Client
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
#
|
37
|
+
# Display confirmation prompt and repeat message until expected answer is given
|
38
|
+
#
|
39
|
+
def confirmation_prompt_simple(message, add_options=true)
|
40
|
+
# used to disable skip with ctrl+c
|
41
|
+
trap("INT", "SIG_IGN")
|
42
|
+
message += " (y/n)" if add_options
|
43
|
+
|
44
|
+
while line = Readline.readline("#{message}: ", true)
|
45
|
+
if (line.eql?("yes") || line.eql?("y") || line.empty?)
|
46
|
+
trap("INT",false)
|
47
|
+
return true
|
48
|
+
elsif (line.eql?("no") || line.eql?("n"))
|
49
|
+
trap("INT",false)
|
50
|
+
return false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
36
55
|
# Loading output used to display waiting status
|
37
56
|
def wait_animation(message, time_seconds)
|
38
57
|
print message
|