Class: IIB::Node::CLI

Inherits:
Object
  • Object
show all
Includes:
IIB::Node
Defined in:
lib/iib/node/CLI.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IIB::Node

create_local_node, delete_local_node, get_all_local_nodes, new

Constructor Details

#initialize(options) ⇒ CLI

Returns a new instance of CLI.



26
27
28
# File 'lib/iib/node/CLI.rb', line 26

def initialize(options)
  @name = options[:name]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/iib/node/CLI.rb', line 24

def name
  @name
end

Instance Method Details

#==(other_object) ⇒ Object



53
54
55
# File 'lib/iib/node/CLI.rb', line 53

def ==(other_object)
  return name == other_object.name
end

#is_runningObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/iib/node/CLI.rb', line 30

def is_running
  IIB.check_local_iib_environment
  iib_list = Mixlib::ShellOut.new("iib list")
  iib_list.run_command

  iib_list.stdout.lines.each do |line|
    return true if line =~ /^BIP1325I.*'#{name}'.*$/
    return false if line =~ /^BIP1326I.*'#{name}'.*$/
  end
end

#startObject



41
42
43
44
45
# File 'lib/iib/node/CLI.rb', line 41

def start 
  IIB.check_local_iib_environment
  iib_start = Mixlib::ShellOut.new("iib start #{name}")
  iib_start.run_command
end

#stopObject



47
48
49
50
51
# File 'lib/iib/node/CLI.rb', line 47

def stop
  IIB.check_local_iib_environment
  iib_stop = Mixlib::ShellOut.new("iib stop #{name}")
  iib_stop.run_command
end