]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
prevent invalid vangrant node names
authorelijah <elijah@riseup.net>
Mon, 24 Mar 2014 17:26:49 +0000 (10:26 -0700)
committerelijah <elijah@riseup.net>
Mon, 24 Mar 2014 17:26:49 +0000 (10:26 -0700)
lib/leap_cli/commands/node.rb

index b554c1f285efc51e87a8508b926863ef7bdf8f4c..a4c0d1a2a26400f32fa67f1a41f64a19a0c53605 100644 (file)
@@ -23,7 +23,11 @@ module LeapCli; module Commands
         # argument sanity checks
         name = args.first
         assert! name, 'No <node-name> 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