opennebula-provider 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 753be50194ecd2d0c573840a7fb997ab622b62cb
4
- data.tar.gz: 9e77a6f1d671f31a0386364382f49a8ba1bbc9b0
3
+ metadata.gz: d7cb6962f3a15c06a587d0facb4dfb8d9fc0b920
4
+ data.tar.gz: 3c5e3590dcff842f5c8c39e19cc10120f90a0c85
5
5
  SHA512:
6
- metadata.gz: bccbbe688599ee01de187e781d7772f9b1bbabe6e07ef3238fc66f37c5aa62887a6af39d7c7587d03e0db210f0e8dd52363b119d4e700c91192ac5019ce9206d
7
- data.tar.gz: e8ec8dafdb2fc509dd0679d758f3f4d7a39f67eb2fdbc68cb67b35a25171fbaea8cc29f781694699624ac4727fbec1ff149b65cfc7c836f1d07245831a6a96a4
6
+ metadata.gz: 4927b9168112e605ef83f8708877589e257f462b40a91dc9361f35019d90b13e95910142b1e808618514a741b114d6a6d806b514232f43e2832f68707252a17e
7
+ data.tar.gz: 9d02b553bc764ecbe055e1276d6614ee32171178ccc5459d7b1cfa31d591f9d7deef853e3ca89996e5e9df8c040e08623d17d92171c2abddef36679fd5acd2f0
@@ -4,7 +4,6 @@ require_relative 'action/destroy'
4
4
  require_relative 'action/messages'
5
5
  require_relative 'action/read_ssh_info'
6
6
  require_relative 'action/resume'
7
- require_relative 'action/sync_folders'
8
7
  require_relative 'action/start'
9
8
  require_relative 'action/stop'
10
9
  require_relative 'action/suspend'
@@ -45,6 +44,7 @@ module VagrantPlugins
45
44
  case env[:machine_state]
46
45
  when :active
47
46
  b1.use MessageAlreadyCreated
47
+ next
48
48
  when :suspended
49
49
  # TODO: uncomment this with patching fog
50
50
  # b1.use Resume
@@ -57,6 +57,7 @@ module VagrantPlugins
57
57
  next
58
58
  end
59
59
  b1.use WaitForCommunicator, [:pending, :prolog, :boot, :active]
60
+ b1.use SyncedFolders
60
61
  end
61
62
  end
62
63
  end
@@ -152,7 +153,6 @@ module VagrantPlugins
152
153
  b1.use MessageHalted
153
154
  else
154
155
  b1.use Provision
155
- b1.use SyncFolders
156
156
  end
157
157
  end
158
158
  end
@@ -29,9 +29,6 @@ module VagrantPlugins
29
29
  error_key(:quota)
30
30
  end
31
31
 
32
- class RsyncError < OpenNebulaProviderError
33
- error_key(:rsync)
34
- end
35
32
  end
36
33
  end
37
34
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OpenNebulaProvider
3
- VERSION = '1.0.5'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -35,11 +35,6 @@ en:
35
35
  Resuming instance...
36
36
  waiting_for_sshd: |-
37
37
  Instance is active, waiting for sshd daemon startup...
38
- rsyncing: |-
39
- Rsyncing folder: %{hostpath} => %{guestpath}...
40
- rsync_not_found_warning: |-
41
- Warning! Folder sync disabled because the rsync binary is missing in the %{side}.
42
- Make sure rsync is installed and the binary can be found in the PATH.
43
38
  error: |-
44
39
  The instance is in error state
45
40
 
@@ -120,5 +115,3 @@ en:
120
115
  Resource error! %{error}
121
116
  quota: |-
122
117
  Quota error! %{error}
123
- rsync: |-
124
- Rsync error! %{stderr}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cherdancev Evgeni
@@ -112,7 +112,6 @@ files:
112
112
  - lib/opennebula-provider/action/start.rb
113
113
  - lib/opennebula-provider/action/stop.rb
