Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checksum value is ignored when binary download url is not set #192

Open
rohityadav225 opened this issue May 16, 2018 · 3 comments
Open

checksum value is ignored when binary download url is not set #192

rohityadav225 opened this issue May 16, 2018 · 3 comments
Labels
Bug Something isn't working Priority: Medium Will bring visible benefit to the project

Comments

@rohityadav225
Copy link

Cookbook version

5.0.0

Chef-client version

13.6.4

Platform Details

Centos 7.4

Scenario:

I noticed that if you don't set the default['nodejs']['binary']['url'] attribute value then the checksum value is ignored.

Steps to Reproduce:

use the following attributes and values -

node.override['nodejs']['install_method'] = 'binary'
node.override['nodejs']['version'] = '8.7.3'

Expected Result:

Notice that i did not set node['nodejs']['binary']['checksum']['linux_x64'] value, so technically kitchen converge should fail because it would use the default checksum value but not the checksum value for node-v8.11.1-sunos-x64.tar.gz.

Actual Result:

kitechen converge succeeds.

@github-actions
Copy link

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

@github-actions github-actions bot added the Stale label Sep 30, 2020
@xorimabot xorimabot removed the Stale label Sep 30, 2020
@MarkGibbons MarkGibbons added Needs Triage Issue is waiting to be categorised Bug Something isn't working Priority: Medium Will bring visible benefit to the project and removed Needs Triage Issue is waiting to be categorised labels Oct 2, 2020
@axl89
Copy link

axl89 commented Feb 19, 2021

I've found a similar issue today in version 7.3.1 and Chef client 15.15.1 on an Ubuntu 18.04 box with the following:

attributes.rb

default['nodejs']['version'] = '14.15.5'
default['nodejs']['install_method'] = 'binary'
default['nodejs']['binary']['checksum'] = 'gatomon'
default['nodejs']['packages'] = %w(nodejs)

recipe.rb

apt_update 'all'
include_recipe 'nodejs'

The output being:

Recipe: example_projects::recipe
 * apt_update[all] action periodic
   - update new lists of packages
   * directory[/var/lib/apt/periodic] action create (up to date)
   * directory[/etc/apt/apt.conf.d] action create (up to date)
   * file[/etc/apt/apt.conf.d/15update-stamp] action create_if_missing
     - create new file /etc/apt/apt.conf.d/15update-stamp
     - update content in file /etc/apt/apt.conf.d/15update-stamp from none to 174cdb
     --- /etc/apt/apt.conf.d/15update-stamp	2021-02-19 13:59:15.182576333 +0000
     +++ /etc/apt/apt.conf.d/.chef-15update-stamp20210219-2030-1jz7b7i	2021-02-19 13:59:15.182576333 +0000
     @@ -1 +1,2 @@
     +APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};
   * execute[apt-get -q update] action run
     - execute ["apt-get", "-q", "update"]
 
Recipe: nodejs::nodejs_from_binary
 * ark[nodejs-binary] action install
   * directory[/usr/local/nodejs-binary-14.15.5] action create
     - create new directory /usr/local/nodejs-binary-14.15.5
   * remote_file[/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] action create
     - create new file /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz
     - update content in file /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz from none to e30c1f
     (file sizes exceed 10000000 bytes, diff output suppressed)
   * execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] action nothing (skipped due to action :nothing)
   * execute[set owner on /usr/local/nodejs-binary-14.15.5] action nothing (skipped due to action :nothing)
   * link[/usr/local/bin/node] action create
     - create symlink at /usr/local/bin/node to /usr/local/nodejs-binary-14.15.5/bin/node
   * link[/usr/local/bin/npm] action create
     - create symlink at /usr/local/bin/npm to /usr/local/nodejs-binary-14.15.5/bin/npm
   * link[/usr/local/bin/npx] action create
     - create symlink at /usr/local/bin/npx to /usr/local/nodejs-binary-14.15.5/bin/npx
   * link[/usr/local/nodejs-binary] action create
     - create symlink at /usr/local/nodejs-binary to /usr/local/nodejs-binary-14.15.5
   * template[/etc/profile.d/nodejs-binary.sh] action create
     - create new file /etc/profile.d/nodejs-binary.sh
     - update content in file /etc/profile.d/nodejs-binary.sh from none to c7b5d7
     --- /etc/profile.d/nodejs-binary.sh	2021-02-19 13:59:21.785876094 +0000
     +++ /etc/profile.d/.chef-nodejs-binary20210219-2030-1b695sr.sh	2021-02-19 13:59:21.785876094 +0000
     @@ -1 +1,2 @@
     +export PATH=/usr/local/nodejs-binary-14.15.5/bin:$PATH
     - change mode from '' to '0755'
     - change owner from '' to 'root'
     - change group from '' to 'root'
   * ruby_block[adding '/usr/local/nodejs-binary-14.15.5/bin' to chef-client ENV['PATH']] action run
     - execute the ruby block adding '/usr/local/nodejs-binary-14.15.5/bin' to chef-client ENV['PATH']
   * execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] action run
     - execute /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1
   * execute[set owner on /usr/local/nodejs-binary-14.15.5] action run
     - execute chown -R root:0 /usr/local/nodejs-binary-14.15.5
 

