mccloud 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mccloud (0.0.1)
4
+ mccloud (0.0.2)
5
5
  cucumber (= 0.8.5)
6
6
  fog
7
7
  highline (~> 1.6.1)
data/bin/mccloud CHANGED
@@ -18,9 +18,10 @@ class MccloudCLI < Thor
18
18
 
19
19
  end
20
20
 
21
- desc "init [AMI-ID]", "initializes a box from a template"
21
+ desc "init", "creates a Mccloud Config File"
22
22
  method_options :force => :boolean
23
23
  def init(amiId=nil)
24
+ Mccloud::Command.init(amiId,options)
24
25
  end
25
26
 
26
27
  desc "up", "bring a machine up"
@@ -6,7 +6,7 @@ module Mccloud
6
6
  on_selected_machines(selection) do |id,vm|
7
7
  puts "bootstrap #{selection} "
8
8
  server=vm.instance
9
- server.private_key_path=vm.key
9
+ server.private_key_path=vm.private_key
10
10
  server.username = vm.user
11
11
  if server.state == "running"
12
12
  puts "Uploading bootstrap code to machine #{vm.name}"
@@ -4,7 +4,7 @@ module Mccloud
4
4
  unless options.parallel?
5
5
  on_selected_machines(selection) do |id,vm|
6
6
  server=PROVIDER.servers.get(id)
7
- server.private_key_path=vm.key
7
+ server.private_key_path=vm.private_key
8
8
  server.username = vm.user
9
9
  if server.state == "running"
10
10
  result=server.ssh(command)
@@ -1,6 +1,8 @@
1
+ require 'mccloud/generators'
2
+
1
3
  module Mccloud
2
4
  module Command
3
- def init(amiId=nil)
5
+ def self.init(amiId=nil,options=nil)
4
6
  Mccloud::Generators.run_cli Dir.pwd, File.basename(__FILE__), Mccloud::VERSION, ARGV
5
7
  end
6
8
  end
@@ -14,7 +14,7 @@ module Mccloud
14
14
  instance=vm.instance
15
15
  if instance.state == "running"
16
16
  ip2name[instance.public_ip_address]=vm.name
17
- session.use "#{instance.public_ip_address}", { :user => vm.user , :keys => [ vm.key ], :paranoid => false, :keys_only => true}
17
+ session.use "#{instance.public_ip_address}", { :user => vm.user , :keys => [ vm.private_key ], :paranoid => false, :keys_only => true}
18
18
  end
19
19
  end
20
20
 
@@ -6,7 +6,7 @@ module Mccloud
6
6
  def provision(selection=nil,options=nil)
7
7
  on_selected_machines(selection) do |id,vm|
8
8
  instance=vm.instance
9
- instance.private_key_path=vm.key
9
+ instance.private_key_path=vm.private_key
10
10
  instance.username = vm.user
11
11
 
12
12
  #p vm.provisioner
@@ -11,7 +11,7 @@ module Mccloud
11
11
  public_ip_address=vm.instance.public_ip_address
12
12
  private_ip_address=vm.instance.private_ip_address
13
13
  unless public_ip_address.nil? || private_ip_address.nil?
14
- ssh_options={ :keys => [ vm.key ], :paranoid => false, :keys_only => true}
14
+ ssh_options={ :keys => [ vm.private_key ], :paranoid => false, :keys_only => true}
15
15
  Net::SSH.start(public_ip_address, vm.user, ssh_options) do |ssh|
16
16
  vm.forwardings.each do |forwarding|
17
17
  puts "forwarding port #{forwarding.remote} from #{vm.name} to local port #{forwarding.local}"
@@ -23,7 +23,7 @@ module Mccloud
23
23
  end
24
24
 
25
25
  #https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/ssh.rb
