Class: Tinet::Command::Conf

Inherits:
Base
  • Object
show all
Defined in:
lib/tinet/command/conf.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Shell

#sh, #sudo

Constructor Details

This class inherits a constructor from Tinet::Command::Base

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tinet/command/conf.rb', line 6

def run
  exec_pre_cmd
  exec_pre_conf

  nodes.each do |node|
    node.cmds.each do |cmd|
      case node.type
      when :docker
        sudo "docker exec #{namespaced(node.name)} #{cmd} > /dev/null"
      when :netns
        sudo "ip netns exec #{namespaced(node.name)} #{cmd} > /dev/null"
      end
    end
  end

  exec_post_conf
end