Module: OmfRc::ResourceProxy::Node

Extended by:
OmfRc::ResourceProxyDSL::ClassMethods
Includes:
OmfRc::ResourceProxyDSL, Util::Mod, Util::Sysfs
Defined in:
omf_rc/lib/omf_rc/resource_proxy/node.rb

Overview

Resource proxy for PC type node

Constant Summary

Constant Summary

Constants included from OmfRc::ResourceProxyDSL

OmfRc::ResourceProxyDSL::DEFAULT_PROP_ACCESS, OmfRc::ResourceProxyDSL::PROXY_DIR, OmfRc::ResourceProxyDSL::UTIL_DIR

FRCP Request Methods (collapse)

OMF RC Hooks (collapse)

Methods included from OmfRc::ResourceProxyDSL::ClassMethods

call_hook, configure, extend_configure, extend_hook, extend_request, extend_work, hook, property, register_proxy, request, utility, work

Methods included from OmfRc::ResourceProxyDSL

#call_hook, included

Instance Method Details

- (Object) before_create

Check if device exists

Raises:

  • (StandardError)

    if device not found on the node



55
56
57
58
59
60
61
62
# File 'omf_rc/lib/omf_rc/resource_proxy/node.rb', line 55

hook :before_create do |node, type, opts|
  if type.to_sym == :net
    net_dev = node.request_devices.find do |v|
      v[:name] == opts[:if_name]
    end
    raise StandardError, "Device '#{opts[:if_name]}' not found" if net_dev.nil?
  end
end

- (Array<Hash>) request_applications

Note:

Method 'request_applications' generated by DSL method 'request'

Created applications

Examples:

[{ name: 'my_app', type: 'application', uid: 'E232ER1' }]


40
41
42
43
44
# File 'omf_rc/lib/omf_rc/resource_proxy/node.rb', line 40

request :applications do |node|
  node.children.find_all { |v| v.type =~ /application/ }.map do |v|
    { name: v.hrn, type: v.type, uid: v.uid }
  end.sort { |x, y| x[:name] <=> y[:name] }
end

- (Array<Hash>) request_interface

Note:

Method 'request_interfaces' generated by DSL method 'request'

Created interfaces

Examples:

[{ name: 'eth0', type: 'net', uid: 'RWED2123' }]


27
28
29
30
31
# File 'omf_rc/lib/omf_rc/resource_proxy/node.rb', line 27

request :interfaces do |node|
  node.children.find_all { |v| v.type == :net || v.type == :wlan }.map do |v|
    { name: v.property.if_name, type: v.type, uid: v.uid }
  end.sort { |x, y| x[:name] <=> y[:name] }
end