vagrant-omnibus 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ bundler_args: --without=acceptance
2
3
  rvm:
3
4
  - 1.9.3
4
5
  script: rake test:unit
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 1.1.2 (October 17, 2013)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ * PR [#41][]: Add vagrant-digitalocean to the list of supported providers. ([@tmatilai][])
6
+ * PR [#45][]: Compatibility with vagrant-aws v0.4.0 ([@tmatilai][])
7
+ * Use Vagrant's built in `Vagrant::Util::Downloader` class; removes requirement of the
8
+ guest OS having `wget` or `curl` installed. ([@schisamo][])
9
+
10
+ BUG FIXES:
11
+
12
+ * PR [#43][]: Fix development dependencies and Travis tests. ([@tmatilai][])
13
+ * Issue [#33][] Split fetching of `install.sh` from the actual execution ([@schisamo][])
14
+
1
15
  ## 1.1.1 (September 4, 2013)
2
16
 
3
17
  BUG FIXES:
@@ -66,8 +80,12 @@ BUG FIXES:
66
80
  [#28]: https://github.com/schisamo/vagrant-omnibus/issues/28
67
81
  [#31]: https://github.com/schisamo/vagrant-omnibus/issues/31
68
82
  [#32]: https://github.com/schisamo/vagrant-omnibus/issues/32
83
+ [#33]: https://github.com/schisamo/vagrant-omnibus/issues/33
69
84
  [#37]: https://github.com/schisamo/vagrant-omnibus/issues/37
70
85
  [#38]: https://github.com/schisamo/vagrant-omnibus/issues/38
86
+ [#41]: https://github.com/schisamo/vagrant-omnibus/issues/41
87
+ [#43]: https://github.com/schisamo/vagrant-omnibus/issues/43
88
+ [#45]: https://github.com/schisamo/vagrant-omnibus/issues/45
71
89
  [@matsu911]: https://github.com/matsu911
72
90
  [@michfield]: https://github.com/michfield
73
91
  [@petecheslock]: https://github.com/petecheslock
data/Gemfile CHANGED
@@ -6,13 +6,13 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.2.7"
9
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.3.5"
10
10
  end
11
11
 
12
- group :test do
13
- gem "vagrant-digitalocean", "~> 0.3.0"
14
- gem "vagrant-aws", "~> 0.3.0"
15
- gem "vagrant-rackspace", "~> 0.1.2"
12
+ group :acceptance do
13
+ gem "vagrant-digitalocean", "~> 0.4.0"
14
+ gem "vagrant-aws", "~> 0.4.0"
15
+ gem "vagrant-rackspace", "~> 0.1.4"
16
16
  end
17
17
 
18
18
  group :docs do
data/README.md CHANGED
@@ -21,6 +21,7 @@ known to work with the following
21
21
  * VMWare Fusion (can be [purchased from Hashicorp](http://www.vagrantup.com/vmware))
22
22
  * LXC (ships in [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc))
23
23
  * OpenStack (ships in [vagrant-openstack-plugin](https://github.com/cloudbau/vagrant-openstack-plugin))
24
+ * Digital Ocean (ships in [vagrant-digitalocean](https://github.com/smdahlen/vagrant-digitalocean))
24
25
 
25
26
  ## Installation
26
27
 
@@ -14,8 +14,11 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require "log4r"
17
18
  require 'shellwords'
18
19
 
20
+ require "vagrant/util/downloader"
21
+
19
22
  module VagrantPlugins
20
23
  module Omnibus
21
24
  module Action
@@ -28,6 +31,7 @@ module VagrantPlugins
28
31
 
29
32
  def initialize(app, env)
30
33
  @app = app
34
+ @logger = Log4r::Logger.new("vagrantplugins::omnibus::action::installchef")
31
35
  @machine = env[:machine]
32
36
  # Config#finalize! SHOULD be called automatically
33
37
  @machine.config.omnibus.finalize!
@@ -45,10 +49,12 @@ module VagrantPlugins
45
49
  :version => desired_version
46
50
  })
47
51
  else
52
+ fetch_install_sh(env)
48
53
  env[:ui].info I18n.t('vagrant-omnibus.action.installing', {
49
54
  :version => desired_version
50
55
  })
51
- install(desired_version)
56
+ install(desired_version, env)
57
+ recover(env)
52
58
  end
53
59
  end
54
60
  end
@@ -64,19 +70,65 @@ module VagrantPlugins
64
70
  version
65
71
  end
66
72
 
67
- def install(version)
73
+ # Uploads install.sh from Host's Vagrant TMP directory to guest
74
+ # and executes.
75
+ def install(version, env)
68
76
  shell_escaped_version = Shellwords.escape(version)
69
- command = <<-INSTALL_OMNIBUS
70
- if command -v wget &>/dev/null; then
71
- wget -qO- #{INSTALL_SH} | bash -s -- -v #{shell_escaped_version}
72
- elif command -v curl &>/dev/null; then
73
- curl -L #{INSTALL_SH} | bash -s -- -v #{shell_escaped_version}
74
- else
75
- echo "Neither wget nor curl found. Please install one." >&2
76
- exit 1
77
- fi
78
- INSTALL_OMNIBUS
79
- @machine.communicate.sudo(command)
77
+
78
+ @machine.communicate.tap do |comm|
79
+ comm.upload(@install_sh_temp_path, "install.sh")
80
+ # TODO - Execute with `sh` once install.sh removes it's bash-isms.
81
+ comm.sudo("bash install.sh -v #{shell_escaped_version} 2>&1") do |type, data|
82
+ if [:stderr, :stdout].include?(type)
83
+ next if data =~ /stdin: is not a tty/
84
+ env[:ui].info(data)
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ # Fetches install.sh file to the Host's Vagrant TMP directory.
91
+ #
92
+ # Mostly lifted from:
93
+ #
94
+ # https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/action/builtin/box_add.rb
95
+ #
96
+ def fetch_install_sh(env)
97
+ @install_sh_temp_path = env[:tmp_path].join(Time.now.to_i.to_s + "-install.sh")
98
+ @logger.info("Downloading install.sh to: #{@install_sh_temp_path}")
99
+
100
+ url = INSTALL_SH
101
+ if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i
102
+ @logger.info("URL is a file or protocol not found and assuming file.")
103
+ file_path = File.expand_path(url)
104
+ file_path = Vagrant::Util::Platform.cygwin_windows_path(file_path)
105
+ url = "file:#{file_path}"
106
+ end
107
+
108
+ downloader_options = {}
109
+ # downloader_options[:insecure] = env[:box_download_insecure]
110
+ # downloader_options[:ui] = env[:ui]
111
+
112
+ # Download the install.sh file to a temporary path. We store
113
+ # the temporary path as an instance variable so that the
114
+ # `#recover` method can access it.
115
+ begin
116
+ downloader = Vagrant::Util::Downloader.new(url,
117
+ @install_sh_temp_path,
118
+ downloader_options)
119
+ downloader.download!
120
+ rescue Vagrant::Errors::DownloaderInterrupted
121
+ # The downloader was interrupted, so just return, because that
122
+ # means we were interrupted as well.
123
+ env[:ui].info(I18n.t("vagrant-omnibus.download.interrupted"))
124
+ return
125
+ end
126
+ end
127
+
128
+ def recover(env)
129
+ if @install_sh_temp_path && File.exist?(@install_sh_temp_path)
130
+ File.unlink(@install_sh_temp_path)
131
+ end
80
132
  end
81
133
  end
82
134
  end
@@ -34,12 +34,12 @@ module VagrantPlugins
34
34
  require_relative "action/install_chef"
35
35
  hook.after(Vagrant::Action::Builtin::Provision, Action::InstallChef)
36
36
 
37
- # The AWS provider uses a non-standard Provision action on initial
37
+ # The AWS provider < v0.4.0 uses a non-standard Provision action on initial
38
38
  # creation:
39
39
  #
40
- # https://github.com/mitchellh/vagrant-aws/blob/master/lib/vagrant-aws/action.rb#L105
40
+ # https://github.com/mitchellh/vagrant-aws/blob/v0.3.0/lib/vagrant-aws/action.rb#L105
41
41
  #
42
- if VagrantPlugins.const_defined?("AWS")
42
+ if defined? VagrantPlugins::AWS::Action::TimedProvision
43
43
  hook.after(VagrantPlugins::AWS::Action::TimedProvision, Action::InstallChef)
44
44
  end
45
45
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module VagrantPlugins
18
18
  module Omnibus
19
- VERSION = "1.1.1"
19
+ VERSION = "1.1.2"
20
20
  end
21
21
  end
data/locales/en.yml CHANGED
@@ -3,3 +3,6 @@ en:
3
3
  action:
4
4
  installed: "Chef %{version} Omnibus package is already installed."
5
5
  installing: "Installing Chef %{version} Omnibus package..."
6
+ download:
7
+ downloading: "Downloading or copying install.sh..."
8
+ interrupted: "Install.sh download was interrupted. Exiting."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-04 00:00:00.000000000 Z
12
+ date: 2013-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -1765446916124495526
111
+ hash: -3817557058599650856
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: -1765446916124495526
120
+ hash: -3817557058599650856
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.23