bin/trema in trema-0.8.4 vs bin/trema in trema-0.9.0
- old
+ new
@@ -57,13 +57,14 @@
desc 'Print all flow entries'
arg_name 'switches...'
command :dump_flows do |c|
c.desc 'Location to put socket files'
- c.flag [:S, :socket_dir], default_value: Phut.socket_dir
+ c.flag [:S, :socket_dir], default_value: Trema::DEFAULT_SOCKET_DIR
c.action do |_global_options, options, args|
+ Phut.socket_dir = options[:socket_dir]
args.each do |each|
puts Trema.fetch(each, options.fetch(:socket_dir)).dump_flows
end
end
end
@@ -231,15 +232,20 @@
end
end
end
end
- desc 'Opens a new shell in the specified network namespace'
- arg_name 'name'
+ desc 'Opens a new shell or runs a command in the specified network namespace'
+ arg_name 'name [command]'
command :netns do |c|
c.action do |global_options, options, args|
- system "sudo ip netns exec #{args[0]} #{ENV['SHELL']}"
+ command_args = args[1..-1]
+ if command_args && command_args.size > 0
+ system "sudo ip netns exec #{args[0]} #{command_args.join(' ')}"
+ else
+ system "sudo ip netns exec #{args[0]} #{ENV['SHELL']}"
+ end
end
end
default_command :help
@@ -249,9 +255,11 @@
Trema::NoControllerDefined,
Trema::InvalidLoggingLevel,
Phut::OpenVswitch::AlreadyRunning,
GLI::UnknownCommandArgument
true
+ when Interrupt
+ exit false
else
# show backtrace
fail e
end
end