Sha256: b0bd0aa93017bcf66a0a898be11204038dce21aab38efe016ad63ff912061de6

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 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, product, version)
            verify_bin = product == 'chef-workstation' ? 'chef' : 'chef-client'
            if version != :latest
              command = 'if ((&' + verify_bin + ' --version) -Match "' + version.to_s + '"){ exit 0 } else { exit 1 }'
            else
              command = 'if ((&' + verify_bin + ' --version) -Match "Chef*"){ exit 0 } else { exit 1 }'
            end
            machine.communicate.test(command, sudo: true)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/provisioners/chef/cap/windows/chef_installed.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/provisioners/chef/cap/windows/chef_installed.rb
vagrant-unbundled-2.3.3.0 plugins/provisioners/chef/cap/windows/chef_installed.rb
vagrant-unbundled-2.3.2.0 plugins/provisioners/chef/cap/windows/chef_installed.rb
vagrant-unbundled-2.2.19.0 plugins/provisioners/chef/cap/windows/chef_installed.rb