Running handlers:
Running handlers complete

@axl89
Copy link

axl89 commented Feb 19, 2021

Ironically, if you destroy the kitchen suite, and then remove this line from the attributes:

default['nodejs']['binary']['checksum'] = 'gatomon'

and run converge again, the recipe crashes and shows a checksum mismatch error:

       Recipe: nodejs::nodejs_from_binary
         * ark[nodejs-binary] action install
           * directory[/usr/local/nodejs-binary-14.15.5] action create
             - create new directory /usr/local/nodejs-binary-14.15.5
           * remote_file[/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] action create
             
             ================================================================================
             Error executing action `create` on resource 'remote_file[/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz]'
             ================================================================================
             
             Chef::Exceptions::ChecksumMismatch
             ----------------------------------
             Checksum on resource (2f0397) does not match checksum on content (e30c1f)
             
             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/ark/resources/default.rb
             
       62:   remote_file new_resource.release_file do
       63:     Chef::Log.debug('DEBUG: new_resource.release_file')
       64:     source new_resource.url
       65:     checksum new_resource.checksum if new_resource.checksum
       66:     action :create
       67:     notifies :run, "execute[unpack #{new_resource.release_file}]"
       68:     backup new_resource.backup
       69:   end
       70: 
             
             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/ark/resources/default.rb:62:in `block in class_from_file'
             
             remote_file("/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz") do
        action [:create]
        default_guard_interpreter :default
        source ["https://nodejs.org/dist/v14.15.5/node-v14.15.5-linux-x64.tar.gz"]
        declared_type :remote_file
        cookbook_name "nodejs"
        checksum "2f0397bb81c1d0c9901b9aff82a933257bf60f3992227b86107111a75b9030d9"
        backup 5
        remote_domain nil
        remote_user nil
        path "/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz"
        owner nil
        group nil
        headers {}
        mode nil
        verifications []
             end
             
             System Info:
             ------------
             chef_version=15.15.1
             platform=ubuntu
             platform_version=18.04
             ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
             program_name=/opt/chef/bin/chef-client
             executable=/opt/chef/bin/chef-client
             
           * execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] action run
             
             ================================================================================
             Error executing action `run` on resource 'execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz]'
             ================================================================================
             
             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Expected process to exit with [0], but received '2'
             ---- Begin output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
             STDOUT: 
             STDERR: tar (child): /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz: Cannot open: No such file or directory
             tar (child): Error is not recoverable: exiting now
             /bin/tar: Child returned status 2
             /bin/tar: Error is not recoverable: exiting now
             ---- End output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
             Ran /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 returned 2
             
             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/ark/resources/default.rb
             
       72:   execute "unpack #{new_resource.release_file}" do
       73:     command unpack_command
       74:     cwd new_resource.path
       75:     environment new_resource.environment
       76:     notifies :run, "execute[set owner on #{new_resource.path}]"
       77:     action :nothing
       78:   end
       79: 
             
             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/ark/resources/default.rb:72:in `block in class_from_file'
             
             execute("unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz") do
        action [:nothing]
        default_guard_interpreter :execute
        command "/bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1"
        backup 5
        declared_type :execute
        cookbook_name "nodejs"
        domain nil
        user nil
        cwd "/usr/local/nodejs-binary-14.15.5"
        environment {}
             end
             
             System Info:
             ------------
             chef_version=15.15.1
             platform=ubuntu
             platform_version=18.04
             ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
             program_name=/opt/chef/bin/chef-client
             executable=/opt/chef/bin/chef-client
             
           
           ================================================================================
           Error executing action `install` on resource 'ark[nodejs-binary]'
           ================================================================================
           
           Chef::Exceptions::MultipleFailures
           ----------------------------------
           Multiple failures occurred:
           * Chef::Exceptions::ChecksumMismatch occurred in Chef Infra Client run: remote_file[/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] (/tmp/kitchen/cache/cookbooks/ark/resources/default.rb line 62) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (2f0397) does not match checksum on content (e30c1f)
           * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] (/tmp/kitchen/cache/cookbooks/ark/resources/default.rb line 72) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
           ---- Begin output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
           STDOUT: 
           STDERR: tar (child): /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz: Cannot open: No such file or directory
           tar (child): Error is not recoverable: exiting now
           /bin/tar: Child returned status 2
           /bin/tar: Error is not recoverable: exiting now
           ---- End output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
           Ran /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 returned 2
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/nodejs/recipes/nodejs_from_binary.rb
           
            60: ark archive_name do
            61:   url nodejs_bin_url
            62:   version node['nodejs']['version']
            63:   checksum checksum
            64:   has_binaries binaries
            65:   append_env_path node['nodejs']['binary']['append_env_path']
            66:   action :install
            67: end
           
           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/nodejs/recipes/nodejs_from_binary.rb:60:in `from_file'
           
           ark("nodejs-binary") do
             action [:install]
             updated true
             updated_by_last_action true
             default_guard_interpreter :default
             declared_type :ark
             cookbook_name "nodejs"
             recipe_name "nodejs_from_binary"
             url "https://nodejs.org/dist/v14.15.5/node-v14.15.5-linux-x64.tar.gz"
             version "14.15.5"
             checksum "2f0397bb81c1d0c9901b9aff82a933257bf60f3992227b86107111a75b9030d9"
             has_binaries ["bin/node", "bin/npm", "bin/npx"]
             append_env_path true
             extension "tar.gz"
             prefix_bin "/usr/local/bin"
             prefix_root "/usr/local"
             home_dir "/usr/local/nodejs-binary"
             owner "root"
             path "/usr/local/nodejs-binary-14.15.5"
             release_file "/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz"
           end
           
           System Info:
           ------------
           chef_version=15.15.1
           platform=ubuntu
           platform_version=18.04
           ruby=ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
           program_name=/opt/chef/bin/chef-client
           executable=/opt/chef/bin/chef-client
           
       
       Running handlers:
       [2021-02-19T14:02:50+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2021-02-19T14:02:50+00:00] ERROR: Exception handlers complete
       Chef Infra Client failed. 4 resources updated in 18 seconds
       [2021-02-19T14:02:50+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2021-02-19T14:02:50+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2021-02-19T14:02:50+00:00] FATAL: Chef::Exceptions::MultipleFailures: Multiple failures occurred:
       * Chef::Exceptions::ChecksumMismatch occurred in Chef Infra Client run: remote_file[/tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] (/tmp/kitchen/cache/cookbooks/ark/resources/default.rb line 62) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (2f0397) does not match checksum on content (e30c1f)
       * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[unpack /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz] (/tmp/kitchen/cache/cookbooks/ark/resources/default.rb line 72) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
       ---- Begin output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
       STDOUT: 
       STDERR: tar (child): /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz: Cannot open: No such file or directory
       tar (child): Error is not recoverable: exiting now
       /bin/tar: Child returned status 2
       /bin/tar: Error is not recoverable: exiting now
       ---- End output of /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 ----
       Ran /bin/tar xzf /tmp/kitchen/cache/nodejs-binary-14.15.5.tar.gz --strip-components=1 returned 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority: Medium Will bring visible benefit to the project
Projects
None yet
Development

No branches or pull requests

4 participants