Skip to content

Commit

Permalink
Merge pull request #39 from petems/fix_nil_errors
Browse files Browse the repository at this point in the history
Fix nil errors
  • Loading branch information
petems committed Jan 25, 2016
2 parents 72ee40e + d43dff5 commit 6dc482e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/vagrant-puppet-install/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ def finalize!
elsif @puppet_version.to_s == 'latest'
# resolve `latest` to a real version
@puppet_version = retrieve_latest_puppet_version
elsif valid_puppet_version?(puppet_version)
# allows for pessimistic version constraint
@puppet_version = retrieve_latest_puppet_version(puppet_version)
end
@install_url = nil if @install_url == UNSET_VALUE
end
Expand Down Expand Up @@ -51,9 +48,9 @@ def validate!(machine)
private

# Query RubyGems.org's Ruby API and retrive the latest version of Puppet.
def retrieve_latest_puppet_version(version = nil)
def retrieve_latest_puppet_version
available_gems =
dependency_installer.find_gems_with_sources(puppet_gem_dependency(version))
dependency_installer.find_gems_with_sources(puppet_gem_dependency)
spec, _source =
if available_gems.respond_to?(:last)
# DependencyInstaller sorts the results such that the last one is
Expand Down
5 changes: 5 additions & 0 deletions test/acceptance/virtualbox/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ require 'vagrant-puppet-install'

Vagrant.configure("2") do |config|

config.vm.define :no_config_set do |no_config_set|
no_config_set.vm.box = "ubuntu/trusty64"
no_config_set.vm.provision "shell", inline: "echo 'Should still work with no puppet plugin enabled'"
end

config.vm.define :trusty_ubuntu_box do |trusty_ubuntu_box|
trusty_ubuntu_box.puppet_install.puppet_version = :latest
trusty_ubuntu_box.puppet_install.install_url = 'https://gist.githubusercontent.com/petems/6723c2eedb9d32d7ad97/raw/990ff448f6430aa015e208668a3cecb3f1db0d4b/purge_old_install_new.sh'
Expand Down
1 change: 1 addition & 0 deletions vagrant-puppet-install.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", "~> 10.1.1"
spec.add_development_dependency "rspec", "~> 2.14.1"
spec.add_development_dependency "rubocop", "~> 0.17.0"
spec.add_development_dependency "pry"
end

0 comments on commit 6dc482e

Please sign in to comment.