Class: Bcome::Node::Inventory::Subselect

Inherits:
Base
  • Object
show all
Defined in:
lib/objects/node/inventory/subselect.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_IDENTIFIER

Constants included from LocalMetaDataFactory

LocalMetaDataFactory::META_DATA_FILE_PATH_PREFIX

Instance Attribute Summary

Attributes inherited from Base

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cache_nodes_in_memory, #cloud_matches, #direct_invoke_all_servers, #direct_invoke_server, #enabled_menu_items, #inventory?, #list_key, #machine_by_identifier, #machines, #matches_for, #menu_items, #meta_matches, #override_server_identifier?, #ssh, #tags, #toggle_bootstrap

Methods inherited from Base

#bootstrap?, #close_ssh_connections, #collection?, const_missing, #data_print_from_hash, #enabled_menu_items, #execute_local, #execute_script, #has_parent?, #has_proxy?, #identifier=, #inventory?, #invoke, #is_top_level_node?, #keyed_namespace, #list_attributes, #list_key, #namespace, #no_nodes?, #open_ssh_connections, #pack_metadata, #prompt_breadcrumb, #proxy, #put, #recurse_resource_for_identifier, #requires_description?, #requires_type?, #resource_for_identifier, #rsync, #scp, #server?, #unpack_metadata, #validate_attributes, #validate_identifier

Methods included from RegistryManagement

#registry, #user_command_wrapper

Methods included from LocalMetaDataFactory

#do_create_metadata, #meta, #metadata, #metadata_for_namespace, #raw_metadata

Methods included from WorkspaceMenu

#item_spacing, #menu, #menu_item_spacing_length, #menu_items, #mode, #tab_spacing

Methods included from Attributes

#description, #identifier, #network_data, #network_driver, #recurse_hash_data_for_instance_var, #ssh_data, #ssh_driver, #type

Methods included from WorkspaceCommands

#back, #cd, #clear!, #disable, #disable!, #enable, #enable!, #interactive, #is_node_level_method?, #list_in_tree, #ls, #lsa, #method_in_registry?, #method_is_available_on_node?, #method_missing, #new_line, #parents, #ping, #pretty_description, #print_tree_view_for_resource, #resource_identifiers, #run, #tree, #tree_descriptions, #visual_hierarchy, #workon

Methods included from Context

#irb_workspace=, #is_current_context?, #previous_irb_workspace=

Constructor Details

#initialize(*params) ⇒ Subselect

Returns a new instance of Subselect.



3
4
5
6
7
# File 'lib/objects/node/inventory/subselect.rb', line 3

def initialize(*params)
  super
  raise Bcome::Exception::MissingSubselectionKey, @views unless @views[:subselect_from]
  update_nodes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bcome::WorkspaceCommands

Class Method Details

.to_sObject



30
31
32
# File 'lib/objects/node/inventory/subselect.rb', line 30

def self.to_s
  'sub-inventory'
end

Instance Method Details

#do_reloadObject



38
39
40
41
42
43
44
# File 'lib/objects/node/inventory/subselect.rb', line 38

def do_reload
  parent_inventory.resources.reset_duplicate_nodes!
  parent_inventory.do_reload
  resources.run_subselect
  update_nodes
  return
end

#do_set_resourcesObject



17
18
19
# File 'lib/objects/node/inventory/subselect.rb', line 17

def do_set_resources
  ::Bcome::Node::Resources::SubselectInventory.new(parent_inventory: parent_inventory, filters: filters)
end

#filtersObject



25
26
27
28
# File 'lib/objects/node/inventory/subselect.rb', line 25

def filters
  # Flex point for filters, as obviously we need to support more than just ec2 filtering eventually
  @views[:filters] ? @views[:filters] : {}
end

#nodes_loaded?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/objects/node/inventory/subselect.rb', line 21

def nodes_loaded?
  true
end

#reloadObject



34
35
36
# File 'lib/objects/node/inventory/subselect.rb', line 34

def reload
  do_reload
end

#resourcesObject



9
10
11
# File 'lib/objects/node/inventory/subselect.rb', line 9

def resources
  @resources ||= do_set_resources
end

#update_nodesObject



13
14
15
# File 'lib/objects/node/inventory/subselect.rb', line 13

def update_nodes
  resources.update_nodes(self)
end