Permalink
Browse files

- add random password generation

- fix server image argument
  • Loading branch information...
1 parent fd607d5 commit 9c4e56acd7c3e9421b2cb18188171e6d5dc8c70c @lamont-granquist lamont-granquist committed Nov 7, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/chef/knife/linode_server_create.rb
@@ -82,12 +82,15 @@ class LinodeServerCreate < Knife
:description => "The ssh username",
:default => "root"
+ chars = ("a".."z").to_a + ("1".."9").to_a + ("A".."Z").to_a
+ defpass = Array.new(20, '').collect{chars[rand(chars.size)]}.push('A').push('a').join
+
option :ssh_password,
:short => "-P PASSWORD",
:long => "--ssh-password PASSWORD",
:proc => Proc.new { |p| Chef::Config[:knife][:ssh_password] = p },
:description => "The ssh password",
- :default => "BarbaZ"
+ :default => defpass
option :identity_file,
:short => "-i IDENTITY_FILE",
@@ -182,7 +185,7 @@ def run
server = connection.servers.create(
:data_center => datacenter,
:flavor => flavor,
- image => image,
+ :image => image,
:kernel => kernel,
:type => "ext3",
:payment_terms => 1,

0 comments on commit 9c4e56a

Please sign in to comment.