Sha256: 55acb259c296fa5486e2bfc3c586f220d7b941008c70cf8c6d5a3ead1cb35969

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

module VagrantPlugins
  module Chef
    module Cap
      module Windows
        module ChefInstalled
          # Check if Chef is installed at the given version.
          # @return [true, false]
          def self.chef_installed(machine, version)
            if version != :latest
              command = 'if ((&knife --version) -Match "Chef: ' + version.to_s + '"){ exit 0 } else { exit 1 }'
            else
              command = 'if ((&knife --version) -Match "Chef: *"){ exit 0 } else { exit 1 }'
            end
            machine.communicate.test(command, sudo: true)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-unbundled-1.8.1.2 plugins/provisioners/chef/cap/windows/chef_installed.rb
vagrant-unbundled-1.8.1.1 plugins/provisioners/chef/cap/windows/chef_installed.rb