Class: DTK::Client::ComponentModule
Constant Summary
collapse
- PushCatalogs =
["origin", "dtkn"]
DTK::Client::CommandBaseThor::ALT_IDENTIFIER_SEPARATOR, DTK::Client::CommandBaseThor::EXTENDED_TIMEOUT, DTK::Client::CommandBaseThor::HIDE_FROM_BASE_CONTEXT, DTK::Client::CommandBaseThor::TIME_DIFF
DTK::Client::CommandHelperMixin::Loaded
ReparseMixin::YamlDTKMetaFiles
Constants included
from Poller
Poller::PERIOD_WAIT_TIME
Constants inherited
from Thor
Thor::HIDE_FROM_BASE_CONTEXT_HELP
Class Method Summary
collapse
Instance Method Summary
collapse
action_on_revalidation_response, basename, create_context_arguments, execute_from_cli, generate_cached_id, get_cached_response, get_identifiers, get_usage_info, #help, #initialize, invalidate_entities, invisible_context_list, list_method_supported?, task_names, tiered_task_names, valid_id?
#get, #get_connection, handle_argument_error, #post, #post_file, #rest_url, #rotate_args
#list_task_info_aux, #task_status_aux, #task_status_stream
Methods included from Console
confirmation_prompt, confirmation_prompt_additional_options, confirmation_prompt_multiple_choice, confirmation_prompt_simple, unix_shell, wait_animation
#Helper
#reparse_aux
#push_clone_changes_aux
#version_method_option
Methods included from Poller
#poller_response, #print_response, #resolve_type
Methods inherited from Thor
get_alternative_identifiers, help, match_help_item_changes, overriden_help, printable_tasks, replace_if_matched!, set_context
Class Method Details
.all_children ⇒ Object
this includes children of children - has to be sorted by n-level access
33
34
35
|
# File 'lib/commands/thor/component_module.rb', line 33
def self.all_children()
[:component]
end
|
.multi_context_children ⇒ Object
37
38
39
|
# File 'lib/commands/thor/component_module.rb', line 37
def self.multi_context_children()
[[:component], [:remotes], [:component, :remotes]]
end
|
.override_allowed_methods ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/commands/thor/component_module.rb', line 49
def self.override_allowed_methods()
return DTK::Shell::OverrideTasks.new(
{
:command_only => {
:self => [
["list"," list [--remote] [--diff] [-n NAMESPACE]","# List loaded or remote component modules. Use --diff to compare loaded and remote component modules."]
],
:component => [
["list","list","# List all component templates."],
["list-attributes","list-attributes", "# List all attributes for given component."]
],
:remotes => [
["push-remote", "push-remote [REMOTE-NAME] [--force]", "# Push local changes to remote git repository"],
["list-remotes", "list-remotes", "# List git remotes for given module"],
["add-remote", "add-remote REMOTE-NAME REMOTE-URL", "# Add git remote for given module"],
["remove-remote", "remove-remote REPO-NAME [-y]", "# Remove git remote for given module"]
]
},
:identifier_only => {
:component => [
["list-attributes","list-attributes", "# List all attributes for given component."]
]
}
})
end
|
.valid_child?(name_of_sub_context) ⇒ Boolean
41
42
43
|
# File 'lib/commands/thor/component_module.rb', line 41
def self.valid_child?(name_of_sub_context)
return ComponentModule.valid_children().include?(name_of_sub_context.to_sym)
end
|
.valid_children ⇒ Object
28
29
30
|
# File 'lib/commands/thor/component_module.rb', line 28
def self.valid_children()
[:component, :remotes]
end
|
.validation_list(context_params) ⇒ Object
45
46
47
|
# File 'lib/commands/thor/component_module.rb', line 45
def self.validation_list(context_params)
get_cached_response(:component_module, "component_module/list", {})
end
|
.whoami ⇒ Object
76
77
78
|
# File 'lib/commands/thor/component_module.rb', line 76
def self.whoami()
return :component_module, "component_module/list", nil
end
|
Instance Method Details
#add_collaborators(context_params) ⇒ Object
371
372
373
|
# File 'lib/commands/thor/component_module.rb', line 371
def add_collaborators(context_params)
add_collaborators_module_aux(context_params)
end
|
#add_remote(context_params) ⇒ Object
462
463
464
|
# File 'lib/commands/thor/component_module.rb', line 462
def add_remote(context_params)
remote_add_aux(context_params)
end
|
#chmod(context_params) ⇒ Object
351
352
353
|
# File 'lib/commands/thor/component_module.rb', line 351
def chmod(context_params)
chmod_module_aux(context_params)
end
|
#clone(context_params, internal_trigger = true) ⇒ Object
398
399
400
|
# File 'lib/commands/thor/component_module.rb', line 398
def clone(context_params, internal_trigger=true)
clone_module_aux(context_params, internal_trigger)
end
|
#create_new_version(context_params) ⇒ Object
478
479
480
|
# File 'lib/commands/thor/component_module.rb', line 478
def create_new_version(context_params)
create_new_version_aux(context_params)
end
|
#delete(context_params, method_opts = {}) ⇒ Object
95
96
97
98
99
100
|
# File 'lib/commands/thor/component_module.rb', line 95
def delete(context_params, method_opts = {})
response = delete_module_aux(context_params, method_opts.merge!(:delete_all => true))
@@invalidate_map << :component_module if response && response.ok?
response
end
|
#delete_all(context_params) ⇒ Object
488
489
490
491
492
493
494
495
|
# File 'lib/commands/thor/component_module.rb', line 488
def delete_all(context_params)
return unless Console.confirmation_prompt("This will DELETE ALL component modules, are you sure"+'?')
response = list(context_params)
response.data().each do |e|
run_shell_command("delete #{e['display_name']} -y -p")
end
end
|
#delete_from_catalog(context_params) ⇒ Object
300
301
302
|
# File 'lib/commands/thor/component_module.rb', line 300
def delete_from_catalog(context_params)
delete_from_catalog_aux(context_params)
end
|
#delete_version(context_params, method_opts = {}) ⇒ Object
84
85
86
87
88
89
|
# File 'lib/commands/thor/component_module.rb', line 84
def delete_version(context_params, method_opts = {})
response = delete_module_aux(context_params, method_opts)
@@invalidate_map << :component_module if response && response.ok?
response
end
|
#edit(context_params) ⇒ Object
405
406
407
|
# File 'lib/commands/thor/component_module.rb', line 405
def edit(context_params)
edit_module_aux(context_params)
end
|
#fork(context_params) ⇒ Object
473
474
475
|
# File 'lib/commands/thor/component_module.rb', line 473
def fork(context_params)
fork_aux(context_params)
end
|
#import(context_params) ⇒ Object
174
175
176
177
178
|
# File 'lib/commands/thor/component_module.rb', line 174
def import(context_params)
response = import_module_aux(context_params)
@@invalidate_map << :component_module
response
end
|
#import_git(context_params) ⇒ Object
198
199
200
201
202
|
# File 'lib/commands/thor/component_module.rb', line 198
def import_git(context_params)
response = import_git_module_aux(context_params)
@@invalidate_map << :component_module
response
end
|
#import_puppet_forge(context_params) ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/commands/thor/component_module.rb', line 181
def import_puppet_forge(context_params)
pf_module_name, full_module_name = context_params.retrieve_arguments([:option_1!, :option_2],method_argument_names)
namespace, module_name = get_namespace_and_name(full_module_name, ModuleUtil::NAMESPACE_SEPERATOR)
module_type = get_module_type(context_params)
OsUtil.print('Retrieving puppet module metadata, please wait ...')
response = puppet_forge_install_aux(context_params, pf_module_name, module_name, namespace, nil, module_type)
@@invalidate_map << :component_module
response
end
|
#install(context_params) ⇒ Object
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/commands/thor/component_module.rb', line 236
def install(context_params)
response = install_module_aux(context_params)
if response && response.ok?
@@invalidate_map << :component_module
if module_directory = response.data(:module_directory)
split = module_directory.split('/')
if split.size > 2
installed_module = split[split.size-2..split.size-1].join(':')
response = Response::Ok.new('installed_module' => installed_module)
end
end
end
response
end
|
#list(context_params) ⇒ Object
method_option :with_versions, :type => :boolean, :default => false, :aliases => “with-versions”
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/commands/thor/component_module.rb', line 115
def list(context_params)
return module_info_about(context_params, :components, :component) if context_params.is_there_command?(:"component")
forwarded_remote = context_params.get_forwarded_options()["remote"] if context_params.get_forwarded_options()
remote = options.remote? || forwarded_remote
action = (remote ? "list_remote" : "list")
post_body = (remote ? { :rsa_pub_key => SSHUtil.rsa_pub_key_content() } : {:detail_to_include => ["remotes"]})
post_body[:diff] = options.diffs? ? options.diffs : {}
if post_body[:detail_to_include]
post_body[:detail_to_include] << 'versions' else
post_body[:detail_to_include]
end
post_body.merge!(:module_namespace => options.namespace) if options.namespace
response = post rest_url("component_module/#{action}"), post_body
return response unless response.ok?
if options.with_versions?
response.render_table(:module_with_versions, true)
else
response.render_table()
end
end
|
#list_attributes(context_params) ⇒ Object
150
151
152
|
# File 'lib/commands/thor/component_module.rb', line 150
def list_attributes(context_params)
module_info_about(context_params, :attributes, :attribute_without_link)
end
|
#list_collaborators(context_params) ⇒ Object
385
386
387
|
# File 'lib/commands/thor/component_module.rb', line 385
def list_collaborators(context_params)
list_collaborators_module_aux(context_params)
end
|
#list_components(context_params) ⇒ Object
145
146
147
|
# File 'lib/commands/thor/component_module.rb', line 145
def list_components(context_params)
module_info_about(context_params, :components, :component)
end
|
#list_diffs(context_params) ⇒ Object
443
444
445
446
|
# File 'lib/commands/thor/component_module.rb', line 443
def list_diffs(context_params)
list_remote_module_diffs(context_params)
end
|
#list_instances(context_params) ⇒ Object
155
156
157
|
# File 'lib/commands/thor/component_module.rb', line 155
def list_instances(context_params)
module_info_about(context_params, :instances, :component_instances)
end
|
#list_remote_versions(context_params) ⇒ Object
167
168
169
170
171
|
# File 'lib/commands/thor/component_module.rb', line 167
def list_remote_versions(context_params)
response = list_remote_versions_aux(context_params)
return response unless response.ok?
response.render_table(:list_versions, true)
end
|
#list_remotes(context_params) ⇒ Object
457
458
459
|
# File 'lib/commands/thor/component_module.rb', line 457
def list_remotes(context_params)
remote_list_aux(context_params)
end
|
#list_versions(context_params) ⇒ Object
160
161
162
163
164
|
# File 'lib/commands/thor/component_module.rb', line 160
def list_versions(context_params)
response = list_versions_aux(context_params)
return response unless response.ok?
response.render_table(:list_versions, true)
end
|
#make_private(context_params) ⇒ Object
363
364
365
|
# File 'lib/commands/thor/component_module.rb', line 363
def make_private(context_params)
make_private_module_aux(context_params)
end
|
#make_public(context_params) ⇒ Object
357
358
359
|
# File 'lib/commands/thor/component_module.rb', line 357
def make_public(context_params)
make_public_module_aux(context_params)
end
|
#publish(context_params) ⇒ Object
323
324
325
|
# File 'lib/commands/thor/component_module.rb', line 323
def publish(context_params)
publish_module_aux(context_params)
end
|
#pull_dtkn(context_params) ⇒ Object
336
337
338
|
# File 'lib/commands/thor/component_module.rb', line 336
def pull_dtkn(context_params)
pull_dtkn_aux(context_params)
end
|
#push(context_params, internal_trigger = false) ⇒ Object
417
418
419
|
# File 'lib/commands/thor/component_module.rb', line 417
def push(context_params, internal_trigger=false)
push_module_aux(context_params, internal_trigger)
end
|
#push_dtkn(context_params, internal_trigger = false) ⇒ Object
433
434
435
|
# File 'lib/commands/thor/component_module.rb', line 433
def push_dtkn(context_params, internal_trigger=false)
push_dtkn_module_aux(context_params, internal_trigger)
end
|
#push_remote(context_params) ⇒ Object
452
453
454
|
# File 'lib/commands/thor/component_module.rb', line 452
def push_remote(context_params)
push_remote_module_aux(context_params)
end
|
#remove_collaborators(context_params) ⇒ Object
379
380
381
|
# File 'lib/commands/thor/component_module.rb', line 379
def remove_collaborators(context_params)
remove_collaborators_module_aux(context_params)
end
|
#remove_remote(context_params) ⇒ Object
468
469
470
|
# File 'lib/commands/thor/component_module.rb', line 468
def remove_remote(context_params)
remote_remove_aux(context_params)
end
|
#set_attribute(context_params) ⇒ Object
103
104
105
|
# File 'lib/commands/thor/component_module.rb', line 103
def set_attribute(context_params)
set_attribute_module_aux(context_params)
end
|