IshentRas / cookbook-openshift3

Chef Cookbook for Openshift
https://supermarket.chef.io/cookbooks/cookbook-openshift3
MIT License
27 stars 12 forks source link

Chef::Exceptions::InvalidResourceSpecification: Please provide a version for each package. Use `nil` for default version. #293

Open ianmiell opened 5 years ago

ianmiell commented 5 years ago

Keep hitting this error:

    ================================================================================
    Error executing action `install` on resource 'cookbook_openshift3_openshift_master_pkg[Install OpenShift Master Packages for Certificate Server]'
    ================================================================================

    Chef::Exceptions::InvalidResourceSpecification
    ----------------------------------------------
    yum_package[origin-master, origin-clients, origin, origin-node, origin-sdn-ovs] (/root/chef-solo-example/cache/cookbooks/cookbook-openshift3/resources/openshift_master_pkg.rb line 61) had an error: Chef::Exceptions::InvalidResourceSpecification: Please provide a version for each package. Use `nil` for default version.

looking at the trace, I see that there are 5 packages and six versions in the array:

      yum_package("origin-master, origin-clients, origin, origin-node, origin-sdn-ovs") do
        package_name ["origin-master", "origin-clients", "origin", "origin-node", "origin-sdn-ovs"]
        action [:install]
        default_guard_interpreter :default
        declared_type :yum_package
        cookbook_name "cookbook-openshift3"
        version ["3.9.0-1.el7.git.0.ba7faec", "3.9.0-1.el7.git.0.ba7faec", "3.9.0-1.el7.git.0.ba7faec", "3.9.0-1.el7.git.0.ba7faec", "3.9.0-1.el7.git.0.ba7faec", "3.9.0-1.el7.git.0.ba7faec"]
        retries 3
        options []
        not_if { #code block }
      end

investigating further.

ianmiell commented 5 years ago

This fixes it:

    yum_package pkg_master_to_install.reject { |x| x == "tuned-profiles-#{node['cookbook-openshift3']['openshift_service_type']}-node" && (node['cookbook-openshift3']['ose_major_version'].split('.')[1].to_i >= 9 || node['cookbook-openshift3']['control_upgrade_version'].to_i >= 39) } do
      action :install
      version Array.new(pkg_master_to_install.reject { |x| x == "tuned-profiles-#{node['cookbook-openshift3']['openshift_service_type']}-node" && (node['cookbook-openshift3']['ose_major_version'].split('.')[1].to_i >= 9 || node['cookbook-openshift3']['control_upgrade_version'].to_i >= 39) }.size, version) unless version.nil?
      options new_resource.options.nil? ? node['cookbook-openshift3']['openshift_yum_options'] : new_resource.options
      notifies :run, 'execute[daemon-reload]', :immediately
      not_if { node['cookbook-openshift3']['deploy_containerized'] || (is_certificate_server && node['fqdn'] != first_master['fqdn']) }
      retries 3
    end
IshentRas commented 5 years ago

:+1: