From dff5423d524ff5ea9efd15e8f664787b7ec4f226 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Sun, 23 Aug 2020 19:40:49 -0700 Subject: [PATCH] Chef 16 fixes Depends-On: https://review.opendev.org/749851 Depends-On: https://review.opendev.org/750021 Change-Id: I145d988754f03c9a64b9ee34c6c6184d8eba0d40 Signed-off-by: Lance Albertson --- .rubocop_todo.yml | 6 ------ README.rst | 2 +- metadata.rb | 2 +- recipes/identity_registration.rb | 4 +--- recipes/libvirt.rb | 16 ++-------------- recipes/nova-common.rb | 6 ++---- 6 files changed, 7 insertions(+), 29 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0928e2e5..a23059fb 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,9 +13,3 @@ Style/IfUnlessModifier: - 'attributes/nova_conf.rb' - 'recipes/libvirt.rb' - 'recipes/nova-common.rb' - -# Offense count: 97 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 171 diff --git a/README.rst b/README.rst index 656839f0..54b4f263 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ Requirements ============ - Chef 15 or higher -- Chef Workstation 0.15.18 for testing (also includes Berkshelf for +- Chef Workstation 20.8.111 for testing (also includes Berkshelf for cookbook dependency resolution) Platform diff --git a/metadata.rb b/metadata.rb index 01bd167d..d47a7d6e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ issues_url 'https://launchpad.net/openstack-chef' source_url 'https://opendev.org/openstack/cookbook-openstack-compute' license 'Apache-2.0' description 'The OpenStack Compute service Nova.' -version '19.2.0' +version '19.3.0' chef_version '>= 15.0' diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index 8d867705..2ecff0ef 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -20,8 +20,6 @@ # limitations under the License. # -require 'uri' - class ::Chef::Recipe include ::Openstack end @@ -35,7 +33,7 @@ placement_interfaces = { public: { url: public_endpoint('placement-api') }, internal: { url: internal_endpoint('placement-api') }, } -auth_url = ::URI.decode identity_endpoint.to_s +auth_url = identity_endpoint.to_s service_pass = get_password 'service', 'openstack-compute' service_user = node['openstack']['compute']['conf']['keystone_authtoken']['username'] placement_service_pass = get_password 'service', 'openstack-placement' diff --git a/recipes/libvirt.rb b/recipes/libvirt.rb index c3b03d93..1bb87875 100644 --- a/recipes/libvirt.rb +++ b/recipes/libvirt.rb @@ -55,22 +55,10 @@ def update_grub_default_kernel(flavor = 'default') # change default option for /boot/grub/menu.lst unless current_default.eql?(default_boot) ::Chef::Log.info("Changed grub default to #{default_boot}") - Mixlib::ShellOut.new("sed -i -e 's;^default.*;default #{default_boot};' /boot/grub/menu.lst").run_command + shell_out("sed -i -e 's;^default.*;default #{default_boot};' /boot/grub/menu.lst") end end -# def update_grub2_default_kernel(flavor = 'default') -# boot_entry = "'openSUSE GNU/Linux, with Xen hypervisor'" -# begin -# Mixlib::ShellOut.new("grub2-set-default #{boot_entry}").run_command.error! -# ::Chef::Log.info("Changed grub2 default to #{boot_entry}") -# rescue Mixlib::ShellOut::ShellCommandFailed => e -# ::Chef::Application.fatal!( -# "Unable to change grub2 default to #{boot_entry} -# #{e.message}") -# end -# end - def update_boot_kernel_and_trigger_reboot(flavor = 'default') # only default and xen flavor is supported by this helper right now if File.exist?('/boot/grub/menu.lst') @@ -85,7 +73,7 @@ def update_boot_kernel_and_trigger_reboot(flavor = 'default') # trigger reboot through reboot_handler, if kernel-$flavor is not yet # running - unless Mixlib::ShellOut.new('uname -r').run_command.stdout.include?(flavor) + unless shell_out('uname -r').stdout.include?(flavor) node.run_state['reboot'] = true end end diff --git a/recipes/nova-common.rb b/recipes/nova-common.rb index 839204aa..da9c2fb8 100644 --- a/recipes/nova-common.rb +++ b/recipes/nova-common.rb @@ -20,8 +20,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'uri' - # Make Openstack object available in Chef::Recipe class ::Chef::Recipe include ::Openstack @@ -122,7 +120,7 @@ image_endpoint = internal_endpoint 'image_api' Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint}") Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint}") Chef::Log.debug("openstack-compute::nova-common:novnc_endpoint|#{novnc_endpoint}") -Chef::Log.debug("openstack-compute::nova-common:compute_api_endpoint|#{::URI.decode compute_api_endpoint.to_s}") +Chef::Log.debug("openstack-compute::nova-common:compute_api_endpoint|#{compute_api_endpoint}") Chef::Log.debug("openstack-compute::nova-common:network_endpoint|#{network_endpoint}") Chef::Log.debug("openstack-compute::nova-common:image_endpoint|#{image_endpoint}") # Chef::Log.debug("openstack-compute::nova-common:ironic_endpoint|#{ironic_endpoint}") @@ -137,7 +135,7 @@ node.default['openstack']['compute']['conf_secrets'] .[]('neutron')['metadata_proxy_shared_secret'] = get_password 'token', 'neutron_metadata_secret' -auth_url = ::URI.decode identity_endpoint.to_s +auth_url = identity_endpoint.to_s node.default['openstack']['compute']['conf_secrets'] .[]('keystone_authtoken')['password'] = get_password 'service', 'openstack-compute'