From: elijah Date: Mon, 24 Mar 2014 17:26:49 +0000 (-0700) Subject: prevent invalid vangrant node names X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2b6f4b85a3089eacb19f7b6c165419c6620aeb45;p=leap%2Fleap_cli.git prevent invalid vangrant node names --- diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb index b554c1f..a4c0d1a 100644 --- a/lib/leap_cli/commands/node.rb +++ b/lib/leap_cli/commands/node.rb @@ -23,7 +23,11 @@ module LeapCli; module Commands # argument sanity checks name = args.first assert! name, 'No specified.' - assert! name =~ /^[0-9a-z-]+$/, "illegal characters used in node name '#{name}'" + if options[:local] + assert! name =~ /^[0-9a-z]+$/, "illegal characters used in node name '#{name}' (note: Vagrant does not allow hyphens or underscores)" + else + assert! name =~ /^[0-9a-z-]+$/, "illegal characters used in node name '#{name}' (note: Linux does not allow underscores)" + end assert_files_missing! [:node_config, name] # create and seed new node