114
114
  - lib/opennebula-provider/action/suspend.rb
115
- - lib/opennebula-provider/action/sync_folders.rb
116
115
  - lib/opennebula-provider/action/wait_for_ssh.rb
117
116
  - lib/opennebula-provider/action/wait_for_state.rb
118
117
  - lib/opennebula-provider/config.rb
@@ -1,97 +0,0 @@
1
- require 'vagrant/util/subprocess'
2
- require 'vagrant/util/which'
3
-
4
- module VagrantPlugins
5
- module OpenNebulaProvider
6
- module Action
7
- class SyncFolders
8
- def initialize(app, env)
9
- @app = app
10
- @logger = Log4r::Logger.new('vagrant::provider::opennebula::sync_folders')
11
- end
12
-
13
- def call(env)
14
- @app.call(env)
15
-
16
- ssh_info = env[:machine].ssh_info
17
-
18
- unless Vagrant::Util::Which.which('rsync')
19
- env[:ui].warn(I18n.t('opennebula_provider.info.rsync_not_found_warning', side: 'host'))
20
- return
21
- end
22
-
23
- if env[:machine].communicate.execute('which rsync', error_check: false) != 0
24
- env[:ui].warn(I18n.t('opennebula_provider.info.rsync_not_found_warning', side: 'guest'))
25
- return
26
- end
27
-
28
- env[:machine].config.vm.synced_folders.each do |id, data|
29
- # Ignore disabled shared folders
30
- next if data[:disabled]
31
-
32
- hostpath = File.expand_path(data[:hostpath], env[:root_path])
33
- guestpath = data[:guestpath]
34
-
35
- # Make sure there is a trailing slash on the host path to
36
- # avoid creating an additional directory with rsync
37
- hostpath = "#{hostpath}/" if hostpath !~ /\/$/
38
-
39
- # on windows rsync.exe requires cygdrive-style paths
40
- if Vagrant::Util::Platform.windows?
41
- hostpath = hostpath.gsub(/^(\w):/) { "/cygdrive/#{$1}" }
42
- end
43
- env[:ui].info(I18n.t('opennebula_provider.info.rsyncing', hostpath: hostpath, guestpath: guestpath))
44
-
45
- # Create the host path if it doesn't exist and option flag is set
46
- if data[:create]
47
- begin
48
- FileUtils.mkdir_p(hostpath)
49
- rescue => err
50
- raise Errors::MkdirError,
51
- hostpath: hostpath,
52
- err: err
53
- end
54
- end
55
-
56
- # Create the guest path
57
- env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
58
- env[:machine].communicate.sudo(
59
- "chown -R #{ssh_info[:username]} '#{guestpath}'")
60
-
61
- # collect rsync excludes specified :rsync__exclude=>['path1',...] in synced_folder options
62
- excludes = ['.vagrant/', 'Vagrantfile', *Array(data[:rsync__exclude])].uniq
63
-
64
- # Rsync over to the guest path using the SSH info
65
- command = [
66
- 'rsync', '--verbose', '--archive', '-z',
67
- *excludes.map { |e| ['--exclude', e] }.flatten,
68
- '-e', "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{ssh_key_options(ssh_info)}",
69
- hostpath,
70
- "#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
71
-
72
- # we need to fix permissions when using rsync.exe on windows, see
73
- # http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
74
- if Vagrant::Util::Platform.windows?
75
- command.insert(1, '--chmod', 'ugo=rwX')
76
- end
77
-
78
- r = Vagrant::Util::Subprocess.execute(*command)
79
- if r.exit_code != 0
80
- fail Errors::RsyncError,
81
- guestpath: guestpath,
82
- hostpath: hostpath,
83
- stderr: r.stderr
84
- end
85
- end
86
- end
87
-
88
- private
89
-
90
- def ssh_key_options(ssh_info)
91
- # Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
92
- Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join
93
- end
94
- end
95
- end
96
- end
97
- end