Class: Bcome::Node::Server::Static

Inherits:
Base
  • Object
show all
Defined in:
lib/objects/node/server/static.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_IDENTIFIER

Constants included from Draw

Draw::BLIP, Draw::BOTTOM_ANCHOR, Draw::BOX_BOTTOM_LEFT, Draw::BOX_BOTTOM_RIGHT, Draw::BOX_HORIZONTAL_LINE, Draw::BOX_SIDE, Draw::BOX_TOP_LEFT, Draw::BOX_TOP_RIGHT, Draw::BRANCH, Draw::INGRESS, Draw::LEFT_PADDING, Draw::MID_SHIPS

Constants included from LocalMetaDataFactory

LocalMetaDataFactory::META_DATA_FILE_PATH_PREFIX

Instance Attribute Summary collapse

Attributes inherited from Base

#origin_object_id

Attributes inherited from Base

#identifier, #params, #parent, #views

Instance Method Summary collapse

Methods inherited from Base

#add_list_attributes, #cache_data, #close_ssh_connection, #do_generate_cloud_tags, #do_run, #dup_with_new_parent, #dynamic_server?, #enabled_menu_items, #execute_script, #get, #has_description?, #has_no_ssh_connection?, #has_ssh_connection?, #has_tagged_value?, #is_same_machine?, #list_attributes, #local_network?, #local_port_forward, #ls, #machines, #menu_items, #open_ssh_connection, #origin_namespace, #ping, #print_ping_result, #pseudo_tty, #put, #put_str, #reopen_ssh_connection, #requires_description?, #requires_type?, #rsync, #run, #server?, #set_list_attributes, #set_network_configuration_overrides, #set_view_attributes, #ssh, #tags, #tags_h, #type, #update_identifier, #update_parent

Methods inherited from Base

#close_ssh_connections, #collection?, const_missing, #data_print_from_hash, #enabled_menu_items, #execute_local, #execute_script, #has_parent?, #has_proxy?, #hide?, #inspect, #inventory?, #invoke, #is_top_level_node?, #keyed_namespace, #list_attributes, #list_key, #method_missing, #namespace, #no_nodes?, #nodes_loaded!, #nodes_loaded?, #prompt_breadcrumb, #proxy, #proxy_chain, #proxy_chain_link, #put, #put_str, #recurse_resource_for_identifier, #requires_description?, #requires_type?, #resource_for_identifier, #resources, #rsync, #scoped_resources, #scp, #server?, #ssh_connect, #validate_attributes, #validate_identifier

Methods included from LoadingBar::Handler

#cursor, #do_signal, #fork_process, #signal_failure, #signal_stop, #signal_success, #start_indicator, #stop_indicator, #wrap_indicator

Methods included from Tree

#build_tree, #deduce_tree_structure, #namespace_tree_line, #network_namespace_tree_data, #recurse_tree_lines, #routes, #routing_tree_data, #routing_tree_line, #to_nested_hash, #tree

Methods included from Draw

#box_it, #max_box_line_length

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_group_names, #menu_item_spacing_length, #menu_items, #mode, #print_menu_items, #tab_spacing

Methods included from Attributes

#filters, #identifier, #network_data, #network_driver, #recurse_hash_data_for_instance_key, #ssh_data, #ssh_driver, #ssh_driver=

Methods included from WorkspaceCommands

#cd, #clear!, #disable, #disable!, #enable, #enable!, #interactive, #is_node_level_method?, #ls, #lsa, #method_in_registry?, #method_is_available_on_node?, #new_line, #parents, #ping, #pretty_description, #resource_identifiers, #run, #ssh_connect, #tree_descriptions, #visual_hierarchy, #workon

Methods included from Context

#current_context?, #irb_workspace=, #previous_irb_workspace=

Constructor Details

#initialize(params) ⇒ Static

Returns a new instance of Static.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/objects/node/server/static.rb', line 9

def initialize(params)
  @view_config = params[:views]

  set_cloud_tags

  @identifier = @view_config[:identifier]
  @public_ip_address = @view_config[:public_ip_address]
  @internal_ip_address = @view_config[:internal_ip_address]
  @cloud_tags = @view_config[:cloud_tags]
  @description = @view_config[:description]
  verify_we_have_at_least_one_interface
  verify_identifier_and_description
  super
end

Dynamic Method Handling

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

Instance Attribute Details

#cloud_tagsObject (readonly)

Returns the value of attribute cloud_tags.



24
25
26
# File 'lib/objects/node/server/static.rb', line 24

def cloud_tags
  @cloud_tags
end

#descriptionObject (readonly)

Returns the value of attribute description.



32
33
34
# File 'lib/objects/node/server/static.rb', line 32

def description
  @description
end

#internal_ip_addressObject (readonly)

Returns the value of attribute internal_ip_address.



28
29
30
# File 'lib/objects/node/server/static.rb', line 28

def internal_ip_address
  @internal_ip_address
end

#public_ip_addressObject (readonly)

Returns the value of attribute public_ip_address.



26
27
28
# File 'lib/objects/node/server/static.rb', line 26

def public_ip_address
  @public_ip_address
end

Instance Method Details

#has_at_least_one_interface?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/objects/node/server/static.rb', line 47

def has_at_least_one_interface?
  @public_ip_address || @internal_ip_address
end

#hostObject



5
6
7
# File 'lib/objects/node/server/static.rb', line 5

def host
  'static'
end

#set_cloud_tagsObject



34
35
36
# File 'lib/objects/node/server/static.rb', line 34

def set_cloud_tags
  @view_config[:cloud_tags] = ::Bcome::Node::Meta::Cloud.new(@view_config[:cloud_tags]) unless @view_config[:cloud_tags].is_a?(::Bcome::Node::Meta::Cloud)
end

#static_server?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/objects/node/server/static.rb', line 51

def static_server?
  true
end

#verify_identifier_and_descriptionObject



42
43
44
45
# File 'lib/objects/node/server/static.rb', line 42

def verify_identifier_and_description
  raise Bcome::Exception::Generic, "Your static server defined by #{@view_config} is missing a description" unless @description
  raise Bcome::Exception::Generic, "Your static server defined by #{@view_config} is missing an identifier" unless @identifier
end

#verify_we_have_at_least_one_interfaceObject



38
39
40
# File 'lib/objects/node/server/static.rb', line 38

def verify_we_have_at_least_one_interface
  raise Bcome::Exception::MissingIpaddressOnServer, @view_config unless has_at_least_one_interface?
end