From 27ae6d914fa2825a96fdb6c101f11f4ea7b9c100 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Wed, 5 Feb 2020 16:26:15 -0800 Subject: [PATCH] Stein fixes - Cookstyle fixes - Refactor Berksfile to use groups so we can exclude integration testing cookbooks - Update documentation - Update delivery configuration to exclude integration cookbooks Depends-On: https://review.opendev.org/701027 Change-Id: I0bda5cd86c7c3afc89f7a813b5bb2baa56eb3ed8 --- .delivery/project.toml | 10 +- .rubocop.yml | 1 - .rubocop_todo.yml | 13 --- Berksfile | 6 +- README.rst | 8 +- Rakefile | 2 +- libraries/matchers.rb | 97 ------------------- libraries/openstack_base.rb | 3 +- libraries/openstack_domain.rb | 2 +- libraries/openstack_endpoint.rb | 2 +- libraries/openstack_project.rb | 2 +- libraries/openstack_role.rb | 2 +- libraries/openstack_service.rb | 2 +- libraries/openstack_user.rb | 2 +- metadata.rb | 18 ++-- .../openstackclient_test/metadata.rb | 2 +- .../openstackclient_test/recipes/domain.rb | 10 +- .../openstackclient_test/recipes/endpoint.rb | 10 +- .../openstackclient_test/recipes/project.rb | 10 +- .../openstackclient_test/recipes/role.rb | 10 +- .../openstackclient_test/recipes/service.rb | 10 +- .../openstackclient_test/recipes/user.rb | 10 +- spec/domain_spec.rb | 2 +- spec/endpoint_spec.rb | 2 +- spec/project_spec.rb | 2 +- spec/role_spec.rb | 2 +- spec/service_spec.rb | 2 +- spec/spec_helper.rb | 6 +- spec/user_spec.rb | 2 +- 29 files changed, 74 insertions(+), 176 deletions(-) delete mode 100644 .rubocop.yml delete mode 100644 .rubocop_todo.yml delete mode 100644 libraries/matchers.rb diff --git a/.delivery/project.toml b/.delivery/project.toml index 6d5e361..4066e55 100644 --- a/.delivery/project.toml +++ b/.delivery/project.toml @@ -1 +1,9 @@ -remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml" +[local_phases] +unit = 'rspec spec/' +lint = 'cookstyle --display-cop-names --extra-details' +syntax = "berks install -e integration" +provision = "echo skipping" +deploy = "echo skipping" +smoke = "echo skipping" +functional = "echo skipping" +cleanup = "echo skipping" diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index cc32da4..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1 +0,0 @@ -inherit_from: .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 393e89e..0000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2018-08-03 05:25:45 -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: 28 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 100 diff --git a/Berksfile b/Berksfile index 1606ae4..552016a 100644 --- a/Berksfile +++ b/Berksfile @@ -29,9 +29,11 @@ solver :ruby, :required -ops-messaging ).each do |cookbook| if Dir.exist?("../cookbook-openstack#{cookbook}") - cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}" + cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: 'integration' else - cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}" + cookbook "openstack#{cookbook}", + git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", + group: 'integration' end end diff --git a/README.rst b/README.rst index b23fd71..fdfb524 100644 --- a/README.rst +++ b/README.rst @@ -13,9 +13,9 @@ it. Requirements ============ -- Chef 14 or higher -- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook - dependency resolution) +- Chef 15 or higher +- Chef Workstation 0.15.6 for testing (also includes Berkshelf for + cookbook dependency resolution) - gem 'fog-openstack' Resources @@ -79,7 +79,7 @@ License and Author +-----------------+---------------------------------------------------+ | **Copyright** | Copyright (c) 2016-2019, x-ion GmbH | +-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2019, Oregon State University | +| **Copyright** | Copyright (c) 2019-2020, Oregon State University | +-----------------+---------------------------------------------------+ Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/Rakefile b/Rakefile index 3010014..df89369 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/matchers.rb b/libraries/matchers.rb deleted file mode 100644 index d64ac6a..0000000 --- a/libraries/matchers.rb +++ /dev/null @@ -1,97 +0,0 @@ - -# -# Copyright 2016 cloudbau GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if defined?(ChefSpec) - def create_openstack_project(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_project, :create, resource_name) - end - - def delete_openstack_project(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_project, :delete, resource_name) - end - - def create_openstack_service(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_service, :create, resource_name) - end - - def delete_openstack_service(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_service, :delete, resource_name) - end - - def create_openstack_endpoint(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_endpoint, :create, resource_name) - end - - def delete_openstack_endpoint(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_endpoint, :delete, resource_name) - end - - def create_openstack_role(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_role, :create, resource_name) - end - - def delete_openstack_role(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_role, :delete, resource_name) - end - - def create_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :create, resource_name) - end - - def delete_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :delete, resource_name) - end - - def grant_role_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :grant_role, resource_name) - end - - def revoke_role_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :revoke_role, resource_name) - end - - def grant_domain_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :grant_domain, resource_name) - end - - def revoke_domain_openstack_user(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_user, :revoke_domain, resource_name) - end - - def create_openstack_domain(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_domain, :create, resource_name) - end - - def delete_openstack_domain(resource_name) - ChefSpec::Matchers::ResourceMatcher - .new(:openstack_domain, :delete, resource_name) - end -end diff --git a/libraries/openstack_base.rb b/libraries/openstack_base.rb index 784fd2d..52f6748 100644 --- a/libraries/openstack_base.rb +++ b/libraries/openstack_base.rb @@ -1,6 +1,7 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH +# Copyright:: 2019 Oregon State University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_domain.rb b/libraries/openstack_domain.rb index e52f967..22027bf 100644 --- a/libraries/openstack_domain.rb +++ b/libraries/openstack_domain.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_endpoint.rb b/libraries/openstack_endpoint.rb index de061ef..aa96242 100644 --- a/libraries/openstack_endpoint.rb +++ b/libraries/openstack_endpoint.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_project.rb b/libraries/openstack_project.rb index 70d6e0c..8ca9bfb 100644 --- a/libraries/openstack_project.rb +++ b/libraries/openstack_project.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_role.rb b/libraries/openstack_role.rb index 30a3c81..fe08117 100644 --- a/libraries/openstack_role.rb +++ b/libraries/openstack_role.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_service.rb b/libraries/openstack_service.rb index adb1219..6eddd78 100644 --- a/libraries/openstack_service.rb +++ b/libraries/openstack_service.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/openstack_user.rb b/libraries/openstack_user.rb index 09ccf28..1085292 100644 --- a/libraries/openstack_user.rb +++ b/libraries/openstack_user.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/metadata.rb b/metadata.rb index 3b7ffec..8d1cf5e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,12 +1,12 @@ -name 'openstackclient' -maintainer 'OpenStack' -maintainer_email 'openstack-discuss@lists.openstack.org' -license 'Apache-2.0' -description 'Installs the fog-openstack gem and offers LWRPs to use it' -issues_url 'https://launchpad.net/openstack-chef' -source_url 'https://opendev.org/openstack/cookbook-openstack-client' -chef_version '>= 14.0' -version '18.0.0' +name 'openstackclient' +maintainer 'OpenStack' +maintainer_email 'openstack-discuss@lists.openstack.org' +license 'Apache-2.0' +description 'Installs the fog-openstack gem and offers LWRPs to use it' +issues_url 'https://launchpad.net/openstack-chef' +source_url 'https://opendev.org/openstack/cookbook-openstack-client' +chef_version '>= 15.0' +version '19.0.0' %w(ubuntu redhat centos).each do |os| supports os diff --git a/spec/cookbooks/openstackclient_test/metadata.rb b/spec/cookbooks/openstackclient_test/metadata.rb index a99c735..e6d097d 100644 --- a/spec/cookbooks/openstackclient_test/metadata.rb +++ b/spec/cookbooks/openstackclient_test/metadata.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/cookbooks/openstackclient_test/recipes/domain.rb b/spec/cookbooks/openstackclient_test/recipes/domain.rb index f69a7f1..2738894 100644 --- a/spec/cookbooks/openstackclient_test/recipes/domain.rb +++ b/spec/cookbooks/openstackclient_test/recipes/domain.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } openstack_domain 'mydomain' do diff --git a/spec/cookbooks/openstackclient_test/recipes/endpoint.rb b/spec/cookbooks/openstackclient_test/recipes/endpoint.rb index e9e95a2..7386a9f 100644 --- a/spec/cookbooks/openstackclient_test/recipes/endpoint.rb +++ b/spec/cookbooks/openstackclient_test/recipes/endpoint.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } %w(public internal admin).each do |interface| diff --git a/spec/cookbooks/openstackclient_test/recipes/project.rb b/spec/cookbooks/openstackclient_test/recipes/project.rb index 367f326..46bd9eb 100644 --- a/spec/cookbooks/openstackclient_test/recipes/project.rb +++ b/spec/cookbooks/openstackclient_test/recipes/project.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } openstack_project 'myproject' do diff --git a/spec/cookbooks/openstackclient_test/recipes/role.rb b/spec/cookbooks/openstackclient_test/recipes/role.rb index f0dcb0d..48aee32 100644 --- a/spec/cookbooks/openstackclient_test/recipes/role.rb +++ b/spec/cookbooks/openstackclient_test/recipes/role.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } openstack_role 'myrole' do diff --git a/spec/cookbooks/openstackclient_test/recipes/service.rb b/spec/cookbooks/openstackclient_test/recipes/service.rb index 5459f4a..ccb43fc 100644 --- a/spec/cookbooks/openstackclient_test/recipes/service.rb +++ b/spec/cookbooks/openstackclient_test/recipes/service.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } openstack_service 'myservice' do diff --git a/spec/cookbooks/openstackclient_test/recipes/user.rb b/spec/cookbooks/openstackclient_test/recipes/user.rb index 963939a..30fd803 100644 --- a/spec/cookbooks/openstackclient_test/recipes/user.rb +++ b/spec/cookbooks/openstackclient_test/recipes/user.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,11 +15,11 @@ # limitations under the License. connection_params = { - openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', - openstack_username: 'admin', - openstack_api_key: 'password', + openstack_auth_url: 'http://devstack.test:5000/v3/auth/tokens', + openstack_username: 'admin', + openstack_api_key: 'password', openstack_project_name: 'admin', - openstack_domain_id: 'default', + openstack_domain_id: 'default', } openstack_user 'myuser' do diff --git a/spec/domain_spec.rb b/spec/domain_spec.rb index f9d0cba..02621c0 100644 --- a/spec/domain_spec.rb +++ b/spec/domain_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/endpoint_spec.rb b/spec/endpoint_spec.rb index c092df0..bfd28f7 100644 --- a/spec/endpoint_spec.rb +++ b/spec/endpoint_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/project_spec.rb b/spec/project_spec.rb index ea6e038..1f8475c 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/role_spec.rb b/spec/role_spec.rb index 9857795..f50ccc9 100644 --- a/spec/role_spec.rb +++ b/spec/role_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/service_spec.rb b/spec/service_spec.rb index 523b846..261d2f9 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f1fddf..c72d8f6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,5 @@ end UBUNTU_OPTS = { platform: 'ubuntu', - version: '16.04', + version: '18.04', }.freeze - -at_exit { ChefSpec::Coverage.report! } diff --git a/spec/user_spec.rb b/spec/user_spec.rb index 2cabef1..35cb57c 100644 --- a/spec/user_spec.rb +++ b/spec/user_spec.rb @@ -1,6 +1,6 @@ # -# Copyright 2016 cloudbau GmbH +# Copyright:: 2016 cloudbau GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.