26
- options={ :port => 22, :private_key_path => vm.key,
26
+ options={ :port => 22, :private_key_path => vm.private_key,
27
27
  :username => vm.user , :host => vm.instance.public_ip_address }
28
28
  # Command line options
29
29
  command_options = ["-p #{options[:port]}", "-o UserKnownHostsFile=/dev/null",
@@ -14,7 +14,15 @@ module Mccloud
14
14
  provider_options=vm.provider_options
15
15
  boxname=vm.name
16
16
  puts "Spinning up a new machine called #{boxname}"
17
- instance=provider.servers.create(provider_options)
17
+
18
+ provider_options=provider_options.merge({ :private_key_path => vm.private_key , :public_key_path => vm.public_key, :username => vm.user})
19
+
20
+ #pp provider_options
21
+ instance=provider.servers.bootstrap(provider_options)
22
+
23
+ #instance=provider.servers.create(provider_options)
24
+ #instance=provider.servers.create(provider_options)
25
+
18
26
  puts "Waiting for it the machine to become accessible"
19
27
  instance.wait_for { printf "."; STDOUT.flush; ready?}
20
28
  puts
@@ -54,7 +62,6 @@ module Mccloud
54
62
 
55
63
  @session.provision(selection,options)
56
64
 
57
- #server.boostrap(:image_id => 'ami', :private_key_path => '', :public_key_path => '')
58
65
  end
59
66
 
60
67
 
@@ -11,10 +11,10 @@ module Mccloud
11
11
 
12
12
  desc <<-DESC
13
13
  Initialize a mccloud environment
14
- mccloud init [AMI-ID]
14
+ mccloud init
15
15
  DESC
16
16
 
17
- first_argument :ami_id, :required => true, :desc => 'AMI ID'
17
+ # first_argument :ami_id, :required => true, :desc => 'AMI ID'
18
18
 
19
19
  template :mccloudfile, 'Mccloudfile'
20
20
 
@@ -43,7 +43,7 @@ module Mccloud
43
43
  end
44
44
 
45
45
  puts "Running chef-solo"
46
- options={ :port => 22, :keys => [ vm.key ], :paranoid => false, :keys_only => true}
46
+ options={ :port => 22, :keys => [ vm.private_key ], :paranoid => false, :keys_only => true}
47
47
  Mccloud::Util.ssh(vm.instance.public_ip_address,vm.user,options,"sudo chef-solo -c /tmp/solo.rb -j /tmp/dna.json -l debug")
48
48
 
49
49
  end
@@ -30,7 +30,7 @@ module Mccloud
30
30
  vm.instance.scp(@manifest_file,"#{@pp_path}/manifest.pp")
31
31
 
32
32
  puts "Running puppet"
33
- options={ :port => 22, :keys => [ vm.key ], :paranoid => false, :keys_only => true}
33
+ options={ :port => 22, :keys => [ vm.private_key ], :paranoid => false, :keys_only => true}
34
34
  Mccloud::Util.ssh(vm.instance.public_ip_address,vm.user,options,"sudo puppet #{@pp_path}/manifest.pp")
35
35
 
36
36
  end
@@ -24,7 +24,7 @@ Mccloud::Config.run do |config|
24
24
  web_config.vm.forward_port("http", 80, 8080)
25
25
  web_config.vm.user="ubuntu"
26
26
  web_config.vm.bootstrap="ruby-bootstrap.sh"
27
- web_config.vm.key="my-ec2-key.pem"
27
+ web_config.vm.private_key="my-ec2-key.pem"
28
28
  end
29
29
 
30
30
  ### Provisioners
@@ -8,7 +8,8 @@ module Mccloud
8
8
  attr_accessor :provider_options
9
9
  attr_accessor :name
10
10
  attr_accessor :user
11
- attr_accessor :key
11
+ attr_accessor :private_key
12
+ attr_accessor :public_key
12
13
  attr_accessor :bootstrap
13
14
  attr_accessor :provisioner
14
15
  attr_accessor :forwardings
@@ -2,7 +2,7 @@ require "pty"
2
2
  module Mccloud
3
3
  module Util
4
4
  def self.rsync(path,vm,instance)
5
- command="rsync --delete -avz -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \"#{vm.key}\"' '#{path}/' '#{vm.user}@#{instance.public_ip_address}:/tmp/#{File.basename(path)}/'"
5
+ command="rsync --delete -avz -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i \"#{vm.private_key}\"' '#{path}/' '#{vm.user}@#{instance.public_ip_address}:/tmp/#{File.basename(path)}/'"
6
6
  puts command
7
7
  begin
8
8
  PTY.spawn( command ) do |r, w, pid|
@@ -1,3 +1,3 @@
1
1
  module Mccloud
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mccloud
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Debois