class DTK::Client::ComponentModule

Constants

PushCatalogs

Public Class Methods

all_children() click to toggle source

this includes children of children - has to be sorted by n-level access

# File lib/commands/thor/component_module.rb, line 33
def self.all_children()
  [:component]
end
multi_context_children() click to toggle source
# File lib/commands/thor/component_module.rb, line 37
def self.multi_context_children()
  [[:component], [:remotes], [:component, :remotes]]
end
override_allowed_methods() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/commands/thor/component_module.rb, line 28
def self.valid_children()
  [:component, :remotes]
end
validation_list(context_params) click to toggle source
# 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() click to toggle source
# File lib/commands/thor/component_module.rb, line 76
def self.whoami()
  return :component_module, "component_module/list", nil
end

Public Instance Methods

COMPONENT-MODULE-NAME/ID clone [-n] [-v VERSION]() click to toggle source

internal_trigger: this flag means that other method (internal) has trigger this.

This will change behaviour of method in such way that edit will not be
triggered after it.
# File lib/commands/thor/component_module.rb, line 395
desc "COMPONENT-MODULE-NAME/ID clone [-n] [-v VERSION]", "Locally clone component module and component files. Use -n to skip edit prompt"
add_collaborators(context_params) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 462
def add_remote(context_params)
  remote_add_aux(context_params)
end
chmod(context_params) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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 = {}) click to toggle source

version_method_option

# 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) click to toggle source
# 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) click to toggle source
# 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 = {}) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 405
def edit(context_params)
  edit_module_aux(context_params)
end
fork(context_params) click to toggle source
# File lib/commands/thor/component_module.rb, line 473
def fork(context_params)
  fork_aux(context_params)
end
import(context_params) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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
    # TODO: hack before clean up way to indicate to better format what is passed as hash; these lines print the created module,
    # not the module_directory
    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) click to toggle source

method_option :with_versions, :type => :boolean, :default => false, :aliases => “with-versions”

# 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' # if options.with_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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 443
def list_diffs(context_params)
  list_remote_module_diffs(context_params)
  # list_diffs_module_aux(context_params)
end
list_instances(context_params) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 457
def list_remotes(context_params)
  remote_list_aux(context_params)
end
list_versions(context_params) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 357
def make_public(context_params)
  make_public_module_aux(context_params)
end
publish(context_params) click to toggle source
# File lib/commands/thor/component_module.rb, line 323
def publish(context_params)
  publish_module_aux(context_params)
end
pull_dtkn(context_params) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/commands/thor/component_module.rb, line 468
def remove_remote(context_params)
  remote_remove_aux(context_params)
end
set_attribute(context_params) click to toggle source
# File lib/commands/thor/component_module.rb, line 103
def set_attribute(context_params)
  set_attribute_module_aux(context_params)
end