djoos-cookbooks / composer Goto Github PK
View Code? Open in Web Editor NEWRepository for composer cookbook
Home Page: http://community.opscode.com/cookbooks/composer
License: MIT License
Repository for composer cookbook
Home Page: http://community.opscode.com/cookbooks/composer
License: MIT License
I have 4 Red Hat Enterprise Linux Servers version 6.2
Goal:
1 server to be chef server (version 10.24.0 )
1 server to be haproxy server ( version 1.6.2 )
1 server to be apache tomcat (version latest)
1 server to be apache tomcat (version latest)
undefined local variable or method `use_inline_resources' for #Class:0x0000000226c288
/var/chef/cache/cookbooks/haproxy/providers/lb.rb:1:in `class_from_file'
/var/chef/cache/cookbooks/haproxy/providers/lb.rb:
1>> use_inline_resources
2:
3: action :create do
4: #While there is no way to have an include directive for haproxy
5: #configuration file, this provider will only modify attributes !
6: listener = []
7: listener << "bind #{new_resource.bind}" unless new_resource.bind.nil?
8: listener << "balance #{new_resource.balance}" unless new_resource.balance.nil?
9: listener << "mode #{new_resource.mode}" unless new_resource.mode.nil?
10: listener += new_resource.servers.map {|server| "server #{server}" }
[2014-03-21T12:11:37-05:00] ERROR: Running exception handlers
[2014-03-21T12:11:37-05:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[2014-03-21T12:11:37-05:00] ERROR: Exception handlers complete
[2014-03-21T12:11:37-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-03-21T12:11:37-05:00] FATAL: NameError: undefined local variable or method `use_inline_resources' for #Class:0x0000000226c288
Using it with AWS OpsWorks I have specified and installed php 5.5 on the machine already but when composer (this cookbook) requires php it tries to install an older version of php, error below:
Berksfile
source "https://supermarket.chef.io"
cookbook 'composer', '~> 2.2.0'
Log
[2015-09-12T12:10:18+00:00] INFO: ruby_block[Check that the ECS agent is running] called
[2015-09-12T12:10:18+00:00] INFO: Processing package[php] action install (php::package line 59)
[2015-09-12T12:10:18+00:00] INFO: package[php] installing php-5.3.29-1.8.amzn1 from amzn-updates repository
================================================================================
Error executing action `install` on resource 'package[php]'
================================================================================
Chef::Exceptions::Exec
----------------------
returned 1, expected 0
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/php/recipes/package.rb
59: package pkg do
60: action :install
61: options node['php']['package_options']
62: end
63: end
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/php/recipes/package.rb:59:in `block in from_file'
package("php") do
action [:install]
retries 0
retry_delay 2
package_name "php"
version "5.3.29-1.8.amzn1"
cookbook_name "php"
recipe_name "package"
end
[2015-09-12T12:10:21+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-09-12T12:10:21+00:00] ERROR: Running exception handlers
[2015-09-12T12:10:21+00:00] ERROR: Exception handlers complete
[2015-09-12T12:10:21+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2015-09-12T12:10:22+00:00] ERROR: package[php] (php::package line 59) had an error: Chef::Exceptions::Exec: returned 1, expected 0
[2015-09-12T12:10:22+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Hey,
i compile php myself with the "--disable-phar" flag.
The standard way of composer requires phar support.
It might be useful to add a check, before composer is installing, and throw a warning if phar support is not available.
Actual implementation of COMPOSER_HOME is not per user aware.
Create composer_home is not synced with env var and is not per user aware.
configs.each_pair do |user, user_configs|
directory "/home/#{user}/.composer" do
owner user
group user
mode 0755
action :create
end
# but later
environment 'COMPOSER_HOME' => Composer.home_dir(node)
So Composer.home_dir(node)
is global and does not match with /home/#{user}/.composer
With the default attribute:
default['composer']['url'] = 'http://getcomposer.org/composer.phar'
It's downloading the 2.0-dev
version of composer:
axel@ryzen:/tmp$ curl -s http://getcomposer.org/composer.phar -o composer.phar
axel@ryzen:/tmp$ php composer.phar --version
Composer version 2.0-dev (2.0-dev+8b0da77a1d5173f65b026d7475a1526bc29df939) 2020-04-09 08:48:48
I think having an unstable version of composer by default should not be the default behavior, so I suggest the attribute to be changed to:
default['composer']['url'] = 'https://getcomposer.org/composer-stable.phar
Case in point:
I'm running vagrant with an ubuntu guest.
If I'm not supplying any install_dir, it defaults to /usr/local/bin, which is a root user/group directory.
This means, the config and auth files will also be saved in /usr/local/bin as providers/project.rb treats the install_dir as COMPOSER_HOME.
So.. when you try to set any global config parameter, it tries to create the config.json file in /usr/local/bin, with the provided user (composer['global_config']['userX']...), which is not root.
This action of course fails.
Composer has global configuration feature.
By default, composer load config file $HOME/.composr/config.json
.
Scheme of config.json is described here: http://getcomposer.org/doc/04-schema.md#config
Detail of where to place config.json: http://getcomposer.org/doc/03-cli.md#composer-home
I suggest below:
global_configs
and global_config
attribute.global_config
is configuration for root (or user who execute chef).global_configs
is a hash of which key is username and value is configurationglobal_config
when install_globally
is false.global_configs
when install_globally
is true.Using symlink to chef cache is very bad idea.
Cache folder may be incompatible with the right to execute the file.
For example, I use chef-solo and run it from /root/chef folder.
Also, Acache folder becomes very important in the server. You have lost the ability to simply clear it.
I was setting like this:
chef.json = {
:composer => {
"global_configs" => {
"vagrant"=>{
"repositories"=> [
{ "packagist"=> false },
{
"type"=> "composer",
"url"=> "http://218.244.132.204/proxy/packagist"
}
]
}
}
}
}
but seems like It's not right, I got this error during provision:
==> my-project: Mixlib::ShellOut::ShellCommandFailed
==> my-project: ------------------------------------
==> my-project: Expected process to exit with [0], but received '2'
==> my-project: ---- Begin output of composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] ----
==> my-project: STDOUT:
==> my-project: STDERR: sh: 1: cannot create false},: Permission denied
==> my-project: ---- End output of composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] ----
==> my-project: Ran composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] returned 2
==> my-project:
==> my-project:
==> my-project: Resource Declaration:
==> my-project: ---------------------
==> my-project: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/composer/recipes/global_configs.rb
==> my-project:
==> my-project: 33: execute "composer-config-for-#{user}" do
==> my-project: 34: command "composer config --global #{option} #{value}"
==> my-project:
==> my-project: 35: environment 'COMPOSER_HOME' => node['composer']['install_dir']
==> my-project: 36: user user
==> my-project: 37: group user
==> my-project: 38: action :run
==> my-project: 39: end
==> my-project: 40: end
==> my-project:
==> my-project: Compiled Resource:
==> my-project: ------------------
==> my-project: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/composer/recipes/global_configs.rb:33:in `block (2 levels) in from_file'
==> my-project:
==> my-project: execute("composer-config-for-vagrant") do
==> my-project:
==> my-project: action [:run]
==> my-project: retries 0
==> my-project: retry_delay 2
==> my-project: guard_interpreter :default
==> my-project: command "composer config --global repositories [{\"packagist\"=>false}, {\"type\"=>\"composer\", \"url\"=>\"http://218.244.132.204/proxy/packagist\"}]"
==> my-project: backup 5
==> my-project: environment {"COMPOSER_HOME"=>"/usr/local/bin"}
==> my-project: group "vagrant"
==> my-project: returns 0
==> my-project: user "vagrant"
==> my-project: cookbook_name :composer
==> my-project: recipe_name "global_configs"
==> my-project: end
==> my-project:
==> my-project:
==> my-project:
==> my-project: [2014-10-15T03:26:41+00:00] INFO: Running queued delayed notifications before re-raising exception
==> my-project: [2014-10-15T03:26:41+00:00] ERROR: Running exception handlers
==> my-project: [2014-10-15T03:26:41+00:00] ERROR: Exception handlers complete
==> my-project: [2014-10-15T03:26:41+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> my-project: [2014-10-15T03:26:41+00:00] ERROR: execute[composer-config-for-vagrant] (composer::global_configs line 33) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
==> my-project: ---- Begin output of composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] ----
==> my-project: STDOUT:
==> my-project: STDERR: sh: 1: cannot create false},: Permission denied
==> my-project: ---- End output of composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] ----
==> my-project: Ran composer config --global repositories [{"packagist"=>false}, {"type"=>"composer", "url"=>"http://218.244.132.204/proxy/packagist"}] returned 2
==> my-project: [2014-10-15T03:26:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
could anyone tell me It's my fault or there's something wrong on this cookbook?
You should provide a way for see the release notes of each release.
You may use a CHANGELOG
file and or GitHub's release process or wiki pages.
Hi,
When running composer_project update on a project its running out of memory, see the extract below. Is there a parameter I can pass which ups the default memory allocation?
�[0m* composer_project[/u/current] action update
run
on resource 'execute[update-composer-for-project]'�[0m�[0m Mixlib::ShellOut::ShellCommandFailed�[0m
------------------------------------�[0m
Expected process to exit with [0], but received '255'
�[0m ---- Begin output of /usr/local/bin/composer update --no-interaction --no-ansi --no-dev ----
�[0m STDOUT: Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Decisions.php on line 40
Please can you update the opscode versions with the updated version of master that includes the change:
use_inline_resources if defined?(use_inline_resources)
Hi all,
Not sure if it's a documentation issue or a code issue, but I thought I should let you guys know about it.
true and false are not acceptable values as documented in the examples, one must use TrueClass or FalseClass.
Chef::Exceptions::ValidationFailed
----------------------------------
Option dev must be equal to one of: TrueClass, FalseClass! You passed true.
Keep up the good work.
Cheers
I tried to use this cookbook with Vagrant (1.4.2) having Ubuntu 12.04 as a guest. But I got this error:
Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/composer/provi
ders/project.rb
NameError
---------
undefined local variable or method `use_inline_resources' for #<Class:0x7f19a963
d9a8>
Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/composer/providers/project.rb:8:in `
class_from_file'
Relevant File Content:
----------------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/composer/providers/project.rb:
1: #
2: # Cookbook Name:: composer
3: # Resource:: project
4: #
5: # Copyright 2012-2013, Escape Studios
6: #
7:
8: use_inline_resources
9:
I believe it's because Vagrant installs Chef 10.14.2 by default (or it depends on guest system) and the cookbook uses feature from Chef 11+.
So it's not a real problem to install the latest version of Chef. But maybe you should mention that in requirements or do some backwards compatibility checks.
P.S: sorry for my English.
My current hotfix is to run ln -s /usr/bin/composer /usr/local/bin/composer
after the installation of composer, but in my opinion that should better be fixed.
If you execute the default recipe on a debian 7 system with the root user, the recipe failed due to the hardcoded sudo command:
[2013-12-27T19:03:03+01:00] INFO: Processing bash[download_composer] action run (composer::default line 23)
[2013-12-27T19:03:04+01:00] INFO: bash[download_composer] ran successfully
[2013-12-27T19:03:04+01:00] INFO: Processing bash[move_composer] action run (composer::default line 32)
[2013-12-27T19:03:05+01:00] INFO: Running queued delayed notifications before re-raising exception
[2013-12-27T19:03:05+01:00] ERROR: Running exception handlers
[2013-12-27T19:03:05+01:00] ERROR: Exception handlers complete
[2013-12-27T19:03:05+01:00] FATAL: Stacktrace dumped to /root/chef/chef-stacktrace.out
[2013-12-27T19:03:05+01:00] ERROR: bash[move_composer] (composer::default line 32) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '127'
---- Begin output of "bash" "/tmp/chef-script20131227-29568-1fwogft" ----
STDOUT:
STDERR: /tmp/chef-script20131227-29568-1fwogft: line 1: sudo: command not found
---- End output of "bash" "/tmp/chef-script20131227-29568-1fwogft" ----
Ran "bash" "/tmp/chef-script20131227-29568-1fwogft" returned 127
================================================================================
Error executing action `run` on resource 'bash[move_composer]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '127'
---- Begin output of "bash" "/tmp/chef-script20131227-29568-1fwogft" ----
STDOUT:
STDERR: /tmp/chef-script20131227-29568-1fwogft: line 1: sudo: command not found
---- End output of "bash" "/tmp/chef-script20131227-29568-1fwogft" ----
Ran "bash" "/tmp/chef-script20131227-29568-1fwogft" returned 127
Resource Declaration:
---------------------
# In /root/chef/cookbooks/composer/recipes/default.rb
32: bash "move_composer" do
33: cwd "#{Chef::Config[:file_cache_path]}"
34: code <<-EOH
35: sudo mv composer.phar #{node[:composer][:prefix]}/bin/composer
36: EOH
37: not_if "which composer"
38: end
39: end
Compiled Resource:
------------------
# Declared in /root/chef/cookbooks/composer/recipes/default.rb:32:in `from_file'
bash("move_composer") do
action "run"
retries 0
retry_delay 2
command "\"bash\" \"/tmp/chef-script20131227-29568-1fwogft\""
backup 5
cwd "/root/chef"
returns 0
code "\t\t\tsudo mv composer.phar /usr/local/bin/composer\n"
interpreter "bash"
cookbook_name :composer
recipe_name "default"
not_if "which composer"
end
[2013-12-27T19:01:05+01:00] INFO: Forking chef instance to converge...
[2013-12-27T19:03:05+01:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
This only occur if you execute chef / chef-solo with root user on this system.
A fast fix is to remove the sudo command. But this is not a good solution.
A better way is to check if the root user was used.
Hi there folks 👋
Firstly thanks for the cookbook, we've been using it for a while now and it's been working a treat 🎉
We have recently hit into an error no implicit conversion of nil into Hash
which I think I've tracked down to a recent commit/release. This is the commit that introduced the error: dce62a6
And here is my trace:
TypeError
---------
no implicit conversion of nil into Hash
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/composer/providers/project.rb:51:in `merge'
/tmp/kitchen/cache/cookbooks/composer/providers/project.rb:51:in `block in make_execute'
/tmp/kitchen/cache/cookbooks/composer/providers/project.rb:48:in `make_execute'
/tmp/kitchen/cache/cookbooks/composer/providers/project.rb:15:in `block in class_from_file'
The problem is on this line: dce62a6#diff-56b028966c4e078e89abd54cb2714a2bR51 where we are merging your internal environment hash with the resource's defined environment hash, but in my case we don't have any environment defined.
Here is how we were using the resource: (note it is being triggered by another resource hence the action :nothing
)
composer_project "#{git_repo_folder}" do
only_if { composer }
action :nothing
end
We have had to change it to the following to get it to work:
composer_project "#{git_repo_folder}" do
only_if { composer }
action :nothing
environment Hash.new
end
My suggestion for a fix would be to amend this line dce62a6#diff-c094c2b89a0693295a9ac3a239f2ab45R24 to attribute :environment, :kind_of => Hash, :default => Hash.new
if that is valid syntax, or for you to protect the merge lines so that they can handle being passed nil 👍
For the "global config thing" to work we have to make sure that we add '.composer' to the home_dir attribute.
But, you could do that on recipe side. Something like:
def self.home_dir(node)
node['composer']['home_dir']+'/.composer' || install_dir(node)
end
Is how it is done by other cookbooks. See vagrant-cookbook
But I don't mind if you just update documentation for others to be aware. ;)
It's very very very very bad idea to store important files in cache directory.
Cache directories can easily be cleaned.
Is this any reason why you not store file at "install_dir"?
In order to avoid connectivity problems we should add this attribute to the execute command of "composer install" (at least).
Hi! Thanks for the cookbook. It looks really cool!
But I've noticed that the composer
cookbook artifact v2.5.1 from supermarket.chef.io has a lot of redundant content which makes it invalid. That's probably caused by removing chefignore
in ae2d100
Policyfile.rb
:name 'test-composer'
default_source :supermarket
run_list 'composer'
cookbook 'composer', '= 2.5.1'
$ chef install Policyfile.rb
$ tree ~/.chefdk/cache/cookbooks/composer-2.5.1-supermarket.chef.io
├── Berksfile
├── Berksfile.lock
├── CONTRIBUTING.md
├── PaxHeader
│ ├── Berksfile
│ ├── Berksfile.lock
│ ├── CONTRIBUTING.md
│ ├── README.md
│ ├── Rakefile
│ ├── TESTING.md
│ ├── attributes
│ ├── libraries
│ ├── metadata.json
│ ├── metadata.rb
│ ├── providers
│ ├── recipes
│ └── resources
├── README.md
├── Rakefile
├── TESTING.md
├── attributes
│ ├── PaxHeader
│ │ └── default.rb
│ └── default.rb
├── libraries
│ ├── PaxHeader
│ │ └── composer.rb
│ └── composer.rb
├── metadata.json
├── metadata.rb
├── providers
│ ├── PaxHeader
│ │ ├── install_global.rb
│ │ └── project.rb
│ ├── install_global.rb
│ └── project.rb
├── recipes
│ ├── PaxHeader
│ │ ├── default.rb
│ │ ├── global_configs.rb
│ │ ├── install.rb
│ │ └── self_update.rb
│ ├── default.rb
│ ├── global_configs.rb
│ ├── install.rb
│ └── self_update.rb
└── resources
├── PaxHeader
│ ├── install_global.rb
│ └── project.rb
├── install_global.rb
└── project.rb
11 directories, 41 files
There are PaxHeader
folder created in each subfolder with the content duplicating the content of its base dir. This makes the cookbook invalid and causes failures of Chef Client run on Recipe Compile step.
If we would use berks
& Berksfile
instead of chef
& Policyfile.rb
, then there will be the similar result in cache except the fact that all PaxHeader
folders will be empty.
Just to compare - here is the content of v2.5.0 artifact, which is valid and works fine:
$ tree ~/.chefdk/cache/cookbooks/composer-2.5.0-supermarket.chef.io
├── README.md
├── attributes
│ └── default.rb
├── libraries
│ └── composer.rb
├── metadata.json
├── metadata.rb
├── providers
│ ├── install_global.rb
│ └── project.rb
├── recipes
│ ├── default.rb
│ ├── global_configs.rb
│ ├── install.rb
│ └── self_update.rb
└── resources
├── install_global.rb
└── project.rb
5 directories, 13 files
Roll-back chefignore
file and re-upload the artifact to the supermarket.
By installing items in a folder in /usr/local with a template file.
Similar to this recipe: https://github.com/escapestudios-cookbooks/phpcs/blob/master/recipes/composer.rb, but then in a LWRP. I can make it, but I'd first check if there's a need for this (I think there is) and if this could make it in :)
In the same manner as in #37, when using vagrant and setting the composer_home to /home/vagrant/.composer, the cache files themselves (see the contents of /home/vagrant/.composer/cache) are created by root, meaning that if you once ran vagrant provision, you can't run composer update or install from inside the machine (sshing into the vagrant machine and running it from there) as a permissions issue will prevent you from updating the cache files.
Hi,
I had done install php 5.3 in centos 6.5 server.
I use the last cookbook ver: 2.0.0
I all ready: include_recipe "composer" in my cookbook
it allway show : ==> default: 8>> include_recipe node['composer']['php_recipe']
with: ==> default: [2015-01-30T02:54:09+00:00] ERROR: undefined method `[]' for nil:NilClass
I had read #37 but not help.
Please help me understand why.
Thankful.
The new version of the cookbook supports a composer_project provider.
It would be nice to have a documentation in README.
THX!
E.g. phpcs, phpcpd.
Now each of these repositories has the same code, the same template, ...
What I'd propose is a provider which uses the composer_project provider in the background with :require as action, so the composer.json file in a folder is manipulated instead of begin remade. It would also create a symlink from the global install dir (e.g. /usr/local/bin), which would be an attribute in this cookbook.
The advantages are:
The provider would e.g. be
composer_install_global 'install_dir' do
package 'package_name'
version 'version'
path 'path'
end
What do you think? I'll start working on a PR for this later.
Unless I'm missing something, there doesn't seem to be a way to make environment variables available to composer which is necessary, for example, when using https://github.com/Incenteev/ParameterHandler to override values in a production or staging environment.
Could be done quite easily with composer_project and add action :create
Most of the parameters are the same: https://getcomposer.org/doc/03-cli.md#create-project
Running RHEL6.2
Haproxy will not start: I have installed redhat-lsb but this did not fix the issue. Any suggestions would be greatly appreciated.
Thanks
Error Below
Expected process to exit with [0], but received '2'
---- Begin output of /sbin/service haproxy start ----
STDOUT:
STDERR: /etc/init.d/haproxy: line 84: log_daemon_msg: command not found
/etc/init.d/haproxy: line 38: start-stop-daemon: command not found
/etc/init.d/haproxy: line 96: log_end_msg: command not found
---- End output of /sbin/service haproxy start ----
Ran /sbin/service haproxy start returned 2
106: service "haproxy" do
107: supports :restart => true, :status => true, :reload => true
108: action [:enable, :start]
109: end
service("haproxy") do
action [:enable, :start]
updated true
supports {:restart=>true, :status=>true, :reload=>true}
retries 0
retry_delay 2
service_name "haproxy"
enabled true
pattern "haproxy"
cookbook_name "haproxy"
recipe_name "default"
end
Running handlers:
[2014-03-25T15:26:30-05:00] ERROR: Running exception handlers
Running handlers complete
[2014-03-25T15:26:30-05:00] ERROR: Exception handlers complete
[2014-03-25T15:26:30-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 2 resources updated in 20.478631963 seconds
[2014-03-25T15:26:31-05:00] ERROR: service[haproxy](haproxy::default line 106) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
---- Begin output of /sbin/service haproxy start ----
STDOUT:
STDERR: /etc/init.d/haproxy: line 84: log_daemon_msg: command not found
/etc/init.d/haproxy: line 38: start-stop-daemon: command not found
/etc/init.d/haproxy: line 96: log_end_msg: command not found
---- End output of /sbin/service haproxy start ----
Ran /sbin/service haproxy start returned 2
[2014-03-25T15:26:31-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Hi guys! I need a bit of help. I'm obviously using the cookbook wrong, but I can't figure out why.
Got the following recipe:
include_recipe 'composer'
composer_project '/www/satis' do
vendor 'composer/satis'
path '/www/satis'
dev true
quiet false
action [:require, :install]
end
Which I would think installs composer and deploys "satis" to my machine. However, when my recipe runs, I get the following output for "composer_project":
* composer_project[/www/satis] action require
* execute[Install-composer-for-single-project] action run (skipped due to only_if)
* composer_project[/www/satis] action install
* execute[install-composer-for-project] action run (skipped due to only_if)
Composer installs but satis is not deployed. What is the proper way of doing what I'm trying to do?
Thanks in advance!
composer install
allows for the --no-plugins setting, it would be great if it was possible to set that in a composer_project block. Currently I have to resort to calling composer install --no-plugins
via shellout.
I get the following error when a chef-client run automatically:
#<Mixlib::ShellOut::ShellCommandFailed: execute[composer-self_update] (composer::self_update line 10) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of composer self-update ---- STDOUT: STDERR: [RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly self-update [-r|--rollback] [--clean-backups] [version] ---- End output of composer self-update ---- Ran composer self-update returned 1> had an error:
execute[composer-self_update] (composer::self_update line 10) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of composer self-update ---- STDOUT: STDERR: [RuntimeException] The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly self-update [-r|--rollback] [--clean-backups] [version] ---- End output of composer self-update ---- Ran composer self-update returned 1
Hi there! Thanks for this cookbook.
I ran into a fun issue due to the delightful multi-phase execution model of chef figured I'd report it. I did find a workaround, but it's just slightly ugly.
The root issue is this spot in the global_configs recipe which is troublesome with a custom user: https://github.com/djoos-cookbooks/composer/blob/master/recipes/global_configs.rb#L12
When node['composer']['global_configs']
contains a user that does not yet exist, but will be created during the chef recipe, then composer::global_configs
will fail with something like this beautiful message:
================================================================================
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/bethel_packaging/recipes/default.rb
================================================================================
ArgumentError
-------------
user satis doesn't exist
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/composer/recipes/global_configs.rb:12:in `home'
/tmp/kitchen/cache/cookbooks/composer/recipes/global_configs.rb:12:in `block in from_file'
/tmp/kitchen/cache/cookbooks/composer/recipes/global_configs.rb:11:in `each_pair'
/tmp/kitchen/cache/cookbooks/composer/recipes/global_configs.rb:11:in `from_file'
/tmp/kitchen/cache/cookbooks/composer/recipes/default.rb:11:in `from_file'
/tmp/kitchen/cache/cookbooks/bethel_packaging/recipes/satis.rb:16:in `from_file'
/tmp/kitchen/cache/cookbooks/bethel_packaging/recipes/default.rb:9:in `from_file'
Relevant File Content:
----------------------
/tmp/kitchen/cache/cookbooks/composer/recipes/global_configs.rb:
5: # Copyright (c) 2016, David Joos
6: #
7:
8: configs = node['composer']['global_configs']
9:
10: unless configs.nil?
11: configs.each_pair do |user, user_configs|
12>> user_composer_dir = "#{Dir.home(user)}/.composer"
13:
14: directory user_composer_dir do
15: owner user
16: group user
17: mode 0755
18: action :create
19: end
20:
21: user_configs.nil? && next
Platform:
---------
x86_64-linux
yuck ^
The workaround is to make your user resource (wherever it is) run during the compile phase and it looks like this:
user satis_user do
comment 'local user for satis'
manage_home true
action :nothing
end.run_action(:create)
With that little method tagged onto the end of the resource it worked as intended I think. So it may be useful to do one of:
global_configs
in some way to use a lazy eval style so it only runs during the converge phaseHope this info is helpful in some way.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.