diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2eb50a23..0928e2e5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,13 +1,21 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2017-08-25 09:18:09 -0400 using RuboCop version 0.47.1. +# on 2018-08-03 20:56:54 -0700 using RuboCop version 0.55.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 3 -# Configuration parameters: MinBodyLength. -Style/GuardClause: +# Cop supports --auto-correct. +Style/IfUnlessModifier: Exclude: + - '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/Berksfile b/Berksfile index 32743b4f..6cca20b1 100644 --- a/Berksfile +++ b/Berksfile @@ -9,6 +9,6 @@ source 'https://supermarket.chef.io' end cookbook 'openstackclient', - github: 'cloudbau/cookbook-openstackclient' + git: 'https://git.openstack.org/openstack/cookbook-openstackclient' metadata diff --git a/metadata.rb b/metadata.rb index 18f92b21..bfdb4668 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_u source_url 'https://github.com/openstack/cookbook-openstack-compute' if respond_to?(:source_url) license 'Apache-2.0' description 'The OpenStack Compute service Nova.' -version '17.0.0' +version '18.0.0' chef_version '>= 12.5' if respond_to?(:chef_version) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) @@ -28,8 +28,8 @@ recipe 'openstack-compute::vncproxy', 'Installs/Configures nova vnc proxy' supports os end -depends 'openstack-common', '>= 17.0.0' -depends 'openstack-identity', '>= 17.0.0' -depends 'openstack-image', '>= 17.0.0' -depends 'openstack-network', '>= 17.0.0' +depends 'openstack-common', '>= 18.0.0' +depends 'openstack-identity', '>= 18.0.0' +depends 'openstack-image', '>= 18.0.0' +depends 'openstack-network', '>= 18.0.0' depends 'openstackclient' diff --git a/recipes/libvirt.rb b/recipes/libvirt.rb index dcfc6c66..8b5fb3fb 100644 --- a/recipes/libvirt.rb +++ b/recipes/libvirt.rb @@ -55,8 +55,8 @@ 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 + ::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 end end diff --git a/spec/compute-redhat_spec.rb b/spec/compute-redhat_spec.rb index 05f84f41..259413ff 100644 --- a/spec/compute-redhat_spec.rb +++ b/spec/compute-redhat_spec.rb @@ -16,13 +16,13 @@ describe 'openstack-compute::compute' do include_examples 'expect_volume_packages' it "does not upgrade kvm when virt_type is 'kvm'" do - node.set['openstack']['compute']['libvirt']['virt_type'] = 'kvm' + node.override['openstack']['compute']['libvirt']['virt_type'] = 'kvm' expect(chef_run).to_not upgrade_package('nova-compute-kvm') end it "does not upgrade qemu when virt_type is 'qemu'" do - node.set['openstack']['compute']['libvirt']['virt_type'] = 'qemu' + node.override['openstack']['compute']['libvirt']['virt_type'] = 'qemu' expect(chef_run).to_not upgrade_package('nova-compute-qemu') end diff --git a/spec/compute_spec.rb b/spec/compute_spec.rb index 521248a9..2fee79fc 100644 --- a/spec/compute_spec.rb +++ b/spec/compute_spec.rb @@ -33,14 +33,14 @@ describe 'openstack-compute::compute' do end it "upgrades kvm when virt_type is 'kvm'" do - node.set['openstack']['compute']['conf']['libvirt']['virt_type'] = 'kvm' + node.override['openstack']['compute']['conf']['libvirt']['virt_type'] = 'kvm' expect(chef_run).to upgrade_package 'nova-compute-kvm' expect(chef_run).not_to upgrade_package 'nova-compute-qemu' end it 'upgrades qemu when virt_type is qemu' do - node.set['openstack']['compute']['conf']['libvirt']['virt_type'] = 'qemu' + node.override['openstack']['compute']['conf']['libvirt']['virt_type'] = 'qemu' expect(chef_run).to upgrade_package 'nova-compute-qemu' expect(chef_run).not_to upgrade_package 'nova-compute-kvm' @@ -48,8 +48,8 @@ describe 'openstack-compute::compute' do %w(qemu kvm).each do |virt_type| it "honors the package name platform overrides for #{virt_type}" do - node.set['openstack']['compute']['conf']['libvirt']['virt_type'] = virt_type - node.set['openstack']['compute']['platform']["#{virt_type}_compute_packages"] = ["my-nova-#{virt_type}"] + node.override['openstack']['compute']['conf']['libvirt']['virt_type'] = virt_type + node.override['openstack']['compute']['platform']["#{virt_type}_compute_packages"] = ["my-nova-#{virt_type}"] expect(chef_run).to upgrade_package("my-nova-#{virt_type}") end diff --git a/spec/nova-common_spec.rb b/spec/nova-common_spec.rb index 5553ab90..90200ed7 100644 --- a/spec/nova-common_spec.rb +++ b/spec/nova-common_spec.rb @@ -7,10 +7,10 @@ describe 'openstack-compute::nova-common' do let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } let(:node) { runner.node } let(:chef_run) do - node.set['openstack']['mq'] = { + node.override['openstack']['mq'] = { 'host' => '127.0.0.1', } - node.set['openstack']['mq']['compute']['rabbit']['ha'] = true + node.override['openstack']['mq']['compute']['rabbit']['ha'] = true runner.converge(described_recipe) end @@ -41,7 +41,7 @@ describe 'openstack-compute::nova-common' do context 'with logging enabled' do before do - node.set['openstack']['compute']['syslog']['use'] = true + node.override['openstack']['compute']['syslog']['use'] = true end it 'runs logging recipe if node attributes say to' do @@ -51,7 +51,7 @@ describe 'openstack-compute::nova-common' do context 'with logging disabled' do before do - node.set['openstack']['compute']['syslog']['use'] = false + node.override['openstack']['compute']['syslog']['use'] = false end it "doesn't run logging recipe" do @@ -173,7 +173,7 @@ describe 'openstack-compute::nova-common' do describe 'ha rabbit disabled' do before do # README(galstrom21): There is a order of operations issue here - # if you use node.set, these tests will fail. + # if you use node.override, these tests will fail. node.override['openstack']['mq']['compute']['rabbit']['ha'] = false end @@ -186,7 +186,7 @@ describe 'openstack-compute::nova-common' do end it 'has default vncserver_* options set' do - node.set['openstack']['endpoints']['compute-vnc-bind']['bind_interface'] = 'lo' + node.override['openstack']['endpoints']['compute-vnc-bind']['bind_interface'] = 'lo' [/^vncserver_listen = 127.0.0.1$/, /^vncserver_proxyclient_address = 127.0.0.1$/].each do |line| @@ -195,8 +195,8 @@ describe 'openstack-compute::nova-common' do end it 'has override vncserver_* options set' do - node.set['openstack']['bind_service']['all']['compute-vnc']['host'] = '1.1.1.1' - node.set['openstack']['bind_service']['all']['compute-vnc-proxy']['host'] = '2.2.2.2' + node.override['openstack']['bind_service']['all']['compute-vnc']['host'] = '1.1.1.1' + node.override['openstack']['bind_service']['all']['compute-vnc-proxy']['host'] = '2.2.2.2' [/^vncserver_listen = 1.1.1.1$/, /^vncserver_proxyclient_address = 2.2.2.2$/].each do |line| @@ -214,7 +214,7 @@ describe 'openstack-compute::nova-common' do end it 'has a os_region_name setting' do - chef_run.node.set['openstack']['node'] = 'RegionOne' + chef_run.node.override['openstack']['node'] = 'RegionOne' expect(chef_run).to render_config_file(file.name)\ .with_section_content('cinder', /^os_region_name = RegionOne$/) end @@ -227,8 +227,8 @@ describe 'openstack-compute::nova-common' do context 'lvm backend' do before do - node.set['openstack']['compute']['conf']['libvirt']['images_type'] = 'lvm' - node.set['openstack']['compute']['conf']['libvirt']['images_volume_group'] = 'instances' + node.override['openstack']['compute']['conf']['libvirt']['images_type'] = 'lvm' + node.override['openstack']['compute']['conf']['libvirt']['images_volume_group'] = 'instances' end it 'sets the lvm options correctly' do @@ -244,10 +244,10 @@ describe 'openstack-compute::nova-common' do describe 'override settings' do before do - node.set['openstack']['compute']['conf']['libvirt']['images_type'] = 'lvm' - node.set['openstack']['compute']['conf']['libvirt']['images_volume_group'] = 'instances' - node.set['openstack']['compute']['conf']['libvirt']['sparse_logical_volumes'] = true - # node.set['openstack']['compute']['libvirt']['cpu_mode'] = 'none' + node.override['openstack']['compute']['conf']['libvirt']['images_type'] = 'lvm' + node.override['openstack']['compute']['conf']['libvirt']['images_volume_group'] = 'instances' + node.override['openstack']['compute']['conf']['libvirt']['sparse_logical_volumes'] = true + # node.override['openstack']['compute']['libvirt']['cpu_mode'] = 'none' end it 'sets the overridden lvm options correctly' do @@ -278,12 +278,12 @@ describe 'openstack-compute::nova-common' do end it 'sets overide serial console options set' do - node.set['openstack']['endpoints']['compute-serial-console-bind']['bind_interface'] = 'lo' - node.set['openstack']['endpoints']['public']['compute-serial-proxy']['scheme'] = 'wss' - node.set['openstack']['endpoints']['public']['compute-serial-proxy']['host'] = '1.1.1.1' - node.set['openstack']['endpoints']['public']['compute-serial-proxy']['port'] = '6082' - # node.set['openstack']['compute']['serial_console']['enable'] = 'True' - # node.set['openstack']['compute']['serial_console']['port_range'] = '11000:15000' + node.override['openstack']['endpoints']['compute-serial-console-bind']['bind_interface'] = 'lo' + node.override['openstack']['endpoints']['public']['compute-serial-proxy']['scheme'] = 'wss' + node.override['openstack']['endpoints']['public']['compute-serial-proxy']['host'] = '1.1.1.1' + node.override['openstack']['endpoints']['public']['compute-serial-proxy']['port'] = '6082' + # node.override['openstack']['compute']['serial_console']['enable'] = 'True' + # node.override['openstack']['compute']['serial_console']['port_range'] = '11000:15000' [ # /^enabled = True$/, @@ -298,7 +298,7 @@ describe 'openstack-compute::nova-common' do end it do - node.set['openstack']['db']['compute_api']['username'] = 'nova_api' + node.override['openstack']['db']['compute_api']['username'] = 'nova_api' expect(chef_run).to render_config_file(file.name) .with_section_content( 'api_database', @@ -308,20 +308,20 @@ describe 'openstack-compute::nova-common' do context 'set enabled_slave attribute' do it 'sets overide database enabled_slave attribute as true' do - node.set['openstack']['endpoints']['db']['enabled_slave'] = true - node.set['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1' - node.set['openstack']['endpoints']['db']['slave_port'] = '3326' - node.set['openstack']['db']['compute']['username'] = 'nova' + node.override['openstack']['endpoints']['db']['enabled_slave'] = true + node.override['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1' + node.override['openstack']['endpoints']['db']['slave_port'] = '3326' + node.override['openstack']['db']['compute']['username'] = 'nova' expect(chef_run).to render_config_file(file.name)\ .with_section_content('database', %(slave_connection = mysql+pymysql://nova:nova_db_pass@10.10.1.1:3326/nova?charset=utf8)) end it 'sets overide database enabled_slave attribute as false' do - node.set['openstack']['endpoints']['db']['enabled_slave'] = false - node.set['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1' - node.set['openstack']['endpoints']['db']['slave_port'] = '3326' - node.set['openstack']['db']['compute']['username'] = 'nova' + node.override['openstack']['endpoints']['db']['enabled_slave'] = false + node.override['openstack']['endpoints']['db']['slave_host'] = '10.10.1.1' + node.override['openstack']['endpoints']['db']['slave_port'] = '3326' + node.override['openstack']['db']['compute']['username'] = 'nova' expect(chef_run).to_not render_config_file(file.name)\ .with_section_content('database', %(slave_connection = mysql+pymysql://nova:nova_db_pass@10.10.1.1:3326/nova?charset=utf8)) @@ -342,7 +342,7 @@ describe 'openstack-compute::nova-common' do context 'template contents' do it 'shows the custom banner' do - node.set['openstack']['compute']['custom_template_banner'] = 'banner' + node.override['openstack']['compute']['custom_template_banner'] = 'banner' expect(chef_run).to render_file(file.name).with_content(/^banner$/) end diff --git a/spec/nova-setup_spec.rb b/spec/nova-setup_spec.rb index 4607aabf..364c1fbb 100644 --- a/spec/nova-setup_spec.rb +++ b/spec/nova-setup_spec.rb @@ -20,7 +20,7 @@ describe 'openstack-compute::nova-setup' do end it 'runs db migrations with timeout override' do - node.set['openstack']['compute']['dbsync_timeout'] = 1234 + node.override['openstack']['compute']['dbsync_timeout'] = 1234 expect(chef_run).to run_execute('nova-manage db sync').with( user: 'nova', group: 'nova', diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3febe351..a4ddcfc5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -161,7 +161,7 @@ shared_examples 'expect_creates_api_paste_template' do context 'template contents' do it 'pastes the misc attributes' do - node.set['openstack']['compute']['misc_paste'] = %w(paste1 paste2) + node.override['openstack']['compute']['misc_paste'] = %w(paste1 paste2) expect(chef_run).to render_file(file.name) .with_content(/^paste1$/).with_content(/^paste2$/) end