mccloud 0.0.15 → 0.0.16
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/README.md +3 -2
- data/lib/mccloud/command/bootstrap.rb +1 -1
- data/lib/mccloud/config.rb +1 -4
- data/lib/mccloud/provider/core/vm/rsync.rb +16 -1
- data/lib/mccloud/provider/host/vm/scp.rb +17 -22
- data/lib/mccloud/provisioner/puppet.rb +0 -1
- data/lib/mccloud/util/platform.rb +4 -0
- data/lib/mccloud/version.rb +1 -1
- metadata +4 -5
- data/lib/mccloud/util/rsync.rb +0 -25
data/README.md
CHANGED
@@ -165,7 +165,7 @@ Usefull if your cloud doesn't have an ip, but you can create start,stop, etc...
|
|
165
165
|
|
166
166
|
end
|
167
167
|
|
168
|
-
### Provider kvm
|
168
|
+
### Provider kvm (might not work out of the box)
|
169
169
|
|
170
170
|
this works together with veewee that support creating kvm template machines.
|
171
171
|
Like on vagrant, mccloud clones a veewee created vm
|
@@ -331,7 +331,8 @@ The mounting we then do our provision.sh script:
|
|
331
331
|
end
|
332
332
|
|
333
333
|
|
334
|
-
### Vmfusion
|
334
|
+
### Vmfusion vm
|
335
|
+
need to check this
|
335
336
|
|
336
337
|
## Provisioners
|
337
338
|
|
@@ -10,7 +10,7 @@ module Mccloud
|
|
10
10
|
def execute
|
11
11
|
env.load!
|
12
12
|
env.config.providers.each do |name,provider|
|
13
|
-
env.logger.debug("Asking provider #{name} to
|
13
|
+
env.logger.debug("Asking provider #{name} to boostrap box #{box_name}")
|
14
14
|
provider.bootstrap(box_name,command,options)
|
15
15
|
end
|
16
16
|
end
|
data/lib/mccloud/config.rb
CHANGED
@@ -85,10 +85,7 @@ module Mccloud
|
|
85
85
|
# http://www.dan-manges.com/blog/ruby-dsls-instance-eval-with-delegation
|
86
86
|
instance_eval(mccloud_file)
|
87
87
|
rescue LoadError => e
|
88
|
-
raise ::Mccloud::Error, "Error
|
89
|
-
env.ui.error "Error loading configfile - Sorry"
|
90
|
-
env.ui.error e.message
|
91
|
-
exit -1
|
88
|
+
raise ::Mccloud::Error, "Error loading configfile - Sorry: #{e.message}"
|
92
89
|
rescue NoMethodError => e
|
93
90
|
raise ::Mccloud::Error, "Some method got an error in the configfile - Sorry\n#{$!}\n#{e.message}"
|
94
91
|
rescue Errno::ENOENT => e
|
@@ -20,6 +20,21 @@ module Mccloud::Provider
|
|
20
20
|
rsync(clean_src_path,dest,options)
|
21
21
|
end
|
22
22
|
|
23
|
+
def windows_client?
|
24
|
+
::Mccloud::Util::Platform.windows?
|
25
|
+
end
|
26
|
+
|
27
|
+
# cygwin rsync path must be adjusted to work
|
28
|
+
def adjust_rsync_path(path)
|
29
|
+
return path unless windows_client?
|
30
|
+
path.gsub(/^(\w):/) { "/cygdrive/#{$1}" }
|
31
|
+
end
|
32
|
+
|
33
|
+
# see http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
|
34
|
+
def rsync_permissions
|
35
|
+
'--chmod=ugo=rwX' if windows_client?
|
36
|
+
end
|
37
|
+
|
23
38
|
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/185404
|
24
39
|
# This should work on windows too now
|
25
40
|
# This will result in a ShellResult structure with stdout, stderr and status
|
@@ -40,7 +55,7 @@ module Mccloud::Provider
|
|
40
55
|
exit -1
|
41
56
|
end
|
42
57
|
|
43
|
-
command="rsync --exclude '.DS_Store' --exclude '.hg' --exclude '.git' #{mute} --delete-excluded --delete -az -e 'ssh #{ssh_commandline_options(options)}' '#{src}' '#{@user}@#{self.ip_address}:#{dest_path}'"
|
58
|
+
command="rsync #{rsync_permissions} --exclude '.DS_Store' --exclude '.hg' --exclude '.git' #{mute} --delete-excluded --delete -az -e 'ssh #{ssh_commandline_options(options)}' '#{adjust_rsync_path(src)}' '#{@user}@#{self.ip_address}:#{dest_path}'"
|
44
59
|
else
|
45
60
|
env.ui.info "[#{@name}] - rsync error: #{src} does no exist"
|
46
61
|
exit
|
@@ -7,29 +7,24 @@ module Mccloud::Provider
|
|
7
7
|
scp(src,dest,options)
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
def scp(src,dest,options = {})
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Net::SCP.start(ip_address,options[:user],:port => options[:port]) do |auth_scp|
|
20
|
-
auth_scp.upload!(src,dest)
|
21
|
-
end
|
22
|
-
end
|
12
|
+
# override options from Mccloudfile with parameter options
|
13
|
+
ssh_options = mccloudfile_options.merge(options)
|
14
|
+
|
15
|
+
Net::SCP.start(ip_address,ssh_options[:user],ssh_options) do |auth_scp|
|
16
|
+
auth_scp.upload!(src,dest)
|
17
|
+
end
|
18
|
+
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
20
|
+
def mccloudfile_options
|
21
|
+
opts = Hash.new
|
22
|
+
(opts[:user] = @user) if @user
|
23
|
+
(opts[:keys] = @private_key_path) if @private_key_path
|
24
|
+
(opts[:port] = @port) if @port
|
25
|
+
opts
|
31
26
|
end
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
end #module
|
29
|
+
end #module
|
30
|
+
end #module
|
data/lib/mccloud/version.rb
CHANGED
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:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 16
|
10
|
+
version: 0.0.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Debois
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-02-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -422,7 +422,6 @@ files:
|
|
422
422
|
- lib/mccloud/ui.rb
|
423
423
|
- lib/mccloud/util/platform.rb
|
424
424
|
- lib/mccloud/util/rostruct.rb
|
425
|
-
- lib/mccloud/util/rsync.rb
|
426
425
|
- lib/mccloud/util/ssh.rb
|
427
426
|
- lib/mccloud/util/sshkey.rb
|
428
427
|
- lib/mccloud/version.rb
|
data/lib/mccloud/util/rsync.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require "pty"
|
2
|
-
module Mccloud
|
3
|
-
module Util
|
4
|
-
def self.rsync(path,vm,instance)
|
5
|
-
unless !File.exists?(path)
|
6
|
-
env.logger.info "[#{vm.name}] - rsyncing #{path}"
|
7
|
-
command="rsync --exclude='.DS_Store' --exclude='.git' --exclude='.hg' --delete --delete-excluded -az -e 'ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i \"#{vm.private_key}\"' '#{path}/' '#{vm.user}@#{instance.public_ip_address}:/tmp/#{File.basename(path)}/'"
|
8
|
-
else
|
9
|
-
raise Mccloud::Error, "[#{vm.name}] - rsync error: #{path} does no exist"
|
10
|
-
end
|
11
|
-
begin
|
12
|
-
PTY.spawn( command ) do |r, w, pid|
|
13
|
-
begin
|
14
|
-
r.each { |line| print line;}
|
15
|
-
rescue Errno::EIO
|
16
|
-
end
|
17
|
-
end
|
18
|
-
rescue PTY::ChildExited => e
|
19
|
-
puts "The child process exited!"
|
20
|
-
end
|
21
|
-
#Kernel.exec(command)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|