Class: Vagrant::Node::NodeServerStop

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-node/nodeserverstop.rb

Instance Method Summary collapse

Instance Method Details

#executeObject

Raises:

  • (Vagrant::Errors::CLIInvalidUsage)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-node/nodeserverstop.rb', line 6

def execute
  # options = {}
  # options[:password]= ""
 
  opts = OptionParser.new do |opts|
    opts.banner = "Usage: vagrant nodeserver stop --passwd password"
    opts.separator ""
    # opts.on("-p","--passwd password", String, "Node Password") do |p|            
        # options[:password] = p
    # end
  end
  
  argv = parse_options(opts)
  return if !argv  
  raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length > 1 
  
  begin
    #ServerAPI::ServerManager.stop(File.dirname(@env.lock_path),@env.data_dir)
    ServerAPI::ServerManager.stop(@env.tmp_path,@env.data_dir)
  rescue Exception => e  
    @env.ui.error(e.message)
  end
   		         		
  0
end