From f6ce85b3242ed00dbf8f3c42aa00f3a2d4674bca Mon Sep 17 00:00:00 2001 From: Samuel Cassiba Date: Sun, 20 Aug 2017 12:26:31 -0400 Subject: [PATCH] Initial repo Pike updates - Switched default linter to cookstyle - Renamed rake tasks to conform with Chef conventions - Added repo, memcached, libvirtd overrides for testing - Added Python wrapper recipe Change-Id: I91d380006d8ca8b81a05c629aff444321ada13e7 --- Rakefile | 5 +- environments/allinone-centos7.json | 9 ++ environments/allinone-ubuntu16.json | 1 + environments/multinode-centos7.json | 5 +- environments/multinode-ubuntu16.json | 1 + environments/testing.rb | 126 +++++++++--------- roles/allinone.json | 1 + roles/multinode-controller.json | 1 + .../provisioning/recipes/allinone.rb | 11 +- .../provisioning/recipes/multinode.rb | 20 ++- tools/test_patch.rb | 20 ++- 11 files changed, 107 insertions(+), 93 deletions(-) diff --git a/Rakefile b/Rakefile index 27a3f9e..c2ea2bd 100644 --- a/Rakefile +++ b/Rakefile @@ -51,9 +51,12 @@ desc "Blow everything away" task clean: [:destroy_all] # CI tasks +require 'cookstyle' require 'rubocop/rake_task' desc 'Run RuboCop' -RuboCop::RakeTask.new(:rubocop) +RuboCop::RakeTask.new do |task| + task.options << "--display-cop-names" +end desc "Validate data bags, environments and roles" task :json_check do diff --git a/environments/allinone-centos7.json b/environments/allinone-centos7.json index 0d8b8fe..db0d721 100644 --- a/environments/allinone-centos7.json +++ b/environments/allinone-centos7.json @@ -12,6 +12,10 @@ } }, "openstack": { + "yum": { + "uri": "https://trunk.rdoproject.org/centos7-master/current-passed-ci/", + "gpgcheck": false + }, "telemetry": { "conf": { "DEFAULT": { @@ -19,6 +23,10 @@ } } }, + "dashboard": { + "server_hostname": "localhost" + }, + "memcached_servers": [ "127.0.0.1:11211" ], "mq": { "user": "admin" }, @@ -35,6 +43,7 @@ "compute": { "conf": { "libvirt": { + "cpu_mode": "none", "virt_type": "qemu" } } diff --git a/environments/allinone-ubuntu16.json b/environments/allinone-ubuntu16.json index 53aa2fa..f996175 100644 --- a/environments/allinone-ubuntu16.json +++ b/environments/allinone-ubuntu16.json @@ -45,6 +45,7 @@ "compute": { "conf": { "libvirt": { + "cpu_type": "none", "virt_type": "qemu" } } diff --git a/environments/multinode-centos7.json b/environments/multinode-centos7.json index cf7da0a..e52ac95 100644 --- a/environments/multinode-centos7.json +++ b/environments/multinode-centos7.json @@ -12,7 +12,9 @@ }, "openstack": { "yum": { - "update_yum_cache": true + "update_yum_cache": true, + "uri": "https://trunk.rdoproject.org/centos7-master/current-passed-ci/", + "gpgcheck": false }, "sysctl": { "net.ipv4.ip_forward": 1 @@ -118,6 +120,7 @@ "compute": { "conf": { "libvirt": { + "cpu_type": "none", "virt_type": "qemu" }, "oslo_messaging_rabbit": { "rabbit_host": "192.168.101.60" } diff --git a/environments/multinode-ubuntu16.json b/environments/multinode-ubuntu16.json index 98f378c..9de99be 100644 --- a/environments/multinode-ubuntu16.json +++ b/environments/multinode-ubuntu16.json @@ -124,6 +124,7 @@ "compute": { "conf": { "libvirt": { + "cpu_type": "none", "virt_type": "qemu" }, "transport_url": { "rabbit_host": "192.168.101.60" } diff --git a/environments/testing.rb b/environments/testing.rb index 88d3835..d8061cf 100644 --- a/environments/testing.rb +++ b/environments/testing.rb @@ -8,36 +8,36 @@ override_attributes( 'server_debian_password' => 'root', 'server_repl_password' => 'root', 'allow_remote_root' => true, - 'root_network_acl' => '%' + 'root_network_acl' => '%', }, 'openstack' => { 'auth' => { - 'validate_certs' => false + 'validate_certs' => false, }, 'block-storage' => { 'syslog' => { - 'use' => false + 'use' => false, }, 'api' => { - 'ratelimit' => 'False' + 'ratelimit' => 'False', }, 'debug' => true, 'image_api_chef_role' => 'os-image', 'identity_service_chef_role' => 'os-identity', - 'rabbit_server_chef_role' => 'os-ops-messaging' + 'rabbit_server_chef_role' => 'os-ops-messaging', }, 'compute' => { 'syslog' => { - 'use' => false + 'use' => false, }, 'libvirt' => { - 'bind_interface' => 'eth0' + 'bind_interface' => 'eth0', }, 'novnc_proxy' => { - 'bind_interface' => 'eth0' + 'bind_interface' => 'eth0', }, 'xvpvnc_proxy' => { - 'bind_interface' => 'eth0' + 'bind_interface' => 'eth0', }, 'image_api_chef_role' => 'os-image', 'identity_service_chef_role' => 'os-identity', @@ -45,44 +45,44 @@ override_attributes( 'rabbit_server_chef_role' => 'os-ops-messaging', 'ratelimit' => { # Disable ratelimiting so Tempest doesn't have issues. 'api' => { - 'enabled' => false + 'enabled' => false, }, 'volume' => { - 'enabled' => false - } + 'enabled' => false, + }, }, 'network' => { - 'fixed_range' => '10.0.0.0/8' + 'fixed_range' => '10.0.0.0/8', }, 'networks' => [ - ] + ], }, 'db' => { 'bind_interface' => 'eth0', 'compute' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'identity' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'image' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'network' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'volume' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'dashboard' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'telemetry' => { - 'host' => '10.0.3.10' + 'host' => '10.0.3.10', }, 'orchestration' => { - 'host' => '10.0.3.10' - } + 'host' => '10.0.3.10', + }, }, 'developer_mode' => true, 'endpoints' => { @@ -90,92 +90,92 @@ override_attributes( 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8774', - 'path' => '/v2/%(tenant_id)s' + 'path' => '/v2/%(tenant_id)s', }, 'compute-ec2-admin' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8773', - 'path' => '/services/Admin' + 'path' => '/services/Admin', }, 'compute-ec2-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8773', - 'path' => '/services/Cloud' + 'path' => '/services/Cloud', }, 'compute-xvpvnc' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '6081', - 'path' => '/console' + 'path' => '/console', }, 'compute-novnc' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '6080', - 'path' => '/vnc_auto.html' + 'path' => '/vnc_auto.html', }, 'image-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '9292', - 'path' => '/v2' + 'path' => '/v2', }, 'image-registry' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '9191', - 'path' => '/v2' + 'path' => '/v2', }, 'identity-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '5000', - 'path' => '/v2.0' + 'path' => '/v2.0', }, 'identity-admin' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '35357', - 'path' => '/v2.0' + 'path' => '/v2.0', }, 'volume-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8776', - 'path' => '/v1/%(tenant_id)s' + 'path' => '/v1/%(tenant_id)s', }, 'telemetry-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8777', - 'path' => '/v1' + 'path' => '/v1', }, 'network-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '9696', - 'path' => '/v2' + 'path' => '/v2', }, 'orchestration-api' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8004', - 'path' => '/v1/%(tenant_id)s' + 'path' => '/v1/%(tenant_id)s', }, 'orchestration-api-cfn' => { 'host' => '10.0.3.11', 'scheme' => 'http', 'port' => '8000', - 'path' => '/v1' - } + 'path' => '/v1', + }, }, 'identity' => { 'admin_user' => 'ksadmin', 'bind_interface' => 'eth0', 'catalog' => { - 'backend' => 'templated' + 'backend' => 'templated', }, 'debug' => true, 'rabbit_server_chef_role' => 'os-ops-messaging', @@ -186,11 +186,11 @@ override_attributes( netadmin sysadmin), 'syslog' => { - 'use' => false + 'use' => false, }, 'tenants' => %w(admin service demo), 'token' => { - 'backend' => 'memcache' + 'backend' => 'memcache', }, 'users' => { 'ksadmin' => { @@ -199,15 +199,15 @@ override_attributes( 'roles' => { # Each key is the role name, each value is a list of tenants 'admin' => [ - 'admin' + 'admin', ], 'keystone_admin' => [ - 'admin' + 'admin', ], 'keystone_service_admin' => [ - 'admin' - ] - } + 'admin', + ], + }, }, 'demo' => { 'password' => 'demo', @@ -215,51 +215,51 @@ override_attributes( 'roles' => { # Each key is the role name, each value is a list of tenants 'sysadmin' => [ - 'demo' + 'demo', ], 'netadmin' => [ - 'demo' + 'demo', ], 'member' => [ - 'demo' - ] - } - } - } + 'demo', + ], + }, + }, + }, }, 'image' => { 'api' => { - 'bind_interface' => 'eth0' + 'bind_interface' => 'eth0', }, 'debug' => true, 'identity_service_chef_role' => 'os-identity', 'rabbit_server_chef_role' => 'os-ops-messaging', 'registry' => { - 'bind_interface' => 'eth0' + 'bind_interface' => 'eth0', }, 'syslog' => { - 'use' => false + 'use' => false, }, 'upload_image' => { - 'cirros' => 'http://hypnotoad/cirros-0.3.0-x86_64-disk.img' + 'cirros' => 'http://hypnotoad/cirros-0.3.0-x86_64-disk.img', }, 'upload_images' => [ - 'cirros' - ] + 'cirros', + ], }, 'memcached_servers' => [ - '10.0.3.10:11211' + '10.0.3.10:11211', ], 'mq' => { 'bind_interface' => 'eth0', 'host' => '10.0.3.10', 'user' => 'guest', - 'vhost' => '/nova' - } + 'vhost' => '/nova', + }, }, 'queue' => { 'host' => '10.0.3.10', 'user' => 'guest', - 'vhost' => '/nova' + 'vhost' => '/nova', } ) diff --git a/roles/allinone.json b/roles/allinone.json index f09ed6a..0c7772d 100644 --- a/roles/allinone.json +++ b/roles/allinone.json @@ -12,6 +12,7 @@ "recipe[openstack-common]", "recipe[openstack-common::logging]", "recipe[openstack-common::sysctl]", + "recipe[openstack-common::python]", "recipe[openstack-common::client]", "recipe[openstack-common::etcd]", "recipe[openstack-ops-database::server]", diff --git a/roles/multinode-controller.json b/roles/multinode-controller.json index c41d87e..2b639ad 100644 --- a/roles/multinode-controller.json +++ b/roles/multinode-controller.json @@ -12,6 +12,7 @@ "recipe[openstack-common]", "recipe[openstack-common::logging]", "recipe[openstack-common::sysctl]", + "recipe[openstack-common::python]", "recipe[openstack-common::client]", "recipe[openstack-common::etcd]", "recipe[openstack-ops-database::server]", diff --git a/site-cookbooks/provisioning/recipes/allinone.rb b/site-cookbooks/provisioning/recipes/allinone.rb index 527158c..c6762fc 100644 --- a/site-cookbooks/provisioning/recipes/allinone.rb +++ b/site-cookbooks/provisioning/recipes/allinone.rb @@ -11,9 +11,7 @@ env = 'allinone-centos7' if ENV['REPO_OS'].to_s.include?('centos') # make sure your ethernet interface matches preferred_interfaces, or override # with OS_BRIDGE - -# rubocop:disable LineLength -preferred_interfaces = ['Ethernet', 'eth0', 'enp3s0', 'Wi-Fi', +preferred_interfaces = ['Ethernet', 'eth0', 'enp3s0', 'enp30s0', 'Wi-Fi', 'Thunderbolt 1', 'Thunderbolt 2', 'Centrino'] host_interfaces = `VBoxManage list bridgedifs | grep ^Name` .gsub(/Name:\s+/, '').split("\n") @@ -39,18 +37,19 @@ options = { ':forwarded_port, guest: 6080, host: 6080', ':forwarded_port, guest: 8773, host: 8773', ':forwarded_port, guest: 8774, host: 8774', - ':forwarded_port, guest: 35357, host: 35357' - ] + ':forwarded_port, guest: 35357, host: 35357', + ], }, vagrant_config: <<-EOF config.vm.provision "chef_solo" do |chef| - chef.version = "12.21.3" + chef.version = "12.21.4" chef.channel = "stable" end config.vm.provider "virtualbox" do |v| v.memory = 8192 v.cpus = 4 v.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] + v.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] end config.vm.define "controller" do |cont| diff --git a/site-cookbooks/provisioning/recipes/multinode.rb b/site-cookbooks/provisioning/recipes/multinode.rb index 400faff..98f1cd4 100644 --- a/site-cookbooks/provisioning/recipes/multinode.rb +++ b/site-cookbooks/provisioning/recipes/multinode.rb @@ -11,8 +11,6 @@ env = 'multinode-centos7' if ENV['REPO_OS'].to_s.include?('centos') # make sure your ethernet interface matches preferred_interfaces, or override # with OS_BRIDGE - -# rubocop:disable LineLength preferred_interfaces = ['Ethernet', 'eth0', 'enp3s0', 'Wi-Fi', 'Thunderbolt 1', 'Thunderbolt 2', 'Centrino'] host_interfaces = `VBoxManage list bridgedifs | grep ^Name` @@ -42,12 +40,12 @@ controller_options = { ':forwarded_port, guest: 6080, host: 6080', ':forwarded_port, guest: 8773, host: 8773', ':forwarded_port, guest: 8774, host: 8774', - ':forwarded_port, guest: 35357, host: 35357' - ] + ':forwarded_port, guest: 35357, host: 35357', + ], }, vagrant_config: <<-EOH config.vm.provision "chef_solo" do |chef| - chef.version = "12.21.3" + chef.version = "12.21.4" chef.channel = "stable" end config.vm.provider "virtualbox" do |v| @@ -79,12 +77,12 @@ network_options = { 'vm.box' => os, 'vm.network' => [ ':private_network, {ip: "192.168.100.70"}', - ':private_network, {ip: "192.168.101.70"}' - ] + ':private_network, {ip: "192.168.101.70"}', + ], }, vagrant_config: <<-EOH config.vm.provision "chef_solo" do |chef| - chef.version = "12.21.3" + chef.version = "12.21.4" chef.channel = "stable" end config.vm.provider "virtualbox" do |v| @@ -119,12 +117,12 @@ machine_batch do 'vm.box' => os, 'vm.network' => [ ":private_network, {ip: '192.168.100.#{61 + number}'}", - ":private_network, {ip: '192.168.101.#{62 + number}'}" - ] + ":private_network, {ip: '192.168.101.#{62 + number}'}", + ], }, vagrant_config: <<-EOH config.vm.provision "chef_solo" do |chef| - chef.version = "12.21.3" + chef.version = "12.21.4" chef.channel = "stable" end config.vm.provider "virtualbox" do |v| diff --git a/tools/test_patch.rb b/tools/test_patch.rb index f6b3c4e..a2251b2 100644 --- a/tools/test_patch.rb +++ b/tools/test_patch.rb @@ -15,8 +15,6 @@ def version '0.1.0' end -# rubocop:disable LineLength - def run(command, verbose = true) puts "## Running command: [#{Dir.pwd}] $ #{command}" live_stream = STDOUT @@ -41,13 +39,13 @@ def get_gerrit_user(user) user end -def get_patch_info(user, patch) # rubocop:disable Metrics/MethodLength +def get_patch_info(user, patch) puts "## Gathering information for patch: #{patch} with user: #{user}" - if user == 'jenkins' - patch_info = run("ssh -p 29418 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{user}@review.openstack.org gerrit query --current-patch-set #{patch}", false) - else - patch_info = run("ssh -p 29418 #{user}@review.openstack.org gerrit query --current-patch-set #{patch}", false) - end + patch_info = if user == 'jenkins' + run("ssh -p 29418 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{user}@review.openstack.org gerrit query --current-patch-set #{patch}", false) + else + run("ssh -p 29418 #{user}@review.openstack.org gerrit query --current-patch-set #{patch}", false) + end %r{^\s*project: openstack\/(?.*)$}i =~ patch_info /^\s*ref: (?.*)$/i =~ patch_info abort "Error! Patch: #{patch} not valid" if patch_project.nil? @@ -75,7 +73,7 @@ def run_tempest end end -def run_basic_queries # rubocop:disable Metrics/MethodLength +def run_basic_queries puts '## Starting basic query tests' { 'nova-manage' => ['version', 'db version'], @@ -86,7 +84,7 @@ def run_basic_queries # rubocop:disable Metrics/MethodLength 'keystone' => %w(--version user-list endpoint-list role-list service-list tenant-list), 'cinder-manage' => ['version list', 'db version'], 'cinder' => %w(--version list), - 'rabbitmqctl' => %w(cluster_status) + 'rabbitmqctl' => %w(cluster_status), }.each do |cli, commands| commands.each do |command| Dir.chdir('vms') do @@ -149,7 +147,7 @@ LONGDESC option :keep, aliases: :k, default: false, type: :boolean, banner: ' Keep the environment, do not run \"rake destroy_machines\".' option :username, aliases: :u, banner: ' Gerrit user name used to fetch a patch if tool cannot automatically find it in git config.' option :skip, aliases: :s, banner: ' Skip all source changes, just run converge and tests again. For development after manually tweaking a node.' - def test # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, CyclomaticComplexity, Metrics/PerceivedComplexity + def test puts "## Starting repo test version: #{version} environment: #{options[:env]} on os: #{options[:os]}" ENV['REPO_OS'] = options[:os]