Class: Staypuft::Deployment::NeutronService::Cisconexus
- Inherits:
-
Object
- Object
- Staypuft::Deployment::NeutronService::Cisconexus
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Serializers::JSON, ActiveModel::Validations
- Defined in:
- app/models/staypuft/deployment/neutron_service/cisconexus.rb
Defined Under Namespace
Modules: Hostname, Ip, Login, Password, PortMap, SshPort Classes: IpValueValidator, PortMapValueValidator
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#login ⇒ Object
Returns the value of attribute login.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port_map ⇒ Object
Returns the value of attribute port_map.
-
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #attributes=(attrs) ⇒ Object
- #config_hash ⇒ Object
-
#initialize(attrs = {}) ⇒ Cisconexus
constructor
A new instance of Cisconexus.
- #port_map_hash ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Cisconexus
Returns a new instance of Cisconexus.
70 71 72 73 74 75 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 70 def initialize(attrs = {}) @errors = ActiveModel::Errors.new(self) # Default ssh port to 22, but let args override self.ssh_port = 22 self.attributes = attrs end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 9 def errors @errors end |
#hostname ⇒ Object
Returns the value of attribute hostname.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def hostname @hostname end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def id @id end |
#ip ⇒ Object
Returns the value of attribute ip.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def ip @ip end |
#login ⇒ Object
Returns the value of attribute login.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def login @login end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def password @password end |
#port_map ⇒ Object
Returns the value of attribute port_map.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def port_map @port_map end |
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
8 9 10 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 8 def ssh_port @ssh_port end |
Class Method Details
.human_attribute_name(attr, options = {}) ⇒ Object
77 78 79 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 77 def self.human_attribute_name(attr, = {}) attr end |
.lookup_ancestors ⇒ Object
81 82 83 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 81 def self.lookup_ancestors [self] end |
Instance Method Details
#attributes ⇒ Object
97 98 99 100 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 97 def attributes { 'hostname' => nil, 'ip' => nil, 'login' => nil, 'password' => nil, 'port_map' => nil, 'ssh_port' => nil } end |
#attributes=(attrs) ⇒ Object
102 103 104 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 102 def attributes=(attrs) attrs.each { |attr, value| send "#{attr}=", value } unless attrs.nil? end |
#config_hash ⇒ Object
85 86 87 88 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 85 def config_hash { "ip_address" => ip, "username" => login, "password" => password, "ssh_port" => ssh_port, "servers" => port_map_hash } end |
#port_map_hash ⇒ Object
90 91 92 93 94 95 |
# File 'app/models/staypuft/deployment/neutron_service/cisconexus.rb', line 90 def port_map_hash Hash[port_map.each_line.map do |line| server = line.split(':') [ server.first.strip, server.last.strip ] end] end |