I am trying to use Chef to install R onto windows 7.
I installed chef_handler and windows using knife
knife cookbook site install windows
knife cookbook site install chef_handler
and created a new cookbook
chef generate cookbook cookbooks/awesome_machine_config
inside default.rb I have
windows_package 'R for Windows 3.3.2' do
source 'd:/Downloads/R-3.3.2-win.exe'
action :install
end
inside metadata.rb
I have:
depends 'windows'
when I run:
chef-client --local-mode recipe[awesome_machine_config]
It synchronises the cookbooks fine and installs the cookbook gems fine.
But then I get a:
Error executing action `install` on resource 'windows_package[R for Windows 3.3.2]'
Encoding::InvalidByteSequenceError
incomplete "\x00" on UTF-16LE
chef is running as administrator so shouldn' be a permissions fault?
Any ideas how to debug?
Related
So I am new to chef and want to use chef-patch in my own recipes. I added cookbook 'patch', '~> 2.2.1' to my Berksfile and did sudo berks install
and it installs it. But when I run my recipe it says ERROR: undefined method 'replace' for #<Chef::Recipe:0x00000003cab450>
Is there something I need to add to my fix.rb code.
replace "/etc/login.defs" do
replace "PASS_MAX_DAYS 60"
with "PASS_MAX_DAYS 59"
end
There is no direct link between Berkshelf and either of those. You need to use berks upload to send things to the Chef server for use with chef-client, and for chef-solo the workflow is up to you (though will probably involve berks vendor to write the cookbooks out at some point). You also need depends 'patch' in your metadata.rb.
I want to configure an evirinment to take Django lessons from enter link description here
The main problem that I'm getting errors with instalation of some Ruby gems.
At first I've got an error that told that mixlib is not installed because it requires ruby 1.9.3.
So, I've changed 11th string of the postinstall.sh file like this
The version of Ruby to be installed supporting the Chef and Puppet gems
ruby_ver="1.9.3-p429"
So then I've rerun postinstall.sh script. But I've got an error
ERROR: Error installing chef:
ohai requires Ruby version >= 2.0.0.
To fix that I've installed Ruby 2.1 and set it to use by default, then installed chef.
After I've logoff, run vagrant ssh, typed the pass. The inputed ls and there weren't synced files from host machine. I've run sudo ./postinstall.sh again and got the ohai version error.
Is there any ideas how to fix it?
That example is badly out of date with the following list of problems:
Chef is now installed using an omnibus package which contains an
embedded ruby. No more mucking around with gem installs.
Vagrant now supports a chef zero provisioner, big improvement over chef-solo and will also install chef.
Old format Vagrantfile. V2 has introduced a number of incompatible changes.
That example uses Ubuntu 12.04 which is no longer supported.
The "aws" cookbook under the "cookbooks" directory has invalid metadata causing chef to fail.... In fact all the cookbooks look out of date.
==> default: [2015-04-11T20:04:06+00:00] ERROR: Cookbook loaded at path(s) [/tmp/vagrant-chef/046103d02209a201a2d21ece6c21437c/cookbooks/aws] has invalid metadata: The `name' attribute is required in cookbook metadata
Tutorial needs a substantial re-write, sorry. (If the code was in github that might encourage others to help refactor it)
Ok, I'm trying to update chef-client with vagrant omnibus and proxyconf. I figured it would pull the proxy from the proxyconf, but it doesn't look that way. Here is my plugin list:
vagrant plugin list
vagrant-login (1.0.1, system)
vagrant-omnibus (1.4.1)
- Version Constraint: 1.4.1
vagrant-proxyconf (1.3.2)
- Version Constraint: 1.3.2
vagrant-share (1.1.0, system)
and my Vagrant file:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.omnibus.chef_version = :latest
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "my proxy"
config.proxy.https = "my proxy"
end
When i run it with vagrant up, the machine does not have an updated chef-client. I tried using the recipe[omnibus_updater] in my run list it still fails because another recipe is failing with a compile failure (because of the older version of chef-client, what a pain in the butt). Any ideas? Other than creating a new virtual box?
Update:
Running in debug mode doesn't show any errors using :latest. Updating to 11.12.8 gives the below error
vagrant-omnibus:
* '11.12.8' is not a valid version of Chef.
Logging into the vm shows $HTTP_PROXY and $HTTPS_PROXY set properly. Running the commands on the built vm works:
chef-client -v
Chef: 10.14.2
sudo gem update chef
chef-client -v
Chef: 11.12.8
Thing 1:
:latest does not error out when it fails to grab the artifact. Switching to a named version starts to fail to find the artifact which leads me to believe that it isn't getting through the proxy.
Thing 2:
I think this is a problem with omnibus in windows. I've found this pull that may fix it? https://github.com/schisamo/vagrant-omnibus/pull/89. I think this plug-in isn't using the settings set by poxy-conf.
CURRENTLY USING THIS WORKAROUND:
Set you http proxy in the windows cmd line
SET HTTP_PROXY=http://username:password#proxy:port
I'm trying to install the gems "sensu_plugin" and "mixlib-shellout", on a windows server 2008r2, from a recipe. In this last one, I have the following code :
%w{ sensu-plugin mixlib-shellout }.each do |gem_plugin|
gem_package gem_plugin do
gem_binary("C:/opt/sensu/embedded/bin/gem")
options("--no-rdoc --no-ri")
action :install
end
end
Yet, when running the recipe on my machine, I receive the error "ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - U:/". What I found out is that whenever I try installing a gem package using the gem binary located in the chef-client directory (C:\opscode\chef\embedded\bin\gem), it raised this last error.
The thing is that the gem I wish to use to installed the gem packages is actually located in C:/opt/sensu/embedded/bin/gem, which I have declared in the gem_binary option.
In the end it looks like chef is ignoring the gem_binary option and trying to install it from its own gem binary.
I can't see what's wrong with this config. Is the gem_binary really indicating what binary to use?
I am using Vagrant to create a development server locally. I am writing my own Chef recipe to install everything I need but I am running into problems.
Pear will not install as I think it is trying to pull down a version that is not stable. The error is:
No such file or directory - pear -d preferred_state=stable search PEAR
The recipe is as follows
#
# Chef recipe for provisioning a LAMP
# development server.
#
require_recipe 'apt'
require_recipe 'apache2'
require_recipe 'apache2::mod_php5'
require_recipe 'php::module_gd'
require_recipe 'mysql::server'
php_pear "PEAR" do
action :upgrade
end
php_pear "MDB2" do
action :install
end
php_pear "MDB2#mysql" do
action :install
end
# Grant access to this box...
ruby_block "Create database + execute grants" do
block do
require 'rubygems'
Gem.clear_paths
require 'mysql'
m = Mysql.new('localhost', "root", node[:mysql][:server_root_password])
m.query("GRANT ALL ON *.* TO 'root'#'10.0.0.1' IDENTIFIED BY '#{node[:mysql][:server_root_password]}'")
m.query('FLUSH PRIVILEGES')
end
end
How can I make PEAR install the last stable version?
You are using pear to install pear itself? Isn't that strange?
The error message
No such file or directory
indicates that your recipe tries to use the full command as one executable, not as command and parameters.
pear -d preferred_state=stable search PEAR
Here's what I'm doing to upgrade PEAR in my Ubuntu VM:
package "php-pear" do
action :install
end
There's an Ubuntu package called php-pear, so this command will install the latest version