From 55967facfe3d3f6ab18a1568adde270971a85860 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 21 Sep 2015 13:42:36 +0200 Subject: [PATCH] Bump modules to their latest masters Update apache to 346c0e7f50664ba23a656bc1dbeeda653dedb318 346c0e7f50664ba23a656bc1dbeeda653dedb318 Merge pull request #1152 from aronymous/feature/master/passengerbaseuri 84bb0feeb7036993d4dec28b1e3f6b8d14159787 Merge pull request #1200 from edmundcraske/fix-freebsd-mpm_prefork 3e1f0c567c2f7aebd041d941340d8768cd63df13 Merge pull request #1183 from traylenator/kerb bf948c05e253b43ed0bae1ca36868af4af617860 (MODULES-2419) - Add mod_auth_kerb parameters to vhost. 49fed02c87da035d9cd85aafe115b7ed447d92ca Fix typo of MPM_PREFORK 9367580e2dc72df792fdafc48c5a9c94d7725a59 (MODULES-2188) Add support for PassengerBaseURI in Apache This adds a varaible and template block for using PassengerBaseURI in the vhost Change-Id: I2bb5ab53e088099936427e086bfefb74c6bd8c08 Update ceilometer to 67aa7266e75de57daaa88f1d8b2a6b887c64dfc6 67aa7266e75de57daaa88f1d8b2a6b887c64dfc6 Merge "Creation of ceilometer::db::sync" 93f2f4a2227fc6a138d2c9e9494d44ab626c4840 Merge "acceptance/eventlet: make sure apache is stopped" 2d6f830e136d9e08a2daf9ec110668a869423715 Merge "Disable lint warning check" 7c549514a702a597e2dce944cd146416d176e312 acceptance: bump to Liberty a4a12b2612c1e54579c79fa6faef91b684b9aff1 Disable lint warning check 0fb6851f5fc8a306dc2b850d7336591833f8ad1d acceptance/eventlet: make sure apache is stopped 7b920066e1aeb7f4201bb74ecf4c31f1efb9cafe Creation of ceilometer::db::sync Change-Id: Ic092d1785181d82408a28eb0cebb2b41d87a1243 Update cinder to 3259caa0efe369f4dfe6dd69791cfade2326e435 3259caa0efe369f4dfe6dd69791cfade2326e435 Move default value to '' c5d73e1bc73dfd6354e1bb7bb49207a553af4cf5 Merge "acceptance: switch RDO to CBS repositories" d9de56f4a7df23c7551a7feff8f5baae9b200c7d acceptance: switch RDO to CBS repositories Change-Id: I52fef8934d0534d6ceaccd7be13a765dbe0de735 Update glance to 03e1e00cbd2f33f937a1a2919e3c444f67fa0731 03e1e00cbd2f33f937a1a2919e3c444f67fa0731 Merge "Initial msync run for all Puppet OpenStack modules" 2993b223bb75f44734b34a58fca87a052a511e9e Merge "Require at least 4.2.0 of stdlib" 7147ba03233c110f3e7302aaa5d80fc1213ade8b glance_image: hardcode os-image-api-version to 1 de99b85614df9bbbe19214a21b584620cba43631 Require at least 4.2.0 of stdlib ed1425897f6e02871e0682347e2de01c84e24bf4 Merge "Update CHANGELOG.md and other files" 1a6a0b916265d5c5e71d749d65f0adc4ca868b85 Merge "Creation of glance::db::sync" a5cee560b4dc10f0a9732d27898d3659f245232b Merge "acceptance: switch RDO to CBS repositories" ef5652f1f8d11f9bbbce18106e08f284ea35415d acceptance: switch RDO to CBS repositories 0860b66fdc88c5a169e0e3886960a7e15f665c48 Fix rspec 3.x syntax 48a7164021c8e4e85e5f6409896c45ee25f42218 Creation of glance::db::sync 6ea3194989334a9d479e6e4eacb174161bdf9800 Initial msync run for all Puppet OpenStack modules 9989505da6a8eff4c606fc191de01f6d672e9046 Update CHANGELOG.md and other files Change-Id: I909cbf8adbb169aa12d092274100e7b43a2cf244 Update gluster to bf8bc52e6d67cea37864f22a2dd091ae988dcaa4 bf8bc52e6d67cea37864f22a2dd091ae988dcaa4 Fix: warning: found = in conditional, should be == Change-Id: I1e78602e75027f792de8a93654e039a9fb7baf25 Update heat to f5193ad715a3a06b00ae0894292d46af19bcfb0e f5193ad715a3a06b00ae0894292d46af19bcfb0e acceptance: switch RDO to CBS repositories Change-Id: I36db987dcef283e27c4aa7c5a5c8ba9757e4abee Update horizon to 4ff00b34e3af7f6608472ef0f5787e659c4fca6c 4ff00b34e3af7f6608472ef0f5787e659c4fca6c Merge "Remove duplicate key for ':servername'" 81ed5a9d459f02f4666f70f99a38e16d1f34112e Merge "Add ssl_no_verify parameter" f749bed0d161ff2a92fde5880c14f83ecbb53f7b Merge "remove hardcoded 'neutron_options' list" 787255deab5e37b88ac24d04c83b32dfea43e4f7 Merge "remove hardcoded 'cinder_options' list" ea35f59c3e1ea35500a243662f68c2c5a338ece0 Merge "remove hardcoded 'hypervisor_options' list" 58f2cfe9560a7ed4c99d47fb32814a2b402238c8 remove hardcoded 'neutron_options' list 8c5b7da3922cf23c6d26ec12626da96600124b4c remove hardcoded 'cinder_options' list ec5e9963d87cd4e6fa8aa9fda9140c400da6fc5b remove hardcoded 'hypervisor_options' list 165408856f33447a7b84d030f07655140ab575d2 acceptance: bump to Liberty 7ff4f745bcf29c47323fcc6250d5f36fb7a8b57b Remove duplicate key for ':servername' 400bc877b82f796bc058ab4d9341e0071e7e410b Add ssl_no_verify parameter Change-Id: I8c53e8f606ade777184ea8bb36c671e88abe5cdc Update ironic to 557afd41e14671f409215261ccc879818c952a4c 557afd41e14671f409215261ccc879818c952a4c Merge "acceptance: bump to Liberty" 163509c05405b6d18292824beab241b70e11cc2d acceptance: bump to Liberty 883f4872202c9719d15075954b615375cc06cd18 Fix rspec 3.x syntax Change-Id: I5e0de315244e8377efeb3a344e7e57431cc4019f Update keystone to 40a1d04410e0cc2bdfd1a8fa2ccca70eb202993f 40a1d04410e0cc2bdfd1a8fa2ccca70eb202993f Merge "Add additional memcache configuration options" ca663adcd6222a4a598a9639a839d524972d9a62 Merge "Fix spelling in deprecation message" 877fd505b767d1b74bd5afcbc0c178b53e299c96 Fix spelling in deprecation message 9f8ea7d7b4ad33b629b6991837ade04021927280 Endpoints can be APIs version-less 6d8239183b73c568d662b9fe21cfedf8de2ddaae Merge "Fix *_workers config settings." 1b6308a94de9bbc7e7fcad03a6b4a582ab37fdd9 Merge "Fixes get_section for future use" d5358c65114cf6ed3baf6eeef4c27a76ee916b64 Merge "acceptance: switch RDO to CBS repositories" ec84ac9c958a44c15d3511a31effc423c8d61470 Fix *_workers config settings. 60bf2b048c1054871567173688945857d6c3caf9 Fixes get_section for future use 59a76f7317e90e6268b9270f2738b61d13ae51e2 Merge "Use Ubuntu provided wsgi.py for keystone.wsgi" dd4ea76d233265294e368efb0634be43187d2af4 acceptance: switch RDO to CBS repositories 89aafb88f52cd305eb4bf80b4adee8ce6594744f able to use wrong resource name f7c8fc2ffa15272548623c1f58be0e007e5a16be able to use wrong value for default_domain_id 74f01da92f8de2fcb471ec5f9833ead1bff2dee1 domain name from id lookups return empty 6ee894a287d1c5c31ebb5f79beee396c7e9d7ee6 Use Ubuntu provided wsgi.py for keystone.wsgi 8501640071cad234fad9e25acc216bfb15b69ddf Add additional memcache configuration options Change-Id: I1b7f15acdbcd52b0639e67888c7e934c906ccc2b Update manila to 87ed677909ecdae78a3459b13118117c740b127e 87ed677909ecdae78a3459b13118117c740b127e Merge "acceptance: switch RDO to CBS repositories" 395d1ff344da6557f0d19181808695ac53db37a7 acceptance: switch RDO to CBS repositories 5ac17ab421e667605e2f645ad9d18c160bd46030 Fix rspec 3.x syntax Change-Id: I9e624dce69073a8ccd359d3d7a1ab6ffa25da3c1 Update module-collectd to 07378b476f892648c3ef9cac6f1b0ed481917b17 07378b476f892648c3ef9cac6f1b0ed481917b17 Merge pull request #338 from shanemadden/snmp-typo-fix 650b3f13a8b2155d667003fde23d86892f91befa Typo fix s/Shitf/Shift/ 30186b77fce8dd7b51b1d3ce450869079c2794f0 Merge pull request #335 from waldosCH/feature/addPluginWriteSensu cf338774748f8e0afac52d2fa9d12ff11206fd66 Added documentation for write_sensu plugin. b98a29ea9cec1482d4c090aec2e97e6ecd34fa07 Added new class to manage the plugin write_sensu and the corresponding config template Change-Id: Ic5b8ac8fabed9a4c85c705b87fd69522bc8c639d Update neutron to 3f8d040caa7143f4c117a889c464ba36db58d39e 3f8d040caa7143f4c117a889c464ba36db58d39e Merge "Remove use of template based config from cisco ml2 nexus plugin." 6dc74ac0e69d4bdd4da826189b6d6c2d2bc8e6a9 Remove use of template based config from cisco ml2 nexus plugin. 424ea9a34dcb2cd306b17fae19174ed98fe911a3 Merge "acceptance: switch RDO to CBS repositories" 11d0da39486f936ba563dd0c7661289eb709299b Merge "Make vswitch optional for ovs agent configuration" 67a67fdcc60773f3c78e4631069370c0c282f60b Merge "Configure Big Switch ML2 plugin" ea29622cba7ed999e8c688cbc81817f0ca4a8ed8 acceptance: switch RDO to CBS repositories 8738c8f41480403f17f6f68472787523c62d76a3 Fix rspec 3.x syntax c1b2cf360787a8171632eb0baa19b09d44983822 Make vswitch optional for ovs agent configuration f8ec8a20a0137ac15d7a6303d46fd9c8f3fbd9d7 Configure Big Switch ML2 plugin Change-Id: I7d3ac426d68a5238a0e82d8e74e6199d6f5408fb Update nova to 21029f04f733de72d69bac3d729f68baf9038c74 21029f04f733de72d69bac3d729f68baf9038c74 Merge "Use auth_nova method to create nova network" 0d14fc1208b2ff8b5461609af628eab4b3026086 Merge "docfix: update default image_service param in doc" 4ae687669270eaf8cd81376f26e42cded1db80e3 Merge "add config_drive_format option to nova_compute" 67550c266aad9c20389fd4f4ae6b685e9c771735 acceptance: switch RDO to CBS repositories 712efc3093b109b2fa48b02bfbbf4526359c8561 add config_drive_format option to nova_compute f84dc0205ffebca326234e13a0f33e279dc6ba91 docfix: update default image_service param in doc fc2480588736ed5168e829bf81270dfc7965a77e Use auth_nova method to create nova network Change-Id: I1968d031b4fba79d8f18fa4a1ae620d81c7222a3 Update openstack_extras to e005145df14538c04e07d213b43be50ca2551e8b e005145df14538c04e07d213b43be50ca2551e8b Fix RSpec 3.x syntax Change-Id: I89c7ed7bf74feda725e93d30458811738f71ef6c Update rabbitmq to 1e2ea5cc4844722259173335f135709972fe6dcd 1e2ea5cc4844722259173335f135709972fe6dcd Merge pull request #386 from dgmorales/add-stomp-ssl-only 172c659a602b8d2ec62f4012ed90550c19a83521 Add parameter to configure only the SSL port for STOMP plugin Change-Id: I2d2b342a22016690cd0dc2a595243cc9372bea46 Update sahara to 1b1e9fb9d4085200495ad09ff978f7b941d48817 1b1e9fb9d4085200495ad09ff978f7b941d48817 Merge "Add new parameter 'plugins' for Sahara" 405cf2e0683ab671c63828e43733d9eb7a8866ec Merge "Revert "Fixed /etc/sahara handling"" a49a45a285b015f1315adab27624e77ae0fe0916 Add new parameter 'plugins' for Sahara 4a214b5bce5a1d4d13a72cfb532bdf45d7909a58 Revert "Fixed /etc/sahara handling" 8a2efc58b882f4ab913aa3b1613361e024bfe999 Introduce sahara::db class 98478e76b3e98a02dc632fa16cb25c4146b25dc1 Merge "acceptance: switch RDO to CBS repositories" ac863e9faf1f2c31ba27085d97cabad9d5536221 acceptance: switch RDO to CBS repositories Change-Id: Ibe0e63b67f54391b4661805f9bea6aae93e0afb0 Update stdlib to 9b1932c538354c1b360838c8cf7b942af314c99d 9b1932c538354c1b360838c8cf7b942af314c99d Merge pull request #526 from DavidS/improve-validate_re-docs 55ece7815a8718507ef096db53a1e186102f1c8a (MAINT) validate_re: Clarify docs and error message 399ce03f6806b2226d5bcee52ab22235842c6e38 Merge pull request #524 from binford2k/docs/intersection_truthiness 169f8af506d4cd8299e847236632fd8511928a03 Clarify what an empty intersection looks like. 0ea0e402283e6f0992d3ba74343728053bbbe785 Merge pull request #523 from DavidS/modules-2516-is_a c0df8192ee5c2f606ae99c2a3115002962901dea Merge pull request #511 from dmitryilyin/parseyaml_default 00c881d0dabe77fd2401beb0d39c7386b50bb791 (MODULES-2516) Adds an is_a() function eb948c4a0dc36790c5444fc236b0154c3d716c58 [MODULES-2462] Improve parseyaml function Change-Id: Iffe6321a9d4ef87156ba3f52c66c79778000958f Update swift to 96b4f5c7c5c5fd10c0ddee41962531aa5021d906 96b4f5c7c5c5fd10c0ddee41962531aa5021d906 Merge "Config resources applied after config template" 6fe1ec4ad6855022c6bc9b0ea85a1ef825b23888 acceptance: switch RDO to CBS repositories 86851f4a2fab105ec99608ea0bcd024d5c14474b Fix rspec 3.x syntax 56512264bfb43f6671b49a4e07a1930012a1914d Config resources applied after config template Change-Id: If873bd01988984e6d4248ff3cf9039a9e1ad22bb Update tripleo to 7ca1bbf046abfd0cc5897fba49683c62e2c33dbe 7ca1bbf046abfd0cc5897fba49683c62e2c33dbe Merge "Allow a user to specify the syslog address for HAProxy" ff6f4864e6f999faff75e8c720f789a3876c938c loadbalancer: use http mode for Horizon haproxy config 55b77339542a30b3137a5b9ce23ca960eb911e9a Merge "Initial msync run for all Puppet OpenStack modules" 14ac699d8ab97dda03b8711f1a8ac26f6fd52191 Allow a user to specify the syslog address for HAProxy f4872ac98adf09a0888deba5089f5acdea5ec726 Merge "Add package_manifest resource." ad974333e0df16cca7aa2f144c84b11dca1d70fc loadbalancer: use 'source' for novnc balance mode e3abcd6b5330959016b43115a8bf1b1cef668d30 Add package_manifest resource. e879bb607009ecf7f7d48e5210409408e5a17f44 Initial msync run for all Puppet OpenStack modules Change-Id: I311c6bb070cb74cfce504ad4dac3e5d764df7150 Update trove to 2c907a77f9a8a76516f784fbf3a2bca213876e4c 2c907a77f9a8a76516f784fbf3a2bca213876e4c Merge "Fix rspec 3.x syntax" 61d3378cb51f4b4b4175058b5c1bd93a55f0a51d Merge "Initial msync run for all Puppet OpenStack modules" 340f2c0fef0079b7a1091287093cc11dee15a729 Fix rspec 3.x syntax ea102af2ecb9ff594231b220fb0a8eee739b0cbd acceptance: switch RDO to CBS repositories 7145694b744be5008d2f805886d6e7416b646051 Initial msync run for all Puppet OpenStack modules Change-Id: I5c879069f03278540bd810fdc52407df9c8c3b48 Update vcsrepo to 279be07607dd132f9446291cf1afa5ef2320632a 279be07607dd132f9446291cf1afa5ef2320632a Merge pull request #262 from webfactory/autorequire-hg 276af8b8e7633df9e2debb07a359195b970f71b0 Merge pull request #272 from tphoney/dos2unix_readme 9a9f343e8358c05766a2899c0e9037fd98df4595 dos2unix the readme f0d087a1cbf99228b9edb3e1d2e28d81df794e24 Merge pull request #269 from monai/develop 7758331f503a9198921362761079cbfd941c625e Add feature depth and param trust_server_cert to svn 6b01539dfee074b798f7e96cb228a42ae6a42c8b Autorequire Package['mercurial'] Change-Id: Ia577794f9ce13d633a8d42e8511abfc2dbf0c135 Update vswitch to 934d053cb90624256df2a5468e9783d016e9f270 934d053cb90624256df2a5468e9783d016e9f270 Fix RSpec 3.x syntax Change-Id: I49d0553342d90aac98ce6d4978436f8711060115 --- Puppetfile | 44 +- apache/README.md | 49 + apache/manifests/package.pp | 4 +- apache/manifests/vhost.pp | 44 + apache/spec/defines/vhost_spec.rb | 18 + apache/templates/vhost/_auth_kerb.erb | 23 + .../templates/vhost/_passenger_base_uris.erb | 7 + apache/tests/vhost.pp | 8 + ceilometer/manifests/alarm/evaluator.pp | 3 +- ceilometer/manifests/api.pp | 1 + ceilometer/manifests/collector.pp | 2 - ceilometer/manifests/db.pp | 17 +- ceilometer/manifests/db/sync.pp | 22 + .../acceptance/ceilometer_with_mysql_spec.rb | 33 +- .../acceptance/ceilometer_wsgi_apache_spec.rb | 22 +- .../spec/classes/ceilometer_api_spec.rb | 1 - .../spec/classes/ceilometer_collector_spec.rb | 4 - ceilometer/spec/classes/ceilometer_db_spec.rb | 50 +- .../spec/classes/ceilometer_db_sync_spec.rb | 44 + cinder/manifests/api.pp | 26 +- cinder/manifests/backend/netapp.pp | 15 +- cinder/manifests/backend/rbd.pp | 22 +- cinder/manifests/backup/nfs.pp | 15 +- cinder/manifests/init.pp | 108 +- cinder/manifests/logging.pp | 170 +-- cinder/manifests/scheduler.pp | 14 +- cinder/spec/acceptance/basic_cinder_spec.rb | 18 +- cinder/spec/classes/cinder_api_spec.rb | 6 +- cinder/spec/classes/cinder_logging_spec.rb | 16 - cinder/spec/classes/cinder_scheduler_spec.rb | 2 +- cinder/spec/classes/cinder_spec.rb | 35 +- .../spec/classes/cinder_volume_netapp_spec.rb | 2 +- cinder/spec/classes/cinder_volume_rbd_spec.rb | 14 +- .../defines/cinder_backend_netapp_spec.rb | 2 +- .../spec/defines/cinder_backend_rbd_spec.rb | 14 +- glance/.gitignore | 13 +- glance/CHANGELOG.md | 93 +- glance/Gemfile | 41 +- glance/Rakefile | 21 +- .../puppet/provider/glance_image/openstack.rb | 6 + glance/manifests/api.pp | 3 - glance/manifests/cache/cleaner.pp | 2 +- glance/manifests/cache/pruner.pp | 2 +- glance/manifests/client.pp | 2 +- glance/manifests/db/sync.pp | 23 + glance/manifests/policy.pp | 2 +- glance/manifests/registry.pp | 12 +- glance/metadata.json | 2 +- glance/spec/acceptance/basic_glance_spec.rb | 18 +- glance/spec/acceptance/glance_config_spec.rb | 39 +- .../acceptance/nodesets/centos-70-x64.yml | 11 + glance/spec/acceptance/nodesets/default.yml | 8 +- .../acceptance/nodesets/nodepool-centos7.yml | 2 +- .../acceptance/nodesets/nodepool-trusty.yml | 2 +- .../nodesets/ubuntu-server-1404-x64.yml | 11 + glance/spec/classes/glance_db_sync_spec.rb | 44 + glance/spec/classes/glance_registry_spec.rb | 13 - glance/spec/spec_helper.rb | 3 + glance/spec/spec_helper_acceptance.rb | 2 +- gluster/lib/facter/gluster_fsuuid.rb | 2 +- gluster/lib/facter/gluster_uuid.rb | 2 +- heat/spec/acceptance/basic_heat_spec.rb | 19 +- horizon/manifests/init.pp | 10 + .../acceptance/horizon_with_apache_spec.rb | 26 +- horizon/spec/classes/horizon_init_spec.rb | 13 +- horizon/templates/local_settings.py.erb | 49 +- ironic/spec/acceptance/basic_ironic_spec.rb | 25 +- ironic/spec/classes/ironic_bifrost_spec.rb | 8 +- keystone/files/httpd/keystone.py | 32 - keystone/lib/puppet/provider/keystone.rb | 36 +- .../provider/keystone_domain/openstack.rb | 1 + .../provider/keystone_tenant/openstack.rb | 1 + .../provider/keystone_user/openstack.rb | 8 +- keystone/manifests/endpoint.pp | 52 +- keystone/manifests/init.pp | 80 +- keystone/manifests/params.pp | 6 +- .../spec/acceptance/basic_keystone_spec.rb | 21 +- .../acceptance/keystone_wsgi_apache_spec.rb | 21 +- .../spec/classes/keystone_endpoint_spec.rb | 15 + keystone/spec/classes/keystone_spec.rb | 37 +- keystone/spec/spec_helper.rb | 13 + .../keystone_domain/openstack_spec.rb | 42 +- .../keystone_endpoint/openstack_spec.rb | 20 +- keystone/spec/unit/provider/keystone_spec.rb | 92 +- .../keystone_tenant/openstack_spec.rb | 16 +- .../provider/keystone_user/openstack_spec.rb | 102 +- .../keystone_user_role/openstack_spec.rb | 6 + manila/spec/acceptance/basic_manila_spec.rb | 18 +- manila/spec/acceptance/manila_config_spec.rb | 13 +- module-collectd/README.md | 9 + .../manifests/plugin/write_sensu.pp | 28 + .../templates/plugin/snmp.conf.erb | 4 +- .../templates/plugin/write_sensu.conf.erb | 26 + neutron/examples/cisco_ml2.pp | 18 +- neutron/manifests/agents/ml2/ovs.pp | 25 +- neutron/manifests/plugins/ml2/bigswitch.pp | 29 + .../plugins/ml2/bigswitch/restproxy.pp | 58 + neutron/manifests/plugins/ml2/cisco/nexus.pp | 12 +- .../plugins/ml2/cisco/nexus_switch.pp | 105 ++ .../plugins/ml2/cisco/nexus_switch_server.pp | 33 + neutron/spec/acceptance/basic_neutron_spec.rb | 18 +- .../spec/acceptance/neutron_config_spec.rb | 13 +- .../classes/neutron_agents_ml2_ovs_spec.rb | 33 +- ...on_plugins_ml2_bigswitch_restproxy_spec.rb | 78 ++ .../neutron_plugins_ml2_bigswitch_spec.rb | 60 + .../neutron_plugins_ml2_cisco_nexus_spec.rb | 9 +- .../templates/ml2_mech_cisco_nexus_conf.erb | 59 - .../provider/nova_network/nova_manage.rb | 7 +- nova/manifests/compute.pp | 11 + nova/manifests/init.pp | 2 +- nova/spec/acceptance/basic_nova_spec.rb | 18 +- nova/spec/classes/nova_compute_spec.rb | 6 +- .../openstack_extras_auth_file_spec.rb | 2 +- ...penstack_extras_repo_debian_debian_spec.rb | 24 +- ...penstack_extras_repo_debian_ubuntu_spec.rb | 22 +- ...penstack_extras_repo_redhat_redhat_spec.rb | 24 +- ...openstack_extras_pacemaker_service_spec.rb | 20 +- rabbitmq/README.md | 5 + rabbitmq/manifests/config.pp | 1 + rabbitmq/manifests/init.pp | 6 + rabbitmq/manifests/params.pp | 1 + rabbitmq/templates/rabbitmq.config.erb | 7 +- sahara/manifests/db.pp | 91 ++ sahara/manifests/init.pp | 218 +-- sahara/manifests/params.pp | 30 +- sahara/spec/acceptance/basic_sahara_spec.rb | 18 +- sahara/spec/classes/sahara_db_spec.rb | 62 + sahara/spec/classes/sahara_init_spec.rb | 20 +- stdlib/README.markdown | 32 + stdlib/lib/puppet/functions/is_a.rb | 32 + .../puppet/parser/functions/intersection.rb | 6 +- .../lib/puppet/parser/functions/parsejson.rb | 23 +- .../lib/puppet/parser/functions/parseyaml.rb | 20 +- .../puppet/parser/functions/validate_re.rb | 11 +- stdlib/spec/acceptance/is_a_spec.rb | 28 + stdlib/spec/acceptance/parsejson_spec.rb | 17 +- stdlib/spec/acceptance/parseyaml_spec.rb | 19 +- stdlib/spec/functions/is_a_spec.rb | 25 + stdlib/spec/functions/parsejson_spec.rb | 65 +- stdlib/spec/functions/parseyaml_spec.rb | 74 +- stdlib/spec/functions/type_of_spec.rb | 4 +- stdlib/spec/functions/validate_re_spec.rb | 15 + swift/manifests/proxy.pp | 2 + swift/manifests/storage/server.pp | 8 + swift/spec/acceptance/basic_swift_spec.rb | 18 +- swift/spec/acceptance/swift_config_spec.rb | 13 +- swift/spec/classes/swift_proxy_spec.rb | 12 + .../spec/defines/swift_storage_server_spec.rb | 11 + tripleo/.gitignore | 13 +- tripleo/.sync.yml | 3 + tripleo/Gemfile | 42 +- tripleo/Rakefile | 22 +- .../parser/functions/write_package_names.rb | 22 - .../provider/package_manifest/flat_file.rb | 39 + tripleo/lib/puppet/type/package_manifest.rb | 8 + tripleo/manifests/loadbalancer.pp | 11 +- .../acceptance/nodesets/centos-70-x64.yml | 11 + tripleo/spec/acceptance/nodesets/default.yml | 11 + .../acceptance/nodesets/nodepool-centos7.yml | 10 + .../acceptance/nodesets/nodepool-trusty.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 11 + tripleo/spec/spec_helper.rb | 3 + tripleo/spec/spec_helper_acceptance.rb | 56 + .../spec/unit/type/package_manifest_spec.rb | 37 + trove/.gitignore | 13 +- trove/Gemfile | 41 +- trove/Rakefile | 22 +- trove/spec/acceptance/basic_trove_spec.rb | 18 +- .../acceptance/nodesets/centos-70-x64.yml | 11 + trove/spec/acceptance/nodesets/default.yml | 7 +- .../acceptance/nodesets/nodepool-centos7.yml | 2 +- .../acceptance/nodesets/nodepool-trusty.yml | 2 +- .../nodesets/ubuntu-server-1404-x64.yml | 11 + trove/spec/classes/trove_init_spec.rb | 2 +- trove/spec/spec_helper.rb | 3 + vcsrepo/README.markdown | 1226 +++++++++-------- vcsrepo/lib/puppet/provider/vcsrepo/svn.rb | 14 +- vcsrepo/lib/puppet/type/vcsrepo.rb | 10 +- .../unit/puppet/provider/vcsrepo/svn_spec.rb | 22 + vswitch/spec/acceptance/basic_vswitch_spec.rb | 5 +- 180 files changed, 3479 insertions(+), 1922 deletions(-) create mode 100644 apache/templates/vhost/_auth_kerb.erb create mode 100644 apache/templates/vhost/_passenger_base_uris.erb create mode 100644 ceilometer/manifests/db/sync.pp create mode 100644 ceilometer/spec/classes/ceilometer_db_sync_spec.rb create mode 100644 glance/manifests/db/sync.pp create mode 100644 glance/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 glance/spec/classes/glance_db_sync_spec.rb delete mode 100644 keystone/files/httpd/keystone.py create mode 100644 module-collectd/manifests/plugin/write_sensu.pp create mode 100644 module-collectd/templates/plugin/write_sensu.conf.erb create mode 100644 neutron/manifests/plugins/ml2/bigswitch.pp create mode 100644 neutron/manifests/plugins/ml2/bigswitch/restproxy.pp create mode 100644 neutron/manifests/plugins/ml2/cisco/nexus_switch.pp create mode 100644 neutron/manifests/plugins/ml2/cisco/nexus_switch_server.pp create mode 100644 neutron/spec/classes/neutron_plugins_ml2_bigswitch_restproxy_spec.rb create mode 100644 neutron/spec/classes/neutron_plugins_ml2_bigswitch_spec.rb delete mode 100644 neutron/templates/ml2_mech_cisco_nexus_conf.erb create mode 100644 sahara/manifests/db.pp create mode 100644 sahara/spec/classes/sahara_db_spec.rb create mode 100644 stdlib/lib/puppet/functions/is_a.rb create mode 100644 stdlib/spec/acceptance/is_a_spec.rb create mode 100644 stdlib/spec/functions/is_a_spec.rb create mode 100644 tripleo/.sync.yml delete mode 100644 tripleo/lib/puppet/parser/functions/write_package_names.rb create mode 100644 tripleo/lib/puppet/provider/package_manifest/flat_file.rb create mode 100644 tripleo/lib/puppet/type/package_manifest.rb create mode 100644 tripleo/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 tripleo/spec/acceptance/nodesets/default.yml create mode 100644 tripleo/spec/acceptance/nodesets/nodepool-centos7.yml create mode 100644 tripleo/spec/acceptance/nodesets/nodepool-trusty.yml create mode 100644 tripleo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 tripleo/spec/spec_helper_acceptance.rb create mode 100644 tripleo/spec/unit/type/package_manifest_spec.rb create mode 100644 trove/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml diff --git a/Puppetfile b/Puppetfile index d8281cab7..e95ee0ea7 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,5 +1,5 @@ mod 'apache', - :commit => 'ec5c0e57fe09b4dc64fef2ef16823ef9a11f2e75', + :commit => '346c0e7f50664ba23a656bc1dbeeda653dedb318', :git => 'https://github.com/puppetlabs/puppetlabs-apache.git' mod 'aviator', @@ -7,7 +7,7 @@ mod 'aviator', :git => 'https://github.com/aimonb/puppet_aviator.git' mod 'ceilometer', - :commit => '7d20689bbb3857872cd63497ac45d523ed775d0d', + :commit => '67aa7266e75de57daaa88f1d8b2a6b887c64dfc6', :git => 'https://github.com/openstack/puppet-ceilometer.git' mod 'ceph', @@ -19,7 +19,7 @@ mod 'certmonger', :git => 'https://github.com/rcritten/puppet-certmonger.git' mod 'cinder', - :commit => '2f6bd73ed9dd3f5c7371784ee311fd74ce74b37b', + :commit => '3259caa0efe369f4dfe6dd69791cfade2326e435', :git => 'https://github.com/openstack/puppet-cinder.git' mod 'common', @@ -43,11 +43,11 @@ mod 'galera', :git => 'https://github.com/redhat-openstack/puppet-galera.git' mod 'glance', - :commit => 'bce0eac01c193f565e1b915c9002725800b9a069', + :commit => '03e1e00cbd2f33f937a1a2919e3c444f67fa0731', :git => 'https://github.com/openstack/puppet-glance.git' mod 'gluster', - :commit => 'e3c2486867b950a892663b7eca03bceee84c8b6e', + :commit => 'bf8bc52e6d67cea37864f22a2dd091ae988dcaa4', :git => 'https://github.com/purpleidea/puppet-gluster.git' mod 'gnocchi', @@ -59,11 +59,11 @@ mod 'haproxy', :git => 'https://github.com/puppetlabs/puppetlabs-haproxy.git' mod 'heat', - :commit => '07e52b5ac9c08b0f51ea75e8ef3709b2fd9873fb', + :commit => 'f5193ad715a3a06b00ae0894292d46af19bcfb0e', :git => 'https://github.com/openstack/puppet-heat.git' mod 'horizon', - :commit => '2eaaebdf08e66096bb3da6d52a876fbe0d8dee0e', + :commit => '4ff00b34e3af7f6608472ef0f5787e659c4fca6c', :git => 'https://github.com/openstack/puppet-horizon.git' mod 'inifile', @@ -75,7 +75,7 @@ mod 'ipa', :git => 'https://github.com/xbezdick/puppet-ipa-1.git' mod 'ironic', - :commit => '7f09ae46c15fe5fd97e39b85e7cdb63a83283c37', + :commit => '557afd41e14671f409215261ccc879818c952a4c', :git => 'https://github.com/openstack/puppet-ironic.git' mod 'keepalived', @@ -83,11 +83,11 @@ mod 'keepalived', :git => 'https://github.com/Unyonsys/puppet-module-keepalived.git' mod 'keystone', - :commit => '3f722eda30781ac47693d4112fe61a76357b94f5', + :commit => '40a1d04410e0cc2bdfd1a8fa2ccca70eb202993f', :git => 'https://github.com/openstack/puppet-keystone.git' mod 'manila', - :commit => 'c9c70763e3c7b7f2c68fc7da1fb12e7945b85e4c', + :commit => '87ed677909ecdae78a3459b13118117c740b127e', :git => 'https://github.com/openstack/puppet-manila.git' mod 'memcached', @@ -95,7 +95,7 @@ mod 'memcached', :git => 'https://github.com/saz/puppet-memcached.git' mod 'module-collectd', - :commit => 'f1d573f7ab7c1dbe5b6b827584747ffc85bf57ca', + :commit => '07378b476f892648c3ef9cac6f1b0ed481917b17', :git => 'https://github.com/pdxcat/puppet-module-collectd.git' mod 'module-data', @@ -119,11 +119,11 @@ mod 'nagios', :git => 'https://github.com/gildub/puppet-nagios-openstack.git' mod 'neutron', - :commit => 'f247f3cd5e7fff8b578091aac431518e91745342', + :commit => '3f8d040caa7143f4c117a889c464ba36db58d39e', :git => 'https://github.com/openstack/puppet-neutron.git' mod 'nova', - :commit => '6dd1d00e4094ff1fbe61bdacb33e5f1176b65905', + :commit => '21029f04f733de72d69bac3d729f68baf9038c74', :git => 'https://github.com/openstack/puppet-nova.git' mod 'nssdb', @@ -135,7 +135,7 @@ mod 'ntp', :git => 'https://github.com/puppetlabs/puppetlabs-ntp' mod 'openstack_extras', - :commit => '13f29975a6605f505f97881d1c84a3b2aa8e5514', + :commit => 'e005145df14538c04e07d213b43be50ca2551e8b', :git => 'https://github.com/openstack/puppet-openstack_extras.git' mod 'openstacklib', @@ -155,7 +155,7 @@ mod 'qpid', :git => 'https://github.com/dprince/puppet-qpid' mod 'rabbitmq', - :commit => '42c5fd883c37647947cc69b10cf7ab5a8ca03fbe', + :commit => '1e2ea5cc4844722259173335f135709972fe6dcd', :git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git' mod 'redis', @@ -171,7 +171,7 @@ mod 'rsync', :git => 'https://github.com/puppetlabs/puppetlabs-rsync.git' mod 'sahara', - :commit => '9d0826a38b306001a744f36fb2c226dce3130c9a', + :commit => '1b1e9fb9d4085200495ad09ff978f7b941d48817', :git => 'https://github.com/openstack/puppet-sahara.git' mod 'snmp', @@ -187,11 +187,11 @@ mod 'staging', :git => 'https://github.com/nanliu/puppet-staging.git' mod 'stdlib', - :commit => '2a7a93ffb49b2ae63d4fd09982fd8c382c1f4b5a', + :commit => '9b1932c538354c1b360838c8cf7b942af314c99d', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' mod 'swift', - :commit => 'bbcccfa8014d3280bc1c909b6ab0e46eae12dc4e', + :commit => '96b4f5c7c5c5fd10c0ddee41962531aa5021d906', :git => 'https://github.com/openstack/puppet-swift.git' mod 'sysctl', @@ -207,11 +207,11 @@ mod 'timezone', :git => 'https://github.com/saz/puppet-timezone.git' mod 'tripleo', - :commit => 'c529fce3ef2f246909cb821bc2319cc5413960d3', + :commit => '7ca1bbf046abfd0cc5897fba49683c62e2c33dbe', :git => 'https://github.com/openstack/puppet-tripleo.git' mod 'trove', - :commit => '3c634e122f8b086ada3744c3188a1b02e0c480a0', + :commit => '2c907a77f9a8a76516f784fbf3a2bca213876e4c', :git => 'https://github.com/openstack/puppet-trove' mod 'tuskar', @@ -219,7 +219,7 @@ mod 'tuskar', :git => 'https://github.com/openstack/puppet-tuskar.git' mod 'vcsrepo', - :commit => 'a39349a4388cd56aad5cfc8eead2f2a17f545287', + :commit => '279be07607dd132f9446291cf1afa5ef2320632a', :git => 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git' mod 'vlan', @@ -227,7 +227,7 @@ mod 'vlan', :git => 'https://github.com/derekhiggins/puppet-vlan.git' mod 'vswitch', - :commit => 'a0cc00d98e833dd905aaa291dd2bd1fa443d8455', + :commit => '934d053cb90624256df2a5468e9783d016e9f270', :git => 'https://github.com/openstack/puppet-vswitch.git' mod 'xinetd', diff --git a/apache/README.md b/apache/README.md index b6af020e6..1a4eb4d4a 100644 --- a/apache/README.md +++ b/apache/README.md @@ -1964,6 +1964,51 @@ Usage typically looks like: } ~~~ +##### `auth_kerb` + +Enable mod_auth_kerb parameters for a virtual host. Valid values are 'true' or 'false'. Defaults to 'false'. + +Usage typically looks like: + +~~~ puppet + apache::vhost {'sample.example.net': + auth_kerb => true, + krb_method_negotiate => 'on', + krb_auth_realms => ['EXAMPLE.ORG'], + krb_local_user_mapping => 'on', + directories => { + path => '/var/www/html', + auth_name => 'Kerberos Login', + auth_type => 'Kerberos', + auth_require => 'valid-user', + } + } +~~~ + +##### `krb_method_negotiate` + +To enable or disable the use of the Negotiate method. Defaults is 'on' + +##### `krb_method_k5passwd` + +To enable or disable the use of password based authentication for Kerberos v5. Default is 'on' + +##### `krb_authoritative` + +If set to off this directive allow authentication controls to be pass on to another modules. Default is 'on' + +##### `krb_auth_realms` + +Specifies an array Kerberos realm(s) to be used for authentication. Default is [] + +##### `krb_5keytab` + +Location of the Kerberos V5 keytab file. Not set by default. + +##### `krb_local_user_mapping` + +Strips @REALM from username for further use. Not set by default. + ##### `logroot` Specifies the location of the virtual host's logfiles. Defaults to '/var/log//'. @@ -2140,6 +2185,10 @@ This directive is equivalent to proxy_pass, but takes regular expressions, see [ Specifies the resource identifiers for a rack configuration. The file paths specified are listed as rack application roots for [Phusion Passenger](http://www.modrails.com/documentation/Users%20guide%20Apache.html#_railsbaseuri_and_rackbaseuri) in the _rack.erb template. Defaults to 'undef'. +#####`passenger_base_uris` + +Used to specify that the given URI is a Phusion Passenger-served application. The file paths specified are listed as passenger application roots for [Phusion Passenger](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerBaseURI) in the _passenger_base_uris.erb template. Defaults to 'undef'. + ##### `redirect_dest` Specifies the address to redirect to. Defaults to 'undef'. diff --git a/apache/manifests/package.pp b/apache/manifests/package.pp index 728b26010..5c59f2546 100644 --- a/apache/manifests/package.pp +++ b/apache/manifests/package.pp @@ -17,11 +17,11 @@ } 'worker': { $set = 'MPM_WORKER' - $unset = 'MPM_PERFORK MPM_EVENT' + $unset = 'MPM_PREFORK MPM_EVENT' } 'event': { $set = 'MPM_EVENT' - $unset = 'MPM_PERFORK MPM_WORKER' + $unset = 'MPM_PREFORK MPM_WORKER' } 'itk': { $set = undef diff --git a/apache/manifests/vhost.pp b/apache/manifests/vhost.pp index c44bba589..42a3a373b 100644 --- a/apache/manifests/vhost.pp +++ b/apache/manifests/vhost.pp @@ -81,6 +81,7 @@ $redirectmatch_regexp = undef, $redirectmatch_dest = undef, $rack_base_uris = undef, + $passenger_base_uris = undef, $headers = undef, $request_headers = undef, $filters = undef, @@ -123,6 +124,13 @@ $modsec_disable_ids = undef, $modsec_disable_ips = undef, $modsec_body_limit = undef, + $auth_kerb = false, + $krb_method_negotiate = 'on', + $krb_method_k5passwd = 'on', + $krb_authoritative = 'on', + $krb_auth_realms = [], + $krb_5keytab = undef, + $krb_local_user_mapping = undef, ) { # The base class must be included first because it is used by parameter defaults if ! defined(Class['apache']) { @@ -213,6 +221,7 @@ validate_re($allow_encoded_slashes, '(^on$|^off$|^nodecode$)', "${allow_encoded_slashes} is not permitted for allow_encoded_slashes. Allowed values are 'on', 'off' or 'nodecode'.") } + validate_bool($auth_kerb) # Input validation ends if $ssl and $ensure == 'present' { @@ -221,6 +230,10 @@ include ::apache::mod::mime } + if $auth_kerb and $ensure == 'present' { + include ::apache::mod::auth_kerb + } + if $virtual_docroot { include ::apache::mod::vhost_alias } @@ -387,6 +400,11 @@ } } + # Load mod_passenger if needed and not yet loaded + if $passenger_base_uris { + include ::apache::mod::passenger + } + # Load mod_fastci if needed and not yet loaded if $fastcgi_server and $fastcgi_socket { if ! defined(Class['apache::mod::fastcgi']) { @@ -656,6 +674,16 @@ } } + # Template uses: + # - $passenger_base_uris + if $passenger_base_uris { + concat::fragment { "${name}-passenger_uris": + target => "${priority_real}${filename}.conf", + order => 155, + content => template('apache/vhost/_passenger_base_uris.erb'), + } + } + # Template uses: # - $redirect_source # - $redirect_dest @@ -751,6 +779,22 @@ } } + # Template uses: + # - $auth_kerb + # - $krb_method_negotiate + # - $krb_method_k5passwd + # - $krb_authoritative + # - $krb_auth_realms + # - $krb_5keytab + # - $krb_local_user_mapping + if $auth_kerb { + concat::fragment { "${name}-auth_kerb": + target => "${priority_real}${filename}.conf", + order => 210, + content => template('apache/vhost/_auth_kerb.erb'), + } + } + # Template uses: # - $suphp_engine # - $suphp_addhandler diff --git a/apache/spec/defines/vhost_spec.rb b/apache/spec/defines/vhost_spec.rb index 3b9a6fdbd..713d8726d 100644 --- a/apache/spec/defines/vhost_spec.rb +++ b/apache/spec/defines/vhost_spec.rb @@ -252,6 +252,7 @@ 'redirectmatch_regexp' => ['\.git$'], 'redirectmatch_dest' => ['http://www.example.com'], 'rack_base_uris' => ['/rackapp1'], + 'passenger_base_uris' => ['/passengerapp1'], 'headers' => 'Set X-Robots-Tag "noindex, noarchive, nosnippet"', 'request_headers' => ['append MirrorID "mirror 12"'], 'rewrites' => [ @@ -313,6 +314,13 @@ 'passenger_start_timeout' => '600', 'passenger_pre_start' => 'http://localhost/myapp', 'add_default_charset' => 'UTF-8', + 'auth_kerb' => true, + 'krb_method_negotiate' => 'off', + 'krb_method_k5passwd' => 'off', + 'krb_authoritative' => 'off', + 'krb_auth_realms' => ['EXAMPLE.ORG','EXAMPLE.NET'], + 'krb_5keytab' => '/tmp/keytab5', + 'krb_local_user_mapping' => 'off', } end let :facts do @@ -432,6 +440,16 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-passenger') } it { is_expected.to contain_concat__fragment('rspec.example.com-charsets') } it { is_expected.to contain_concat__fragment('rspec.example.com-file_footer') } + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb').with( + :content => /^\s+KrbMethodNegotiate\soff$/)} + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb').with( + :content => /^\s+KrbAuthoritative\soff$/)} + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb').with( + :content => /^\s+KrbAuthRealms\sEXAMPLE.ORG\sEXAMPLE.NET$/)} + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb').with( + :content => /^\s+Krb5Keytab\s\/tmp\/keytab5$/)} + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb').with( + :content => /^\s+KrbLocalUserMapping\soff$/)} end context 'set only aliases' do let :params do diff --git a/apache/templates/vhost/_auth_kerb.erb b/apache/templates/vhost/_auth_kerb.erb new file mode 100644 index 000000000..9179ee8b2 --- /dev/null +++ b/apache/templates/vhost/_auth_kerb.erb @@ -0,0 +1,23 @@ +<% if @auth_kerb -%> + + ## Kerberos directives + <%- if @krb_method_negotiate -%> + KrbMethodNegotiate <%= @krb_method_negotiate %> + <%- end -%> + <%- if @krb_method_k5passwd -%> + KrbMethodK5Passwd <%= @krb_method_k5passwd %> + <%- end -%> + <%- if @krb_authoritative -%> + KrbAuthoritative <%= @krb_authoritative %> + <%- end -%> + <%- if @krb_auth_realms and @krb_auth_realms.length >= 1 -%> + KrbAuthRealms <%= @krb_auth_realms.join(' ') %> + <%- end -%> + <%- if @krb_5keytab -%> + Krb5Keytab <%= @krb_5keytab %> + <%- end -%> + <%- if @krb_local_user_mapping -%> + KrbLocalUserMapping <%= @krb_local_user_mapping -%> + <%- end -%> + +<% end -%> diff --git a/apache/templates/vhost/_passenger_base_uris.erb b/apache/templates/vhost/_passenger_base_uris.erb new file mode 100644 index 000000000..f3ef5aa0a --- /dev/null +++ b/apache/templates/vhost/_passenger_base_uris.erb @@ -0,0 +1,7 @@ +<% if @passenger_base_uris -%> + + ## Enable passenger base uris +<% Array(@passenger_base_uris).each do |uri| -%> + PassengerBaseURI <%= uri %> +<% end -%> +<% end -%> diff --git a/apache/tests/vhost.pp b/apache/tests/vhost.pp index a46b67784..0cf8da75c 100644 --- a/apache/tests/vhost.pp +++ b/apache/tests/vhost.pp @@ -141,6 +141,7 @@ rack_base_uris => ['/rackapp1', '/rackapp2'], } + # Vhost to redirect non-ssl to ssl apache::vhost { 'sixteenth.example.com non-ssl': servername => 'sixteenth.example.com', @@ -251,3 +252,10 @@ access_log_env_var => 'admin', } +# Vhost with a passenger_base configuration +apache::vhost { 'twentysecond.example.com': + port => '80', + docroot => '/var/www/twentysecond', + rack_base_uris => ['/passengerapp1', '/passengerapp2'], +} + diff --git a/ceilometer/manifests/alarm/evaluator.pp b/ceilometer/manifests/alarm/evaluator.pp index 29ad75d25..57993762a 100644 --- a/ceilometer/manifests/alarm/evaluator.pp +++ b/ceilometer/manifests/alarm/evaluator.pp @@ -41,7 +41,8 @@ include ::ceilometer::params - validate_re("${evaluation_interval}",'^(\d+)$') + # Cast $evaluation_interval to a string + validate_re("${evaluation_interval}",'^(\d+)$') # lint:ignore:only_variable_string Ceilometer_config<||> ~> Service['ceilometer-alarm-evaluator'] diff --git a/ceilometer/manifests/api.pp b/ceilometer/manifests/api.pp index b188db777..c28ac4045 100644 --- a/ceilometer/manifests/api.pp +++ b/ceilometer/manifests/api.pp @@ -115,6 +115,7 @@ $service_ensure = 'stopped' } } + Package['ceilometer-common'] -> Service[$service_name] if $service_name == $::ceilometer::params::api_service_name { diff --git a/ceilometer/manifests/collector.pp b/ceilometer/manifests/collector.pp index c651a01bb..8e22a93eb 100644 --- a/ceilometer/manifests/collector.pp +++ b/ceilometer/manifests/collector.pp @@ -53,8 +53,6 @@ if $manage_service { if $enabled { $service_ensure = 'running' - Class['ceilometer::db'] -> Service['ceilometer-collector'] - Exec['ceilometer-dbsync'] ~> Service['ceilometer-collector'] } else { $service_ensure = 'stopped' } diff --git a/ceilometer/manifests/db.pp b/ceilometer/manifests/db.pp index fd121d99a..a6acd77d1 100644 --- a/ceilometer/manifests/db.pp +++ b/ceilometer/manifests/db.pp @@ -50,12 +50,6 @@ } } - if $sync_db { - $command = $::ceilometer::params::dbsync_command - } else { - $command = '/bin/true' - } - if $backend_package and !defined(Package[$backend_package]) { package {'ceilometer-backend-package': ensure => present, @@ -68,15 +62,8 @@ 'database/connection': value => $database_connection, secret => true; } - Ceilometer_config['database/connection'] ~> Exec['ceilometer-dbsync'] - - exec { 'ceilometer-dbsync': - command => $command, - path => '/usr/bin', - user => $::ceilometer::params::user, - refreshonly => true, - logoutput => on_failure, - subscribe => Ceilometer_config['database/connection'] + if $sync_db { + include ::ceilometer::db::sync } } diff --git a/ceilometer/manifests/db/sync.pp b/ceilometer/manifests/db/sync.pp new file mode 100644 index 000000000..fd9d7fa35 --- /dev/null +++ b/ceilometer/manifests/db/sync.pp @@ -0,0 +1,22 @@ +# +# Class to execute ceilometer dbsync +# +class ceilometer::db::sync { + + include ::ceilometer::params + + Package<| tag == 'ceilometer-package' |> ~> Exec['ceilometer-dbsync'] + Exec['ceilometer-dbsync'] ~> Service <| tag == 'ceilometer-service' |> + + Ceilometer_config<||> -> Exec['ceilometer-dbsync'] + Ceilometer_config<| title == 'database/connection' |> ~> Exec['ceilometer-dbsync'] + + exec { 'ceilometer-dbsync': + command => $::ceilometer::params::dbsync_command, + path => '/usr/bin', + user => $::ceilometer::params::user, + refreshonly => true, + logoutput => on_failure, + } + +} diff --git a/ceilometer/spec/acceptance/ceilometer_with_mysql_spec.rb b/ceilometer/spec/acceptance/ceilometer_with_mysql_spec.rb index 155ac9ba3..bcf5ae333 100644 --- a/ceilometer/spec/acceptance/ceilometer_with_mysql_spec.rb +++ b/ceilometer/spec/acceptance/ceilometer_with_mysql_spec.rb @@ -8,30 +8,41 @@ pp= <<-EOS Exec { logoutput => 'on_failure' } + # make sure apache is stopped before ceilometer-api eventlet + # in case of wsgi was run before + class { '::apache': + service_ensure => 'stopped', + } + Service['httpd'] -> Service['keystone'] + # Common resources case $::osfamily { 'Debian': { include ::apt - apt::ppa { 'ppa:ubuntu-cloud-archive/liberty-staging': - # it's false by default in 2.x series but true in 1.8.x - package_manage => false, + class { '::openstack_extras::repo::debian::ubuntu': + release => 'liberty', + repo => 'proposed', + package_require => true, } - Exec['apt_update'] -> Package<||> $package_provider = 'apt' } 'RedHat': { class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/ceilometer/spec/acceptance/ceilometer_wsgi_apache_spec.rb b/ceilometer/spec/acceptance/ceilometer_wsgi_apache_spec.rb index d731de218..ed22fbe86 100644 --- a/ceilometer/spec/acceptance/ceilometer_wsgi_apache_spec.rb +++ b/ceilometer/spec/acceptance/ceilometer_wsgi_apache_spec.rb @@ -13,14 +13,32 @@ 'Debian': { include ::apt class { '::openstack_extras::repo::debian::ubuntu': - release => 'kilo', + release => 'liberty', + repo => 'proposed', package_require => true, } $package_provider = 'apt' } 'RedHat': { class { '::openstack_extras::repo::redhat::redhat': - release => 'kilo', + manage_rdo => false, + repo_hash => { + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', + 'gpgcheck' => 'no', + }, + }, } package { 'openstack-selinux': ensure => 'latest' } $package_provider = 'yum' diff --git a/ceilometer/spec/classes/ceilometer_api_spec.rb b/ceilometer/spec/classes/ceilometer_api_spec.rb index e9f7f3d13..094e2181b 100644 --- a/ceilometer/spec/classes/ceilometer_api_spec.rb +++ b/ceilometer/spec/classes/ceilometer_api_spec.rb @@ -91,7 +91,6 @@ :hasstatus => true, :hasrestart => true, :require => 'Class[Ceilometer::Db]', - :subscribe => 'Exec[ceilometer-dbsync]', :tag => 'ceilometer-service', ) end diff --git a/ceilometer/spec/classes/ceilometer_collector_spec.rb b/ceilometer/spec/classes/ceilometer_collector_spec.rb index bd7a9e2c7..6a0ade1ca 100644 --- a/ceilometer/spec/classes/ceilometer_collector_spec.rb +++ b/ceilometer/spec/classes/ceilometer_collector_spec.rb @@ -69,10 +69,6 @@ ) end - it 'configures relationships on database' do - is_expected.to contain_class('ceilometer::db').with_before(['Service[ceilometer-collector]']) - is_expected.to contain_exec('ceilometer-dbsync').with_notify(['Service[ceilometer-collector]']) - end end context 'when disabled' do diff --git a/ceilometer/spec/classes/ceilometer_db_spec.rb b/ceilometer/spec/classes/ceilometer_db_spec.rb index a4c897fd1..da580ecd8 100644 --- a/ceilometer/spec/classes/ceilometer_db_spec.rb +++ b/ceilometer/spec/classes/ceilometer_db_spec.rb @@ -25,14 +25,8 @@ is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true) end - it 'runs ceilometer-dbsync' do - is_expected.to contain_exec('ceilometer-dbsync').with( - :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf', - :path => '/usr/bin', - :refreshonly => 'true', - :user => 'ceilometer', - :logoutput => 'on_failure' - ) + it 'includes ceilometer::db::sync' do + is_expected.to contain_class('ceilometer::db::sync') end end @@ -59,14 +53,8 @@ is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true) end - it 'runs ceilometer-dbsync' do - is_expected.to contain_exec('ceilometer-dbsync').with( - :command => '/bin/true', - :path => '/usr/bin', - :refreshonly => 'true', - :user => 'ceilometer', - :logoutput => 'on_failure' - ) + it 'does not include ceilometer::db::sync' do + is_expected.not_to contain_class('ceilometer::db::sync') end end @@ -92,14 +80,8 @@ :name => 'python-pymongo') end - it 'runs ceilometer-dbsync' do - is_expected.to contain_exec('ceilometer-dbsync').with( - :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf', - :path => '/usr/bin', - :refreshonly => 'true', - :user => 'ceilometer', - :logoutput => 'on_failure' - ) + it 'includes ceilometer::db::sync' do + is_expected.to contain_class('ceilometer::db::sync') end end @@ -124,14 +106,8 @@ is_expected.to contain_ceilometer_config('database/connection').with_value( params[:database_connection] ).with_secret(true) end - it 'runs ceilometer-dbsync' do - is_expected.to contain_exec('ceilometer-dbsync').with( - :command => '/bin/true', - :path => '/usr/bin', - :refreshonly => 'true', - :user => 'ceilometer', - :logoutput => 'on_failure' - ) + it 'does not include ceilomter::db::sync' do + is_expected.not_to contain_class('ceilometer::db::sync') end end @@ -154,14 +130,8 @@ :name => 'python-pysqlite2') end - it 'runs ceilometer-dbsync' do - is_expected.to contain_exec('ceilometer-dbsync').with( - :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf', - :path => '/usr/bin', - :refreshonly => 'true', - :user => 'ceilometer', - :logoutput => 'on_failure' - ) + it 'includes ceilometer::db::sync' do + is_expected.to contain_class('ceilometer::db::sync') end end diff --git a/ceilometer/spec/classes/ceilometer_db_sync_spec.rb b/ceilometer/spec/classes/ceilometer_db_sync_spec.rb new file mode 100644 index 000000000..9e3761ba8 --- /dev/null +++ b/ceilometer/spec/classes/ceilometer_db_sync_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'ceilometer::db::sync' do + + shared_examples_for 'ceilometer-dbsync' do + + it 'runs ceilometer-dbsync' do + is_expected.to contain_exec('ceilometer-dbsync').with( + :command => 'ceilometer-dbsync --config-file=/etc/ceilometer/ceilometer.conf', + :path => '/usr/bin', + :refreshonly => 'true', + :user => 'ceilometer', + :logoutput => 'on_failure' + ) + end + + end + + context 'on a RedHat osfamily' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7.0', + :concat_basedir => '/var/lib/puppet/concat' + } + end + + it_configures 'ceilometer-dbsync' + end + + context 'on a Debian osfamily' do + let :facts do + { + :operatingsystemrelease => '7.8', + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :concat_basedir => '/var/lib/puppet/concat' + } + end + + it_configures 'ceilometer-dbsync' + end + +end diff --git a/cinder/manifests/api.pp b/cinder/manifests/api.pp index c8baf18af..5b0d60ceb 100644 --- a/cinder/manifests/api.pp +++ b/cinder/manifests/api.pp @@ -38,7 +38,7 @@ # (optional) Some operations require cinder to make API requests # to Nova. This sets the keystone region to be used for these # requests. For example, boot-from-volume. -# Defaults to undef. +# Defaults to ''. # # [*nova_catalog_info*] # (optional) Match this value when searching for nova in the service @@ -106,7 +106,7 @@ # This should contain the name of the default volume type to use. # If not configured, it produces an error when creating a volume # without specifying a type. -# Defaults to 'false'. +# Defaults to ''. # # [*validate*] # (optional) Whether to validate the service is working after any service refreshes @@ -139,16 +139,16 @@ $keystone_user = 'cinder', $auth_uri = false, $identity_uri = false, - $os_region_name = undef, $nova_catalog_info = 'compute:Compute Service:publicURL', $nova_catalog_admin_info = 'compute:Compute Service:adminURL', + $os_region_name = '', $service_workers = $::processorcount, $package_ensure = 'present', $bind_host = '0.0.0.0', $enabled = true, $manage_service = true, $ratelimits = undef, - $default_volume_type = false, + $default_volume_type = '', $ratelimits_factory = 'cinder.api.v1.limits:RateLimitingMiddleware.factory', $validate = false, @@ -207,12 +207,8 @@ cinder_config { 'DEFAULT/osapi_volume_listen': value => $bind_host; 'DEFAULT/osapi_volume_workers': value => $service_workers; - } - - if $os_region_name { - cinder_config { - 'DEFAULT/os_region_name': value => $os_region_name; - } + 'DEFAULT/os_region_name': value => $os_region_name; + 'DEFAULT/default_volume_type': value => $default_volume_type; } cinder_config { @@ -342,16 +338,6 @@ } } - if $default_volume_type { - cinder_config { - 'DEFAULT/default_volume_type': value => $default_volume_type; - } - } else { - cinder_config { - 'DEFAULT/default_volume_type': ensure => absent; - } - } - if $validate { $defaults = { 'cinder-api' => { diff --git a/cinder/manifests/backend/netapp.pp b/cinder/manifests/backend/netapp.pp index ec2255dfe..36dbf23a2 100644 --- a/cinder/manifests/backend/netapp.pp +++ b/cinder/manifests/backend/netapp.pp @@ -112,7 +112,7 @@ # [*nfs_mount_options*] # (optional) Mount options passed to the nfs client. See section # of the nfs man page for details. -# Defaults to undef +# Defaults to '' # # [*netapp_copyoffload_tool_path*] # (optional) This option specifies the path of the NetApp Copy Offload tool @@ -197,7 +197,7 @@ $thres_avl_size_perc_stop = '60', $nfs_shares = undef, $nfs_shares_config = '/etc/cinder/shares.conf', - $nfs_mount_options = undef, + $nfs_mount_options = '', $netapp_copyoffload_tool_path = undef, $netapp_controller_ips = undef, $netapp_sa_password = undef, @@ -216,17 +216,8 @@ } } - if $nfs_mount_options { - cinder_config { - "${name}/nfs_mount_options": value => $nfs_mount_options; - } - } else { - cinder_config { - "${name}/nfs_mount_options": ensure => absent; - } - } - cinder_config { + "${name}/nfs_mount_options": value => $nfs_mount_options; "${name}/volume_backend_name": value => $volume_backend_name; "${name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver'; "${name}/netapp_login": value => $netapp_login; diff --git a/cinder/manifests/backend/rbd.pp b/cinder/manifests/backend/rbd.pp index d6fcf3865..4ba62b223 100644 --- a/cinder/manifests/backend/rbd.pp +++ b/cinder/manifests/backend/rbd.pp @@ -25,12 +25,12 @@ # # [*rbd_secret_uuid*] # (optional) A required parameter to use cephx. -# Defaults to false +# Defaults to '' # # [*volume_tmp_dir*] # (optional) Location to store temporary image files if the volume # driver does not write them directly to the volume -# Defaults to false +# Defaults to '' # # [*rbd_max_clone_depth*] # (optional) Maximum number of nested clones that can be taken of a @@ -50,8 +50,8 @@ $volume_backend_name = $name, $rbd_ceph_conf = '/etc/ceph/ceph.conf', $rbd_flatten_volume_from_snapshot = false, - $rbd_secret_uuid = false, - $volume_tmp_dir = false, + $rbd_secret_uuid = '', + $volume_tmp_dir = '', $rbd_max_clone_depth = '5', $extra_options = {}, ) { @@ -67,18 +67,8 @@ "${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth; "${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot; "${name}/host": value => "rbd:${rbd_pool}"; - } - - if $rbd_secret_uuid { - cinder_config {"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;} - } else { - cinder_config {"${name}/rbd_secret_uuid": ensure => absent;} - } - - if $volume_tmp_dir { - cinder_config {"${name}/volume_tmp_dir": value => $volume_tmp_dir;} - } else { - cinder_config {"${name}/volume_tmp_dir": ensure => absent;} + "${name}/rbd_secret_uuid": value => $rbd_secret_uuid; + "${name}/volume_tmp_dir": value => $volume_tmp_dir; } create_resources('cinder_config', $extra_options) diff --git a/cinder/manifests/backup/nfs.pp b/cinder/manifests/backup/nfs.pp index 08f3f59c7..d541bfc6c 100644 --- a/cinder/manifests/backup/nfs.pp +++ b/cinder/manifests/backup/nfs.pp @@ -37,7 +37,7 @@ # # [*backup_mount_options*] # (optional) The mount options that are passed to the NFS client. -# Defaults to undef +# Defaults to '' # # [*backup_container*] # (optional) Custom container to use for backups. @@ -75,24 +75,15 @@ $backup_sha_block_size_bytes = 32768, $backup_enable_progress_timer = true, $backup_mount_point_base = '$state_path/backup_mount', - $backup_mount_options = undef, + $backup_mount_options = '', $backup_container = undef, $backup_compression_algorithm = 'zlib', ) { validate_string($backup_share) - if $backup_mount_options { - cinder_config { - 'DEFAULT/backup_mount_options': value => $backup_mount_options; - } - } else { - cinder_config { - 'DEFAULT/backup_mount_options': ensure => absent; - } - } - cinder_config { + 'DEFAULT/backup_mount_options': value => $backup_mount_options; 'DEFAULT/backup_share': value => $backup_share; 'DEFAULT/backup_driver': value => $backup_driver; 'DEFAULT/backup_file_size': value => $backup_file_size; diff --git a/cinder/manifests/init.pp b/cinder/manifests/init.pp index 518d3b530..e0bfff7f0 100644 --- a/cinder/manifests/init.pp +++ b/cinder/manifests/init.pp @@ -35,7 +35,7 @@ # # [*database_max_pool_size*] # Maximum number of SQL connections to keep open in a pool. -# (Optional) Defaults to undef. +# (Optional) Defaults to '' # # [*database_max_retries*] # Maximum db connection retries during startup. @@ -48,7 +48,7 @@ # # [*database_max_overflow*] # If set, use this value for max_overflow with sqlalchemy. -# (Optional) Defaults to undef. +# (Optional) Defaults to "' # # [*rpc_backend*] # (Optional) Use these options to configure the RabbitMQ message system. @@ -105,21 +105,21 @@ # # [*kombu_ssl_ca_certs*] # (optional) SSL certification authority file (valid only if SSL enabled). -# Defaults to undef +# Defaults to '' # # [*kombu_ssl_certfile*] # (optional) SSL cert file (valid only if SSL enabled). -# Defaults to undef +# Defaults to '' # # [*kombu_ssl_keyfile*] # (optional) SSL key file (valid only if SSL enabled). -# Defaults to undef +# Defaults to '' # # [*kombu_ssl_version*] # (optional) SSL version to use (valid only if SSL enabled). # Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be # available on some distributions. -# Defaults to 'TLSv1' +# Defaults to '' # # [*amqp_durable_queues*] # Use durable queues in amqp. @@ -184,7 +184,7 @@ # [*log_dir*] # (optional) Directory where logs should be stored. # If set to boolean false, it will not log to any directory. -# Defaults to '/var/log/cinder' +# Defaults to '' # # [*use_ssl*] # (optional) Enable SSL on the API server @@ -200,7 +200,7 @@ # # [*ca_file*] # (optional) CA certificate file to use to verify connecting clients -# Defaults to false, not set_ +# Defaults to '' # # [*storage_availability_zone*] # (optional) Availability zone of the node. @@ -239,10 +239,10 @@ $database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite', $database_idle_timeout = '3600', $database_min_pool_size = '1', - $database_max_pool_size = undef, + $database_max_pool_size = '', $database_max_retries = '10', $database_retry_interval = '10', - $database_max_overflow = undef, + $database_max_overflow = '', $rpc_backend = 'cinder.openstack.common.rpc.impl_kombu', $control_exchange = 'openstack', $rabbit_host = '127.0.0.1', @@ -254,10 +254,10 @@ $rabbit_userid = 'guest', $rabbit_password = false, $rabbit_use_ssl = false, - $kombu_ssl_ca_certs = undef, - $kombu_ssl_certfile = undef, - $kombu_ssl_keyfile = undef, - $kombu_ssl_version = 'TLSv1', + $kombu_ssl_ca_certs = '', + $kombu_ssl_certfile = '', + $kombu_ssl_keyfile = '', + $kombu_ssl_version = '', $amqp_durable_queues = false, $qpid_hostname = 'localhost', $qpid_port = '5672', @@ -275,14 +275,14 @@ $qpid_tcp_nodelay = true, $package_ensure = 'present', $use_ssl = false, - $ca_file = false, + $ca_file = '', $cert_file = false, $key_file = false, $api_paste_config = '/etc/cinder/api-paste.ini', $use_syslog = false, $use_stderr = true, $log_facility = 'LOG_USER', - $log_dir = '/var/log/cinder', + $log_dir = '', $verbose = false, $debug = false, $storage_availability_zone = 'nova', @@ -331,6 +331,10 @@ 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; + 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; + 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; + 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile; + 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; 'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; 'DEFAULT/control_exchange': value => $control_exchange; @@ -349,35 +353,6 @@ cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } } - if $rabbit_use_ssl { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version } - - if $kombu_ssl_ca_certs { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs } - } else { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent} - } - - if $kombu_ssl_certfile { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile } - } else { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent} - } - - if $kombu_ssl_keyfile { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile } - } else { - cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent} - } - } else { - cinder_config { - 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent; - 'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent; - } - } - } if $rpc_backend == 'cinder.openstack.common.rpc.impl_qpid' { @@ -430,6 +405,9 @@ 'database/min_pool_size': value => $database_min_pool_size; 'database/max_retries': value => $database_max_retries; 'database/retry_interval': value => $database_retry_interval; + 'database/max_pool_size': value => $database_max_pool_size; + 'database/max_overflow': value => $database_max_overflow; + 'DEFAULT/log_dir': value => $log_dir; 'DEFAULT/verbose': value => $verbose; 'DEFAULT/debug': value => $debug; 'DEFAULT/use_stderr': value => $use_stderr; @@ -439,26 +417,6 @@ 'DEFAULT/default_availability_zone': value => $default_availability_zone_real; } - if $database_max_pool_size { - cinder_config { - 'database/max_pool_size': value => $database_max_pool_size; - } - } else { - cinder_config { - 'database/max_pool_size': ensure => absent; - } - } - - if $database_max_overflow { - cinder_config { - 'database/max_overflow': value => $database_max_overflow; - } - } else { - cinder_config { - 'database/max_overflow': ensure => absent; - } - } - if($database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { require 'mysql::bindings' require 'mysql::bindings::python' @@ -470,30 +428,12 @@ fail("Invalid db connection ${database_connection}") } - if $log_dir { - cinder_config { - 'DEFAULT/log_dir': value => $log_dir; - } - } else { - cinder_config { - 'DEFAULT/log_dir': ensure => absent; - } - } - # SSL Options if $use_ssl { cinder_config { 'DEFAULT/ssl_cert_file' : value => $cert_file; 'DEFAULT/ssl_key_file' : value => $key_file; - } - if $ca_file { - cinder_config { 'DEFAULT/ssl_ca_file' : - value => $ca_file, - } - } else { - cinder_config { 'DEFAULT/ssl_ca_file' : - ensure => absent, - } + 'DEFAULT/ssl_ca_file' : value => $ca_file; } } else { cinder_config { diff --git a/cinder/manifests/logging.pp b/cinder/manifests/logging.pp index 091ac83f6..7765ac780 100644 --- a/cinder/manifests/logging.pp +++ b/cinder/manifests/logging.pp @@ -6,29 +6,29 @@ # # [*logging_context_format_string*] # (Optional) Format string to use for log messages with context. -# Defaults to undef. +# Defaults to '' # Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\ # [%(request_id)s %(user_identity)s] %(instance)s%(message)s' # # [*logging_default_format_string*] # (Optional) Format string to use for log messages without context. -# Defaults to undef. +# Defaults to '' # Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\ # [-] %(instance)s%(message)s' # # [*logging_debug_format_suffix*] # (Optional) Formatted data to append to log format when level is DEBUG. -# Defaults to undef. +# Defaults to '' # Example: '%(funcName)s %(pathname)s:%(lineno)d' # # [*logging_exception_prefix*] # (Optional) Prefix each line of exception output with this format. -# Defaults to undef. +# Defaults to '' # Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s' # # [*log_config_append*] # The name of an additional logging configuration file. -# Defaults to undef. +# Defaults to '' # See https://docs.python.org/2/howto/logging.html # # [*default_log_levels*] @@ -42,167 +42,65 @@ # # [*publish_errors*] # (optional) Publish error events (boolean value). -# Defaults to undef (false if unconfigured). +# Defaults to '' # # [*fatal_deprecations*] # (optional) Make deprecations fatal (boolean value) -# Defaults to undef (false if unconfigured). +# Defaults to '' # # [*instance_format*] # (optional) If an instance is passed with the log message, format it # like this (string value). -# Defaults to undef. +# Defaults to '' # Example: '[instance: %(uuid)s] ' # # [*instance_uuid_format*] # (optional) If an instance UUID is passed with the log message, format # it like this (string value). -# Defaults to undef. +# Defaults to '' # Example: instance_uuid_format='[instance: %(uuid)s] ' # # [*log_date_format*] # (optional) Format string for %%(asctime)s in log records. -# Defaults to undef. +# Defaults to '' # Example: 'Y-%m-%d %H:%M:%S' # class cinder::logging( - $logging_context_format_string = undef, - $logging_default_format_string = undef, - $logging_debug_format_suffix = undef, - $logging_exception_prefix = undef, - $log_config_append = undef, + $logging_context_format_string = '', + $logging_default_format_string = '', + $logging_debug_format_suffix = '', + $logging_exception_prefix = '', + $log_config_append = '', $default_log_levels = undef, - $publish_errors = undef, - $fatal_deprecations = undef, - $instance_format = undef, - $instance_uuid_format = undef, - $log_date_format = undef, + $publish_errors = '', + $fatal_deprecations = '', + $instance_format = '', + $instance_uuid_format = '', + $log_date_format = '', ) { - if $logging_context_format_string { - cinder_config { - 'DEFAULT/logging_context_format_string' : - value => $logging_context_format_string; - } - } - else { - cinder_config { - 'DEFAULT/logging_context_format_string' : ensure => absent; - } - } - - if $logging_default_format_string { - cinder_config { - 'DEFAULT/logging_default_format_string' : - value => $logging_default_format_string; - } - } - else { - cinder_config { - 'DEFAULT/logging_default_format_string' : ensure => absent; - } - } - - if $logging_debug_format_suffix { - cinder_config { - 'DEFAULT/logging_debug_format_suffix' : - value => $logging_debug_format_suffix; - } - } - else { - cinder_config { - 'DEFAULT/logging_debug_format_suffix' : ensure => absent; - } - } - - if $logging_exception_prefix { - cinder_config { - 'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix; - } - } - else { - cinder_config { - 'DEFAULT/logging_exception_prefix' : ensure => absent; - } - } - - if $log_config_append { - cinder_config { - 'DEFAULT/log_config_append' : value => $log_config_append; - } - } - else { - cinder_config { - 'DEFAULT/log_config_append' : ensure => absent; - } - } + cinder_config { + 'DEFAULT/logging_context_format_string' : value => $logging_context_format_string; + 'DEFAULT/logging_default_format_string' : value => $logging_default_format_string; + 'DEFAULT/logging_debug_format_suffix' : value => $logging_debug_format_suffix; + 'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix; + 'DEFAULT/log_config_append' : value => $log_config_append; + 'DEFAULT/publish_errors' : value => $publish_errors; + 'DEFAULT/fatal_deprecations' : value => $fatal_deprecations; + 'DEFAULT/instance_format' : value => $instance_format; + 'DEFAULT/instance_uuid_format' : value => $instance_uuid_format; + 'DEFAULT/log_date_format' : value => $log_date_format; + } if $default_log_levels { cinder_config { 'DEFAULT/default_log_levels' : value => join(sort(join_keys_to_values($default_log_levels, '=')), ','); - } } - else { + } else { cinder_config { 'DEFAULT/default_log_levels' : ensure => absent; - } - } - - if $publish_errors { - cinder_config { - 'DEFAULT/publish_errors' : value => $publish_errors; - } - } - else { - cinder_config { - 'DEFAULT/publish_errors' : ensure => absent; - } } - - if $fatal_deprecations { - cinder_config { - 'DEFAULT/fatal_deprecations' : value => $fatal_deprecations; - } - } - else { - cinder_config { - 'DEFAULT/fatal_deprecations' : ensure => absent; - } - } - - if $instance_format { - cinder_config { - 'DEFAULT/instance_format' : value => $instance_format; - } - } - else { - cinder_config { - 'DEFAULT/instance_format' : ensure => absent; - } - } - - if $instance_uuid_format { - cinder_config { - 'DEFAULT/instance_uuid_format' : value => $instance_uuid_format; - } - } - else { - cinder_config { - 'DEFAULT/instance_uuid_format' : ensure => absent; - } - } - - if $log_date_format { - cinder_config { - 'DEFAULT/log_date_format' : value => $log_date_format; - } - } - else { - cinder_config { - 'DEFAULT/log_date_format' : ensure => absent; - } - } - + } } diff --git a/cinder/manifests/scheduler.pp b/cinder/manifests/scheduler.pp index f72969d2c..a3f66ae42 100644 --- a/cinder/manifests/scheduler.pp +++ b/cinder/manifests/scheduler.pp @@ -6,7 +6,7 @@ # # [*scheduler_driver*] # (Optional) Default scheduler driver to use -# Defaults to 'false'. +# Defaults to ''. # # [*package_ensure*] # (Optioanl) The state of the package. @@ -22,7 +22,7 @@ # # class cinder::scheduler ( - $scheduler_driver = false, + $scheduler_driver = '', $package_ensure = 'present', $enabled = true, $manage_service = true @@ -34,15 +34,7 @@ Cinder_api_paste_ini<||> ~> Service['cinder-scheduler'] Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler'] - if $scheduler_driver { - cinder_config { - 'DEFAULT/scheduler_driver': value => $scheduler_driver; - } - } else { - cinder_config { - 'DEFAULT/scheduler_driver': ensure => absent; - } - } + cinder_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; } if $::cinder::params::scheduler_package { Package['cinder-scheduler'] -> Service['cinder-scheduler'] diff --git a/cinder/spec/acceptance/basic_cinder_spec.rb b/cinder/spec/acceptance/basic_cinder_spec.rb index 38f792aaa..2c8a311d5 100644 --- a/cinder/spec/acceptance/basic_cinder_spec.rb +++ b/cinder/spec/acceptance/basic_cinder_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/cinder/spec/classes/cinder_api_spec.rb b/cinder/spec/classes/cinder_api_spec.rb index f28dcd1a2..cf0bc29d3 100644 --- a/cinder/spec/classes/cinder_api_spec.rb +++ b/cinder/spec/classes/cinder_api_spec.rb @@ -38,7 +38,10 @@ :value => 'compute:Compute Service:adminURL' ) is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with( - :ensure => 'absent' + :value => '' + ) + is_expected.to contain_cinder_config('DEFAULT/os_region_name').with( + :value => '' ) is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with( :value => 'http' @@ -75,7 +78,6 @@ :value => 'http://localhost:5000/' ) - is_expected.to_not contain_cinder_config('DEFAULT/os_region_name') end end diff --git a/cinder/spec/classes/cinder_logging_spec.rb b/cinder/spec/classes/cinder_logging_spec.rb index 3e0adbf49..f8ee7ee36 100644 --- a/cinder/spec/classes/cinder_logging_spec.rb +++ b/cinder/spec/classes/cinder_logging_spec.rb @@ -34,10 +34,6 @@ it_configures 'logging params set' end - context 'without extended logging options' do - it_configures 'logging params unset' - end - end shared_examples_for 'logging params set' do @@ -76,18 +72,6 @@ end end - - shared_examples_for 'logging params unset' do - [ :logging_context_format_string, :logging_default_format_string, - :logging_debug_format_suffix, :logging_exception_prefix, - :log_config_append, :publish_errors, - :default_log_levels, :fatal_deprecations, - :instance_format, :instance_uuid_format, - :log_date_format, ].each { |param| - it { is_expected.to contain_cinder_config("DEFAULT/#{param}").with_ensure('absent') } - } - end - context 'on Debian platforms' do let :facts do { :osfamily => 'Debian' } diff --git a/cinder/spec/classes/cinder_scheduler_spec.rb b/cinder/spec/classes/cinder_scheduler_spec.rb index d4505741c..4416b3e3f 100644 --- a/cinder/spec/classes/cinder_scheduler_spec.rb +++ b/cinder/spec/classes/cinder_scheduler_spec.rb @@ -11,7 +11,7 @@ describe 'with default parameters' do it { is_expected.to contain_class('cinder::params') } - it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_ensure('absent') } + it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('') } it { is_expected.to contain_package('cinder-scheduler').with( :name => 'cinder-scheduler', diff --git a/cinder/spec/classes/cinder_spec.rb b/cinder/spec/classes/cinder_spec.rb index 4f2af3769..483bd3c5b 100644 --- a/cinder/spec/classes/cinder_spec.rb +++ b/cinder/spec/classes/cinder_spec.rb @@ -35,17 +35,17 @@ is_expected.to contain_cinder_config('database/connection').with(:value => 'mysql://user:password@host/database', :secret => true) is_expected.to contain_cinder_config('database/idle_timeout').with(:value => '3600') is_expected.to contain_cinder_config('database/min_pool_size').with(:value => '1') - is_expected.to contain_cinder_config('database/max_pool_size').with_ensure('absent') + is_expected.to contain_cinder_config('database/max_pool_size').with(:value => '') is_expected.to contain_cinder_config('database/max_retries').with(:value => '10') is_expected.to contain_cinder_config('database/retry_interval').with(:value => '10') - is_expected.to contain_cinder_config('database/max_overflow').with_ensure('absent') + is_expected.to contain_cinder_config('database/max_overflow').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/verbose').with(:value => false) is_expected.to contain_cinder_config('DEFAULT/debug').with(:value => false) is_expected.to contain_cinder_config('DEFAULT/use_stderr').with(:value => true) is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova') is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova') is_expected.to contain_cinder_config('DEFAULT/api_paste_config').with(:value => '/etc/cinder/api-paste.ini') - is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder') + is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '') is_expected.to contain_cinder_config('DEFAULT/lock_path').with(:value => '/var/lock/cinder') end @@ -181,10 +181,10 @@ it do is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') end end @@ -192,19 +192,19 @@ let :params do req_params.merge!({ :rabbit_use_ssl => false, - :kombu_ssl_ca_certs => 'undef', - :kombu_ssl_certfile => 'undef', - :kombu_ssl_keyfile => 'undef', - :kombu_ssl_version => 'TLSv1' + :kombu_ssl_ca_certs => '', + :kombu_ssl_certfile => '', + :kombu_ssl_keyfile => '', + :kombu_ssl_version => '' }) end it do is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('') end end @@ -239,11 +239,6 @@ it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') } end - describe 'with log_dir disabled' do - let(:params) { req_params.merge!({:log_dir => false}) } - it { is_expected.to contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') } - end - describe 'with different lock_path' do let(:params) { req_params.merge!({:lock_path => '/var/run/cinder.locks'}) } it { is_expected.to contain_cinder_config('DEFAULT/lock_path').with_value('/var/run/cinder.locks') } diff --git a/cinder/spec/classes/cinder_volume_netapp_spec.rb b/cinder/spec/classes/cinder_volume_netapp_spec.rb index ab442c40e..8ccc8acb0 100644 --- a/cinder/spec/classes/cinder_volume_netapp_spec.rb +++ b/cinder/spec/classes/cinder_volume_netapp_spec.rb @@ -30,7 +30,7 @@ :thres_avl_size_perc_stop => '60', :nfs_shares_config => '/etc/cinder/shares.conf', :netapp_eseries_host_type => 'linux_dm_mp', - :nfs_mount_options => nil, + :nfs_mount_options => '', :netapp_webservice_path => '/devmgr/v2', } end diff --git a/cinder/spec/classes/cinder_volume_rbd_spec.rb b/cinder/spec/classes/cinder_volume_rbd_spec.rb index 2a70b8f1d..0d5e6f376 100644 --- a/cinder/spec/classes/cinder_volume_rbd_spec.rb +++ b/cinder/spec/classes/cinder_volume_rbd_spec.rb @@ -5,10 +5,10 @@ { :rbd_pool => 'volumes', :rbd_user => 'test', - :rbd_secret_uuid => '0123456789', + :rbd_secret_uuid => '', :rbd_ceph_conf => '/foo/boo/zoo/ceph.conf', :rbd_flatten_volume_from_snapshot => true, - :volume_tmp_dir => '/foo/tmp', + :volume_tmp_dir => '', :rbd_max_clone_depth => '0', } end @@ -42,16 +42,6 @@ :notify => 'Service[cinder-volume]') end - context 'with rbd_secret_uuid disabled' do - let(:params) { req_params.merge!({:rbd_secret_uuid => false}) } - it { is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_ensure('absent') } - end - - context 'with volume_tmp_dir disabled' do - let(:params) { req_params.merge!({:volume_tmp_dir => false}) } - it { is_expected.to contain_cinder_config('DEFAULT/volume_tmp_dir').with_ensure('absent') } - end - end describe 'rbd volume driver with additional configuration' do diff --git a/cinder/spec/defines/cinder_backend_netapp_spec.rb b/cinder/spec/defines/cinder_backend_netapp_spec.rb index 21631a00d..37d38f9fc 100644 --- a/cinder/spec/defines/cinder_backend_netapp_spec.rb +++ b/cinder/spec/defines/cinder_backend_netapp_spec.rb @@ -33,7 +33,7 @@ :thres_avl_size_perc_stop => '60', :nfs_shares_config => '/etc/cinder/shares.conf', :netapp_eseries_host_type => 'linux_dm_mp', - :nfs_mount_options => nil, + :nfs_mount_options => '', :netapp_webservice_path => '/devmgr/v2', } end diff --git a/cinder/spec/defines/cinder_backend_rbd_spec.rb b/cinder/spec/defines/cinder_backend_rbd_spec.rb index be6b96343..b0d54e4b5 100644 --- a/cinder/spec/defines/cinder_backend_rbd_spec.rb +++ b/cinder/spec/defines/cinder_backend_rbd_spec.rb @@ -9,10 +9,10 @@ :volume_backend_name => 'rbd-ssd', :rbd_pool => 'volumes', :rbd_user => 'test', - :rbd_secret_uuid => '0123456789', + :rbd_secret_uuid => '', :rbd_ceph_conf => '/foo/boo/zoo/ceph.conf', :rbd_flatten_volume_from_snapshot => true, - :volume_tmp_dir => '/foo/tmp', + :volume_tmp_dir => '', :rbd_max_clone_depth => '0' } end @@ -45,16 +45,6 @@ :notify => 'Service[cinder-volume]') end - context 'with rbd_secret_uuid disabled' do - let(:params) { req_params.merge!({:rbd_secret_uuid => false}) } - it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_ensure('absent') } - end - - context 'with volume_tmp_dir disabled' do - let(:params) { req_params.merge!({:volume_tmp_dir => false}) } - it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') } - end - context 'with another RBD backend' do let :pre_condition do "cinder::backend::rbd { 'ceph2': diff --git a/glance/.gitignore b/glance/.gitignore index bde49f4db..4dd84f06e 100644 --- a/glance/.gitignore +++ b/glance/.gitignore @@ -1,5 +1,10 @@ -spec/fixtures/modules/* -spec/fixtures/manifests/* -*swp -pkg +pkg/ Gemfile.lock +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml diff --git a/glance/CHANGELOG.md b/glance/CHANGELOG.md index c3a1b33fc..b8f42eee9 100644 --- a/glance/CHANGELOG.md +++ b/glance/CHANGELOG.md @@ -4,27 +4,27 @@ This is a backwards-incompatible major release for OpenStack Kilo. ####Backwards-incompatible changes -- Move rabbit/kombu settings to oslo_messaging_rabbit section -- Remove sql_connection and sql_idle_timeout deprecated parameters -- api: change default pipeline -- Separate api and registry packages for Red Hat -- python-ceph no longer exists in el7, use python-rbd +- Move rabbit/kombu settings to oslo_messaging_rabbit section. +- Remove sql_connection and sql_idle_timeout deprecated parameters. +- api: change default pipeline. +- Separate api and registry packages for Red Hat. +- python-ceph no longer exists in el7, use python-rbd. ####Features -- Puppet 4.x support -- Refactorise Keystone resources management -- Migrate postgresql backend to use openstacklib::db::postgresql -- Add support for identity_uri -- Service Validation for Glance-API -- Create a sync_db boolean for Glance -- make service description configurable +- Puppet 4.x support. +- Refactorise Keystone resources management. +- Migrate postgresql backend to use openstacklib::db::postgresql. +- Add support for identity_uri. +- Service Validation for Glance-API. +- Create a sync_db boolean for Glance. +- make service description configurable. ####Bugfixes -- Fix API/Registry ensure for Ubuntu +- Fix API/Registry ensure for Ubuntu. ####Maintenance -- Acceptance tests with Beaker -- Fix spec tests for RSpec 3.x and Puppet 4.x +- Acceptance tests with Beaker. +- Fix spec tests for RSpec 3.x and Puppet 4.x. ##2015-06-17 - 5.1.0 ###Summary @@ -32,26 +32,26 @@ This is a backwards-incompatible major release for OpenStack Kilo. This is a feature and bugfix release in the Juno series. ####Features -- Add service validation for Glance-API -- Switch to TLSv1 -- Makes kombu_ssl_* parameters optional when rabbit_use_ssl => true -- Allow overriding package ensure for glance-registry -- Add openstack tag to glance packages -- Create a sync_db boolean for Glance -- Command parameter to sync the correct Database -- Add $notification_driver parameter to notify::rabbitmq +- Add service validation for Glance-API. +- Switch to TLSv1. +- Makes kombu_ssl_* parameters optional when rabbit_use_ssl => true. +- Allow overriding package ensure for glance-registry. +- Add openstack tag to glance packages. +- Create a sync_db boolean for Glance. +- Command parameter to sync the correct Database. +- Add $notification_driver parameter to notify::rabbitmq. ####Bugfixes -- Move rbd related options into glance_store section -- Change default MySQL collate to utf8_general_ci -- Correctly munge glance_image is_public property -- Fix catalog compilation when not configuring endpoint -- Fix is_public munge +- Move rbd related options into glance_store section. +- Change default MySQL collate to utf8_general_ci. +- Correctly munge glance_image is_public property. +- Fix catalog compilation when not configuring endpoint. +- Fix is_public munge. ####Maintenance -- spec: pin rspec-puppet to 1.0.1 -- Pin puppetlabs-concat to 1.2.1 in fixtures -- Update .gitreview file for project rename +- spec: pin rspec-puppet to 1.0.1. +- Pin puppetlabs-concat to 1.2.1 in fixtures. +- Update .gitreview file for project rename. ##2014-11-24 - 5.0.0 ###Summary @@ -59,26 +59,25 @@ This is a feature and bugfix release in the Juno series. This is a backwards-incompatible major release for OpenStack Juno. ####Backwards-incompatible changes -- Bump stdlib dependency to >=4.0.0 +- Bump stdlib dependency to >=4.0.0. - Migrate the mysql backend to use openstacklib::db::mysql, adding dependency - on puppet-openstacklib + on puppet-openstacklib. ####Features -- Add ceilometer::policy to control policy.json -- Add parameter os_region_name to glance::api -- Add support for vSphere datastore backend -- Update the calls to the glance command-line utility -- Add parameter swift_store_large_object_size to glance::backend::swift -- Add parameter command_options to glance::cache::cleaner and - glance::cache::pruner -- Add parameter package_ensure to glance::backend::rbd -- Add parameter manage_service to various classes -- Add parameters to control whether to configure users -- Add parameter registery_client_protocol to glance::api +- Add ceilometer::policy to control policy.json. +- Add parameter os_region_name to glance::api. +- Add support for vSphere datastore backend. +- Update the calls to the glance command-line utility. +- Add parameter swift_store_large_object_size to glance::backend::swift. +- Add parameter command_options to glance::cache::cleaner and glance::cache::pruner. +- Add parameter package_ensure to glance::backend::rbd. +- Add parameter manage_service to various classes. +- Add parameters to control whether to configure users. +- Add parameter registery_client_protocol to glance::api. ####Bugfixes -- Fix bug in glance_image type -- Fix ssl parameter requirements for kombu and rabbit +- Fix bug in glance_image type. +- Fix ssl parameter requirements for kombu and rabbit. ##2014-10-16 - 4.2.0 ###Summary @@ -87,7 +86,7 @@ This is a feature release in the Icehouse series. ####Features -- Add ability to hide secret type parameters from logs +- Add ability to hide secret type parameters from logs. ##2014-06-19 - 4.1.0 ###Summary diff --git a/glance/Gemfile b/glance/Gemfile index 9ea211333..6d4ce9a07 100644 --- a/glance/Gemfile +++ b/glance/Gemfile @@ -1,25 +1,30 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.1.0', :require => false - - gem 'metadata-json-lint' - gem 'puppet-lint-param-docs' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-absolute_template_path' - gem 'puppet-lint-trailing_newline-check' + gem 'puppetlabs_spec_helper', :require => 'false' + gem 'rspec-puppet', '~> 2.2.0', :require => 'false' + gem 'metadata-json-lint', :require => 'false' + gem 'puppet-lint-param-docs', :require => 'false' + gem 'puppet-lint-absolute_classname-check', :require => 'false' + gem 'puppet-lint-absolute_template_path', :require => 'false' + gem 'puppet-lint-trailing_newline-check', :require => 'false' + gem 'puppet-lint-unquoted_string-check', :require => 'false' + gem 'puppet-lint-leading_zero-check', :require => 'false' + gem 'puppet-lint-variable_contains_upcase', :require => 'false' + gem 'puppet-lint-numericvariable', :require => 'false' + gem 'json', :require => 'false' + gem 'webmock', :require => 'false' +end - # Puppet 4.x related lint checks - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-variable_contains_upcase' - gem 'puppet-lint-numericvariable' +group :system_tests do + gem 'beaker-rspec', :require => 'false' + gem 'beaker-puppet_install_helper', :require => 'false' +end - gem 'beaker-rspec', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'json' - gem 'webmock' +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/glance/Rakefile b/glance/Rakefile index 4c2b2ed07..bc08f437c 100644 --- a/glance/Rakefile +++ b/glance/Rakefile @@ -1,6 +1,21 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetSyntax.exclude_paths ||= [] +PuppetSyntax.exclude_paths << "spec/fixtures/**/*" +PuppetSyntax.exclude_paths << "pkg/**/*" +PuppetSyntax.exclude_paths << "vendor/**/*" + +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] + config.fail_on_warnings = true + config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' + config.disable_checks = ["80chars", "class_inherits_from_params_class", "class_parameter_defaults", "only_variable_string"] +end + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end diff --git a/glance/lib/puppet/provider/glance_image/openstack.rb b/glance/lib/puppet/provider/glance_image/openstack.rb index 726281501..134b33104 100644 --- a/glance/lib/puppet/provider/glance_image/openstack.rb +++ b/glance/lib/puppet/provider/glance_image/openstack.rb @@ -10,6 +10,12 @@ @credentials = Puppet::Provider::Openstack::CredentialsV2_0.new + # glanceclient support `image create` (in v2 API) but not openstackclient + # openstackclient now uses image v2 API by default. + # in the meantime it's implemented in openstackclient, hardcode version + # see https://bugs.launchpad.net/python-openstackclient/+bug/1405562 + ENV['OS_IMAGE_API_VERSION'] = '1' + def initialize(value={}) super(value) @property_flush = {} diff --git a/glance/manifests/api.pp b/glance/manifests/api.pp index e517601d1..95b39c813 100644 --- a/glance/manifests/api.pp +++ b/glance/manifests/api.pp @@ -258,9 +258,6 @@ # adding all of this stuff b/c it devstack says glance-api uses the # db now - Glance_api_config<||> ~> Exec<| title == 'glance-manage db_sync' |> - Glance_cache_config<||> ~> Exec<| title == 'glance-manage db_sync' |> - Exec<| title == 'glance-manage db_sync' |> ~> Service['glance-api'] Glance_api_config<||> ~> Service['glance-api'] Glance_cache_config<||> ~> Service['glance-api'] Class['glance::policy'] ~> Service['glance-api'] diff --git a/glance/manifests/cache/cleaner.pp b/glance/manifests/cache/cleaner.pp index 3ac2226d6..6536d5612 100644 --- a/glance/manifests/cache/cleaner.pp +++ b/glance/manifests/cache/cleaner.pp @@ -24,7 +24,7 @@ # (eg. point to config file, or redirect output) # (optional) Defaults to ''. # -class glance::cache::cleaner ( +class glance::cache::cleaner( $minute = 1, $hour = 0, $monthday = '*', diff --git a/glance/manifests/cache/pruner.pp b/glance/manifests/cache/pruner.pp index cdff84947..848e5bd59 100644 --- a/glance/manifests/cache/pruner.pp +++ b/glance/manifests/cache/pruner.pp @@ -24,7 +24,7 @@ # (eg. point to config file, or redirect output) # (optional) Defaults to ''. # -class glance::cache::pruner ( +class glance::cache::pruner( $minute = '*/30', $hour = '*', $monthday = '*', diff --git a/glance/manifests/client.pp b/glance/manifests/client.pp index efcdf563f..190cbf25f 100644 --- a/glance/manifests/client.pp +++ b/glance/manifests/client.pp @@ -6,7 +6,7 @@ # (Optional) Ensure state for pachage. # Defaults to 'present' # -class glance::client ( +class glance::client( $ensure = 'present' ) { diff --git a/glance/manifests/db/sync.pp b/glance/manifests/db/sync.pp new file mode 100644 index 000000000..4a0b76f86 --- /dev/null +++ b/glance/manifests/db/sync.pp @@ -0,0 +1,23 @@ +# +# Class to execute glance dbsync +# +class glance::db::sync { + + include ::glance::params + + Package<| tag == 'glance-package' |> ~> Exec['glance-manage db_sync'] + Exec['glance-manage db_sync'] ~> Service<| tag == 'glance-service' |> + + Glance_registry_config<||> ~> Exec['glance-manage db_sync'] + Glance_api_config<||> ~> Exec['glance-manage db_sync'] + Glance_cache_config<||> ~> Exec['glance-manage db_sync'] + + exec { 'glance-manage db_sync': + command => $::glance::params::db_sync_command, + path => '/usr/bin', + user => 'glance', + refreshonly => true, + logoutput => on_failure, + } + +} diff --git a/glance/manifests/policy.pp b/glance/manifests/policy.pp index bf1d8e45d..4edb46179 100644 --- a/glance/manifests/policy.pp +++ b/glance/manifests/policy.pp @@ -23,7 +23,7 @@ # (optional) Path to the glance policy.json file # Defaults to /etc/glance/policy.json # -class glance::policy ( +class glance::policy( $policies = {}, $policy_path = '/etc/glance/policy.json', ) { diff --git a/glance/manifests/registry.pp b/glance/manifests/registry.pp index 5a40ae837..eb2d392d3 100644 --- a/glance/manifests/registry.pp +++ b/glance/manifests/registry.pp @@ -184,7 +184,6 @@ Package[$glance::params::registry_package_name] -> File['/etc/glance/'] - Glance_registry_config<||> ~> Exec<| title == 'glance-manage db_sync' |> Glance_registry_config<||> ~> Service['glance-registry'] File { @@ -369,16 +368,7 @@ } if $sync_db { - Exec['glance-manage db_sync'] ~> Service['glance-registry'] - - exec { 'glance-manage db_sync': - command => $::glance::params::db_sync_command, - path => '/usr/bin', - user => 'glance', - refreshonly => true, - logoutput => on_failure, - subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']], - } + include ::glance::db::sync } if $manage_service { diff --git a/glance/metadata.json b/glance/metadata.json index c9c386242..616fb45d2 100644 --- a/glance/metadata.json +++ b/glance/metadata.json @@ -33,7 +33,7 @@ "dependencies": [ { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" }, { "name": "openstack/keystone", "version_requirement": ">=6.0.0 <7.0.0" }, - { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, + { "name": "puppetlabs/stdlib", "version_requirement": ">=4.2.0 <5.0.0" }, { "name": "openstack/openstacklib", "version_requirement": ">=6.0.0 <7.0.0" } ] } diff --git a/glance/spec/acceptance/basic_glance_spec.rb b/glance/spec/acceptance/basic_glance_spec.rb index 2ced41e8c..1f4484c3a 100644 --- a/glance/spec/acceptance/basic_glance_spec.rb +++ b/glance/spec/acceptance/basic_glance_spec.rb @@ -22,15 +22,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/glance/spec/acceptance/glance_config_spec.rb b/glance/spec/acceptance/glance_config_spec.rb index b8bc9967f..8910394f7 100644 --- a/glance/spec/acceptance/glance_config_spec.rb +++ b/glance/spec/acceptance/glance_config_spec.rb @@ -87,27 +87,36 @@ end describe file('/etc/glance/glance-api.conf') do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.not_to match /thisshouldnotexist/ } + end end describe file('/etc/glance/glance-registry.conf') do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.not_to match /thisshouldnotexist/ } + end end describe file('/etc/glance/glance-cache.conf') do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.not_to match /thisshouldnotexist/ } + end end end end diff --git a/glance/spec/acceptance/nodesets/centos-70-x64.yml b/glance/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 000000000..5f097e9fe --- /dev/null +++ b/glance/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/glance/spec/acceptance/nodesets/default.yml b/glance/spec/acceptance/nodesets/default.yml index da9eac860..486b6a34e 100644 --- a/glance/spec/acceptance/nodesets/default.yml +++ b/glance/spec/acceptance/nodesets/default.yml @@ -1,10 +1,10 @@ HOSTS: - ubuntu-14.04-amd64: + ubuntu-server-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 - box : puppetlabs/ubuntu-14.04-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm - hypervisor : vagrant + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant CONFIG: type: foss diff --git a/glance/spec/acceptance/nodesets/nodepool-centos7.yml b/glance/spec/acceptance/nodesets/nodepool-centos7.yml index 575ae6732..c55287420 100644 --- a/glance/spec/acceptance/nodesets/nodepool-centos7.yml +++ b/glance/spec/acceptance/nodesets/nodepool-centos7.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: el-7-x86_64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/glance/spec/acceptance/nodesets/nodepool-trusty.yml b/glance/spec/acceptance/nodesets/nodepool-trusty.yml index a95d9f38d..9fc624e24 100644 --- a/glance/spec/acceptance/nodesets/nodepool-trusty.yml +++ b/glance/spec/acceptance/nodesets/nodepool-trusty.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: ubuntu-14.04-amd64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..8001929b2 --- /dev/null +++ b/glance/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/glance/spec/classes/glance_db_sync_spec.rb b/glance/spec/classes/glance_db_sync_spec.rb new file mode 100644 index 000000000..c0e224ec5 --- /dev/null +++ b/glance/spec/classes/glance_db_sync_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'glance::db::sync' do + + shared_examples_for 'glance-dbsync' do + + it 'runs glance-manage db_sync' do + is_expected.to contain_exec('glance-manage db_sync').with( + :command => 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync', + :path => '/usr/bin', + :user => 'glance', + :refreshonly => 'true', + :logoutput => 'on_failure' + ) + end + + end + + context 'on a RedHat osfamily' do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7.0', + :concat_basedir => '/var/lib/puppet/concat' + } + end + + it_configures 'glance-dbsync' + end + + context 'on a Debian osfamily' do + let :facts do + { + :operatingsystemrelease => '7.8', + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :concat_basedir => '/var/lib/puppet/concat' + } + end + + it_configures 'glance-dbsync' + end + +end diff --git a/glance/spec/classes/glance_registry_spec.rb b/glance/spec/classes/glance_registry_spec.rb index 639dfe5a7..6799125d2 100644 --- a/glance/spec/classes/glance_registry_spec.rb +++ b/glance/spec/classes/glance_registry_spec.rb @@ -79,19 +79,6 @@ 'tag' => 'glance-service', )} - it 'is_expected.to only sync the db if sync_db is enabled' do - - if param_hash[:sync_db] - is_expected.to contain_exec('glance-manage db_sync').with( - 'path' => '/usr/bin', - 'command' => 'glance-manage --config-file=/etc/glance/glance-registry.conf db_sync', - 'refreshonly' => true, - 'logoutput' => 'on_failure', - 'subscribe' => ['Package[glance-registry]', 'File[/etc/glance/glance-registry.conf]'], - 'notify' => ["Service[glance-registry]"] - ) - end - end it 'is_expected.to not sync the db if sync_db is set to false' do if !param_hash[:sync_db] diff --git a/glance/spec/spec_helper.rb b/glance/spec/spec_helper.rb index 78594f8ae..3be0498d1 100644 --- a/glance/spec/spec_helper.rb +++ b/glance/spec/spec_helper.rb @@ -2,8 +2,11 @@ $LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib')) require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' +require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/glance/spec/spec_helper_acceptance.rb b/glance/spec/spec_helper_acceptance.rb index e29c01cd3..429e807c4 100644 --- a/glance/spec/spec_helper_acceptance.rb +++ b/glance/spec/spec_helper_acceptance.rb @@ -50,7 +50,7 @@ on host, "rm -fr #{repo}" # List modules installed to help with debugging - on host, puppet('module','list'), { :acceptable_exit_codes => [0] } + on host, puppet('module','list'), { :acceptable_exit_codes => 0 } end end end diff --git a/gluster/lib/facter/gluster_fsuuid.rb b/gluster/lib/facter/gluster_fsuuid.rb index bd16eb685..58ee4a7ad 100644 --- a/gluster/lib/facter/gluster_fsuuid.rb +++ b/gluster/lib/facter/gluster_fsuuid.rb @@ -111,7 +111,7 @@ # in our vardir if it doesn't already exist... if not File.exist?(uuidfile) uuidgen = `which uuidgen 2> /dev/null`.chomp - if uuidgen = '' + if uuidgen == '' uuidgen = '/usr/bin/uuidgen' end result = system(uuidgen + " > '" + uuidfile + "'") diff --git a/gluster/lib/facter/gluster_uuid.rb b/gluster/lib/facter/gluster_uuid.rb index f8de610f5..147ba57bb 100644 --- a/gluster/lib/facter/gluster_uuid.rb +++ b/gluster/lib/facter/gluster_uuid.rb @@ -83,7 +83,7 @@ # create a uuid and store it in our vardir if it doesn't already exist! if create uuidgen = `which uuidgen 2> /dev/null`.chomp - if uuidgen = '' + if uuidgen == '' uuidgen = '/usr/bin/uuidgen' end result = system(uuidgen + " > '" + uuidfile + "'") diff --git a/heat/spec/acceptance/basic_heat_spec.rb b/heat/spec/acceptance/basic_heat_spec.rb index 1413c0b3b..84521d407 100644 --- a/heat/spec/acceptance/basic_heat_spec.rb +++ b/heat/spec/acceptance/basic_heat_spec.rb @@ -21,7 +21,24 @@ class { '::openstack_extras::repo::debian::ubuntu': } 'RedHat': { class { '::openstack_extras::repo::redhat::redhat': - release => 'kilo', + manage_rdo => false, + repo_hash => { + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', + 'gpgcheck' => 'no', + }, + }, } package { 'openstack-selinux': ensure => 'latest' } $package_provider = 'yum' diff --git a/horizon/manifests/init.pp b/horizon/manifests/init.pp index 37abe80ab..d00b2818f 100644 --- a/horizon/manifests/init.pp +++ b/horizon/manifests/init.pp @@ -147,6 +147,11 @@ # [*listen_ssl*] # (optional) Enable SSL support in Apache. (Defaults to false) # +# [*ssl_no_verify*] +# (optionsl) Disable SSL hostname verifying. Set it if you don't have +# properly configured DNS which will resolve hostnames for SSL endpoints +# Horizon will connect to. (Defaults to false) +# # [*ssl_redirect*] # (optional) Whether to redirect http to https # Defaults to True @@ -260,6 +265,7 @@ $server_aliases = $::fqdn, $allowed_hosts = $::fqdn, $listen_ssl = false, + $ssl_no_verify = false, $ssl_redirect = true, $horizon_cert = undef, $horizon_key = undef, @@ -323,6 +329,10 @@ Service <| title == 'memcached' |> -> Class['horizon'] + $hypervisor_options_real = merge($hypervisor_defaults,$hypervisor_options) + $cinder_options_real = merge($cinder_defaults,$cinder_options) + $neutron_options_real = merge($neutron_defaults,$neutron_options) + package { 'horizon': ensure => $package_ensure, name => $::horizon::params::package_name, diff --git a/horizon/spec/acceptance/horizon_with_apache_spec.rb b/horizon/spec/acceptance/horizon_with_apache_spec.rb index 069d06e73..ff9bca9dd 100644 --- a/horizon/spec/acceptance/horizon_with_apache_spec.rb +++ b/horizon/spec/acceptance/horizon_with_apache_spec.rb @@ -11,25 +11,29 @@ case $::osfamily { 'Debian': { include ::apt - apt::ppa { 'ppa:ubuntu-cloud-archive/liberty-staging': - # it's false by default in 2.x series but true in 1.8.x - package_manage => false, + class { '::openstack_extras::repo::debian::ubuntu': + release => 'liberty', + repo => 'proposed', + package_require => true, } - Exec['apt_update'] -> Package<||> } 'RedHat': { class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/horizon/spec/classes/horizon_init_spec.rb b/horizon/spec/classes/horizon_init_spec.rb index 519afd759..b57c7a258 100644 --- a/horizon/spec/classes/horizon_init_spec.rb +++ b/horizon/spec/classes/horizon_init_spec.rb @@ -41,7 +41,6 @@ is_expected.to contain_class('horizon::wsgi::apache').with({ :servername => 'some.host.tld', :listen_ssl => false, - :servername => 'some.host.tld', :extra_params => {}, :redirect_type => 'permanent', }) @@ -56,13 +55,13 @@ 'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"', " 'can_set_mount_point': True,", " 'can_set_password': False,", - " 'enable_lb': False,", + " 'enable_distributed_router': False,", " 'enable_firewall': False,", + " 'enable_ha_router': False,", + " 'enable_lb': False,", " 'enable_quotas': True,", " 'enable_security_group': True,", " 'enable_vpn': False,", - " 'enable_distributed_router': False,", - " 'enable_ha_router': False,", 'API_RESULT_LIMIT = 1000', "LOGIN_URL = '#{platforms_params[:root_url]}/auth/login/'", "LOGOUT_URL = '#{platforms_params[:root_url]}/auth/logout/'", @@ -90,6 +89,7 @@ :django_session_engine => 'django.contrib.sessions.backends.cache', :keystone_default_role => 'SwiftOperator', :keystone_url => 'https://keystone.example.com:4682', + :ssl_no_verify => true, :log_handler => 'syslog', :log_level => 'DEBUG', :openstack_endpoint_type => 'internalURL', @@ -122,11 +122,12 @@ 'SESSION_ENGINE = "django.contrib.sessions.backends.cache"', 'OPENSTACK_KEYSTONE_URL = "https://keystone.example.com:4682"', 'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "SwiftOperator"', + 'OPENSTACK_SSL_NO_VERIFY = True', " 'can_set_mount_point': False,", " 'can_set_password': True,", " 'enable_backup': True,", - " 'enable_lb': True,", " 'enable_firewall': True,", + " 'enable_lb': True,", " 'enable_quotas': False,", " 'enable_security_group': False,", " 'enable_vpn': True,", @@ -138,7 +139,7 @@ " 'level': 'DEBUG',", " 'handlers': ['syslog'],", 'COMPRESS_OFFLINE = False', - "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'" + "FILE_UPLOAD_TEMP_DIR = '/var/spool/horizon'", ]) end diff --git a/horizon/templates/local_settings.py.erb b/horizon/templates/local_settings.py.erb index 051c844de..617daadb7 100644 --- a/horizon/templates/local_settings.py.erb +++ b/horizon/templates/local_settings.py.erb @@ -164,7 +164,10 @@ OPENSTACK_KEYSTONE_URL = "<%= @keystone_url %>" OPENSTACK_KEYSTONE_DEFAULT_ROLE = "<%= @keystone_default_role %>" # Disable SSL certificate checks (useful for self-signed certificates): -# OPENSTACK_SSL_NO_VERIFY = True +# OPENSTACK_SSL_NO_VERIFY = False +<% if @ssl_no_verify %> +OPENSTACK_SSL_NO_VERIFY = True +<% end -%> # The CA certificate to use to verify SSL connections # OPENSTACK_SSL_CACERT = '/path/to/cacert.pem' @@ -186,39 +189,41 @@ OPENSTACK_KEYSTONE_BACKEND = { # The OPENSTACK_HYPERVISOR_FEATURES settings can be used to enable optional # services provided by hypervisors. +<%- if ! (@hypervisor_options_real.empty?) -%> OPENSTACK_HYPERVISOR_FEATURES = { - <%- @hypervisor_options = @hypervisor_defaults.merge(@hypervisor_options) -%> - 'can_set_mount_point': <%= @hypervisor_options['can_set_mount_point'].to_s.capitalize %>, - 'can_set_password': <%= @hypervisor_options['can_set_password'].to_s.capitalize %>, +<%- @hypervisor_options_real.sort.each do |opt_name,opt_val| -%> + '<%= opt_name -%>': <%= opt_val.to_s.capitalize -%>, +<%-end-%> } +<%-end-%> # The OPENSTACK_CINDER_FEATURES settings can be used to enable optional -# # services provided by cinder that is not exposed by its extension API. +# services provided by cinder that is not exposed by its extension API. +<%- if ! (@cinder_options_real.empty?) -%> OPENSTACK_CINDER_FEATURES = { - <%- @cinder_options = @cinder_defaults.merge(@cinder_options) -%> - 'enable_backup': <%= @cinder_options['enable_backup'].to_s.capitalize %>, +<%- @cinder_options_real.sort.each do |opt_name,opt_val| -%> + '<%= opt_name -%>': <%= opt_val.to_s.capitalize -%>, +<%-end-%> } +<%-end-%> # The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional # services provided by neutron. Options currenly available are load # balancer service, security groups, quotas, VPN service. +# The profile_support option is used to detect if an externa lrouter can be +# configured via the dashboard. When using specific plugins the +# profile_support can be turned on if needed. +<%- if ! (@neutron_options_real.empty?) -%> OPENSTACK_NEUTRON_NETWORK = { - <%- @neutron_options = @neutron_defaults.merge(@neutron_options) -%> - 'enable_lb': <%= @neutron_options['enable_lb'].to_s.capitalize %>, - 'enable_firewall': <%= @neutron_options['enable_firewall'].to_s.capitalize %>, - 'enable_quotas': <%= @neutron_options['enable_quotas'].to_s.capitalize %>, - 'enable_security_group': <%= @neutron_options['enable_security_group'].to_s.capitalize %>, - 'enable_vpn': <%= @neutron_options['enable_vpn'].to_s.capitalize %>, - 'enable_distributed_router': <%= @neutron_options['enable_distributed_router'].to_s.capitalize %>, - 'enable_ha_router': <%= @neutron_options['enable_ha_router'].to_s.capitalize %>, - # The profile_support option is used to detect if an externa lrouter can be - # configured via the dashboard. When using specific plugins the - # profile_support can be turned on if needed. - <%- if @neutron_options['profile_support'] != 'None' -%> - 'profile_support': '<%= @neutron_options['profile_support'] %>', - <%- end -%> - #'profile_support': 'cisco', +<%- @neutron_options_real.sort.each do |opt_name,opt_val| -%> + <%- if opt_val == true or opt_val == false -%> + '<%= opt_name -%>': <%= opt_val.to_s.capitalize -%>, + <%- else -%> + '<%= opt_name -%>': '<%= opt_val -%>', + <%-end-%> +<%-end-%> } +<%-end-%> # The OPENSTACK_IMAGE_BACKEND settings can be used to customize features # in the OpenStack Dashboard related to the Image service, such as the list diff --git a/ironic/spec/acceptance/basic_ironic_spec.rb b/ironic/spec/acceptance/basic_ironic_spec.rb index 4d4494964..55ae4ffe9 100644 --- a/ironic/spec/acceptance/basic_ironic_spec.rb +++ b/ironic/spec/acceptance/basic_ironic_spec.rb @@ -13,21 +13,30 @@ 'Debian': { include ::apt class { '::openstack_extras::repo::debian::ubuntu': - release => 'kilo', + release => 'liberty', + repo => 'proposed', package_require => true, } $package_provider = 'apt' } 'RedHat': { class { '::openstack_extras::repo::redhat::redhat': - # Kilo is not GA yet, so let's use the testing repo manage_rdo => false, - repo_hash => { - 'rdo-kilo-testing' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/testing/el7/', - # packages are not GA so not signed - 'gpgcheck' => '0', - 'priority' => 97, + repo_hash => { + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', + 'gpgcheck' => 'no', }, }, } diff --git a/ironic/spec/classes/ironic_bifrost_spec.rb b/ironic/spec/classes/ironic_bifrost_spec.rb index 3355cb357..6ec2458ab 100644 --- a/ironic/spec/classes/ironic_bifrost_spec.rb +++ b/ironic/spec/classes/ironic_bifrost_spec.rb @@ -58,7 +58,7 @@ end it 'should clone with vcsrepo bifrost repo with master branch' do - should contain_vcsrepo('/opt/stack/bifrost').with( + is_expected.to contain_vcsrepo('/opt/stack/bifrost').with( 'ensure' => 'present', 'provider' => 'git', 'revision' => 'master', @@ -67,13 +67,13 @@ end it 'should contain folder /etc/bifrost' do - should contain_file('/etc/bifrost').with( + is_expected.to contain_file('/etc/bifrost').with( 'ensure' => 'directory', ) end it 'should contain file /etc/bifrost/bifrost_global_vars' do - should contain_file('/etc/bifrost/bifrost_global_vars').with( + is_expected.to contain_file('/etc/bifrost/bifrost_global_vars').with( 'ensure' => 'present', 'require' => 'File[/etc/bifrost]', 'content' => /ironic_url/, @@ -81,7 +81,7 @@ end it 'should contain file /etc/bifrost/baremetal.json' do - should contain_file('/etc/bifrost/baremetal.json').with( + is_expected.to contain_file('/etc/bifrost/baremetal.json').with( 'ensure' => 'present', 'require' => 'File[/etc/bifrost]', 'content' => /test/, diff --git a/keystone/files/httpd/keystone.py b/keystone/files/httpd/keystone.py deleted file mode 100644 index a893d268e..000000000 --- a/keystone/files/httpd/keystone.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2013 OpenStack Foundation -# -# 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. - -# -# This file was copied from -# raw.githubusercontent.com/openstack/keystone/a4f29db/httpd/keystone.py -# It's only required for platforms on which it is not packaged yet. -# It should be removed when available everywhere in a package. -# - -import os - -from keystone.server import wsgi as wsgi_server - - -name = os.path.basename(__file__) - -# NOTE(ldbragst): 'application' is required in this context by WSGI spec. -# The following is a reference to Python Paste Deploy documentation -# http://pythonpaste.org/deploy/ -application = wsgi_server.initialize_application(name) diff --git a/keystone/lib/puppet/provider/keystone.rb b/keystone/lib/puppet/provider/keystone.rb index bf1ebe6ee..64f46de50 100644 --- a/keystone/lib/puppet/provider/keystone.rb +++ b/keystone/lib/puppet/provider/keystone.rb @@ -10,6 +10,8 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack INI_FILENAME = '/etc/keystone/keystone.conf' + @@default_domain_id = nil + def self.admin_endpoint @admin_endpoint ||= get_admin_endpoint end @@ -31,28 +33,36 @@ def self.clean_host(host) end def self.default_domain - domain_hash[default_domain_id] + domain_name_from_id(default_domain_id) end def self.default_domain_id - return @default_domain_id if @default_domain_id - if keystone_file and keystone_file['identity'] and keystone_file['identity']['default_domain_id'] - @default_domain_id = "#{keystone_file['identity']['default_domain_id'].strip}" + if @@default_domain_id + @@default_domain_id + elsif keystone_file and keystone_file['identity'] and keystone_file['identity']['default_domain_id'] + keystone_file['identity']['default_domain_id'].strip else - @default_domain_id = 'default' + 'default' end - @default_domain_id end - def self.domain_hash - return @domain_hash if @domain_hash - list = request('domain', 'list') - @domain_hash = Hash[list.collect{|domain| [domain[:id], domain[:name]]}] - @domain_hash + def self.default_domain_id=(id) + @@default_domain_id = id end def self.domain_name_from_id(id) - domain_hash[id] + unless @domain_hash + list = request('domain', 'list') + @domain_hash = Hash[list.collect{|domain| [domain[:id], domain[:name]]}] + end + unless @domain_hash.include?(id) + name = request('domain', 'show', id)[:name] + @domain_hash[id] = name if name + end + unless @domain_hash.include?(id) + err("Could not find domain with id [#{id}]") + end + @domain_hash[id] end def self.get_admin_endpoint @@ -86,7 +96,7 @@ def self.get_auth_url end def self.get_section(group, name) - if keystone_file && keystone_file[group] && keystone_file['DEFAULT'][name] + if keystone_file && keystone_file[group] && keystone_file[group][name] return keystone_file[group][name].strip end return nil diff --git a/keystone/lib/puppet/provider/keystone_domain/openstack.rb b/keystone/lib/puppet/provider/keystone_domain/openstack.rb index 14a8f6982..134b46d08 100644 --- a/keystone/lib/puppet/provider/keystone_domain/openstack.rb +++ b/keystone/lib/puppet/provider/keystone_domain/openstack.rb @@ -99,6 +99,7 @@ def ensure_default_domain(create, destroy=false, value=nil) end if changed self.class.keystone_file.store + self.class.default_domain_id = newid debug("The default_domain_id was changed from #{curid} to #{newid}") end end diff --git a/keystone/lib/puppet/provider/keystone_tenant/openstack.rb b/keystone/lib/puppet/provider/keystone_tenant/openstack.rb index 57a299fd6..ac1dfb107 100644 --- a/keystone/lib/puppet/provider/keystone_tenant/openstack.rb +++ b/keystone/lib/puppet/provider/keystone_tenant/openstack.rb @@ -32,6 +32,7 @@ def create properties << project_domain end @property_hash = self.class.request('project', 'create', properties) + @property_hash[:name] = resource[:name] @property_hash[:ensure] = :present end diff --git a/keystone/lib/puppet/provider/keystone_user/openstack.rb b/keystone/lib/puppet/provider/keystone_user/openstack.rb index afc11cb45..588f2447b 100644 --- a/keystone/lib/puppet/provider/keystone_user/openstack.rb +++ b/keystone/lib/puppet/provider/keystone_user/openstack.rb @@ -34,12 +34,14 @@ def create properties << user_domain end @property_hash = self.class.request('user', 'create', properties) + @property_hash[:name] = resource[:name] @property_hash[:domain] = user_domain if resource[:tenant] # DEPRECATED - To be removed in next release (Liberty) # https://bugs.launchpad.net/puppet-keystone/+bug/1472437 project_id = Puppet::Resource.indirection.find("Keystone_tenant/#{resource[:tenant]}")[:id] set_project(resource[:tenant], project_id) + @property_hash[:tenant] = resource[:tenant] end @property_hash[:ensure] = :present end @@ -100,11 +102,9 @@ def password else # Password validation credentials = Puppet::Provider::Openstack::CredentialsV3.new - unless auth_url = self.class.get_auth_url + unless credentials.auth_url = self.class.get_auth_url raise(Puppet::Error::OpenstackAuthInputError, "Could not find authentication url to validate user's password.") end - auth_url << "/v#{credentials.version}" unless auth_url =~ /\/v\d(\.\d)?$/ - credentials.auth_url = auth_url credentials.password = resource[:password] credentials.user_id = id @@ -152,7 +152,7 @@ def find_project_for_user(projname, project_id = nil) self.class.request('project', 'list', ['--user', id, '--long']).each do |project| if (project_id == project[:id]) || ((projname == project_name) && (project_domain == self.class.domain_name_from_id(project[:domain_id]))) - return project[:name] + return projname end end return nil diff --git a/keystone/manifests/endpoint.pp b/keystone/manifests/endpoint.pp index ddf5c1368..c9e7ef5ea 100644 --- a/keystone/manifests/endpoint.pp +++ b/keystone/manifests/endpoint.pp @@ -5,23 +5,23 @@ # === Parameters # # [*public_url*] -# (optional) Public url for keystone endpoint. (Defaults to 'http://127.0.0.1:5000') +# (optional) Public url for keystone endpoint. +# Defaults to 'http://127.0.0.1:5000' # This url should *not* contain any version or trailing '/'. # # [*internal_url*] -# (optional) Internal url for keystone endpoint. (Defaults to $public_url) +# (optional) Internal url for keystone endpoint. +# Defaults to $public_url # This url should *not* contain any version or trailing '/'. # # [*admin_url*] -# (optional) Admin url for keystone endpoint. (Defaults to 'http://127.0.0.1:35357') +# (optional) Admin url for keystone endpoint. +# Defaults to 'http://127.0.0.1:35357' # This url should *not* contain any version or trailing '/'. # # [*region*] # (optional) Region for endpoint. (Defaults to 'RegionOne') # -# [*version*] -# (optional) API version for endpoint. Appended to all endpoint urls. (Defaults to 'v2.0') -# # [*user_domain*] # (Optional) Domain for $auth_name # Defaults to undef (use the keystone server default domain) @@ -36,6 +36,15 @@ # If keystone_project_domain is not specified, use $keystone_default_domain # Defaults to undef # +# === DEPRECATED +# +# [*version*] +# (optional) API version for endpoint. +# Defaults to 'v2.0' +# If the version is assigned to null value (forced to undef), then it won't be +# used. This is the expected behaviour since Keystone V3 handles API versions +# from the context. +# # === Examples # # class { 'keystone::endpoint': @@ -48,20 +57,36 @@ $public_url = 'http://127.0.0.1:5000', $internal_url = undef, $admin_url = 'http://127.0.0.1:35357', - $version = 'v2.0', $region = 'RegionOne', $user_domain = undef, $project_domain = undef, $default_domain = undef, + $version = 'v2.0', # DEPRECATED ) { - $public_url_real = "${public_url}/${version}" - $admin_url_real = "${admin_url}/${version}" + if empty($version) { + $admin_url_real = $admin_url + $public_url_real = $public_url - if $internal_url { - $internal_url_real = "${internal_url}/${version}" - } else { - $internal_url_real = "${public_url}/${version}" + if $internal_url { + $internal_url_real = $internal_url + } + else { + $internal_url_real = $public_url + } + } + else { + warning('The version parameter is deprecated in Liberty.') + + $public_url_real = "${public_url}/${version}" + $admin_url_real = "${admin_url}/${version}" + + if $internal_url { + $internal_url_real = "${internal_url}/${version}" + } + else { + $internal_url_real = "${public_url}/${version}" + } } keystone::resource::service_identity { 'keystone': @@ -77,5 +102,4 @@ project_domain => $project_domain, default_domain => $default_domain, } - } diff --git a/keystone/manifests/init.pp b/keystone/manifests/init.pp index 8d36b18ef..00911be6e 100644 --- a/keystone/manifests/init.pp +++ b/keystone/manifests/init.pp @@ -355,11 +355,15 @@ # Defaults to undef # # [*admin_workers*] -# (optional) The number of worker processes to serve the admin WSGI application. +# (optional) The number of worker processes to serve the admin eventlet application. +# This option is deprecated along with eventlet and will be removed in M. +# This setting has no affect when using WSGI. # Defaults to max($::processorcount, 2) # # [*public_workers*] -# (optional) The number of worker processes to serve the public WSGI application. +# (optional) The number of worker processes to serve the public eventlet application. +# This option is deprecated along with eventlet and will be removed in M. +# This setting has no affect when using WSGI. # Defaults to max($::processorcount, 2) # # [*sync_db*] @@ -390,6 +394,25 @@ # explicitly set in the request. # Defaults to undef (will use built-in Keystone default) # +# [*memcache_dead_retry*] +# (optional) Number of seconds memcached server is considered dead before it +# is tried again. This is used for the cache memcache_dead_retry and the +# memcache dead_retry values. +# Defaults to undef +# +# [*memcache_socket_timeout*] +# (optional) Timeout in seconds for every call to a server. +# Defaults to undef +# +# [*memcache_pool_maxsize*] +# (optional) Max total number of open connections to every memcached server. +# Defaults to undef +# +# [*memcache_pool_unused_timeout*] +# (optional) Number of seconds a connection to memcached is held unused in +# the pool before it is closed. +# Defaults to undef. +# # == Dependencies # None # @@ -491,14 +514,18 @@ $service_provider = $::keystone::params::service_provider, $service_name = $::keystone::params::service_name, $max_token_size = undef, - $admin_workers = max($::processorcount, 2), - $public_workers = max($::processorcount, 2), $sync_db = true, $enable_fernet_setup = false, $fernet_key_repository = '/etc/keystone/fernet-keys', $fernet_max_active_keys = undef, $default_domain = undef, + $memcache_dead_retry = undef, + $memcache_socket_timeout = undef, + $memcache_pool_maxsize = undef, + $memcache_pool_unused_timeout = undef, # DEPRECATED PARAMETERS + $admin_workers = max($::processorcount, 2), + $public_workers = max($::processorcount, 2), $mysql_module = undef, $compute_port = undef, ) inherits keystone::params { @@ -679,11 +706,19 @@ validate_array($memcache_servers) Service<| title == 'memcached' |> -> Service['keystone'] keystone_config { - 'cache/enabled': value => true; - 'cache/backend': value => $cache_backend; - 'cache/debug_cache_backend': value => $debug_cache_backend; - 'token/caching': value => $token_caching; - 'memcache/servers': value => join($memcache_servers, ','); + 'cache/enabled': value => true; + 'cache/backend': value => $cache_backend; + 'cache/debug_cache_backend': value => $debug_cache_backend; + 'token/caching': value => $token_caching; + 'memcache/servers': value => join($memcache_servers, ','); + 'memcache/dead_retry': value => $memcache_dead_retry; + 'memcache/socket_timeout': value => $memcache_socket_timeout; + 'memcache/pool_maxsize': value => $memcache_pool_maxsize; + 'memcache/pool_unused_timeout': value => $memcache_pool_unused_timeout; + 'cache/memcache_dead_retry': value => $memcache_dead_retry; + 'cache/memcache_socket_timeout': value => $memcache_socket_timeout; + 'cache/memcache_pool_maxsize': value => $memcache_pool_maxsize; + 'cache/memcache_pool_unused_timeout': value => $memcache_pool_unused_timeout; } if $cache_backend_argument { validate_array($cache_backend_argument) @@ -697,12 +732,21 @@ } } else { keystone_config { - 'cache/enabled': ensure => absent; - 'cache/backend': ensure => absent; - 'cache/backend_argument': ensure => absent; - 'cache/debug_cache_backend': ensure => absent; - 'token/caching': ensure => absent; - 'memcache/servers': ensure => absent; + 'cache/enabled': ensure => absent; + 'cache/backend': ensure => absent; + 'cache/backend_argument': ensure => absent; + 'cache/debug_cache_backend': ensure => absent; + 'token/caching': ensure => absent; + 'memcache/servers': ensure => absent; + 'memcache/dead_retry': ensure => absent; + 'memcache/socket_timeout': ensure => absent; + 'memcache/pool_maxsize': ensure => absent; + 'memcache/pool_unused_timeout': ensure => absent; + 'cache/memcache_dead_retry': ensure => absent; + 'cache/memcache_socket_timeout': ensure => absent; + 'cache/memcache_pool_maxsize': ensure => absent; + 'cache/memcache_pool_unused_timeout': ensure => absent; + } } @@ -823,8 +867,8 @@ } keystone_config { - 'DEFAULT/admin_workers': value => $admin_workers; - 'DEFAULT/public_workers': value => $public_workers; + 'eventlet_server/admin_workers': value => $admin_workers; + 'eventlet_server/public_workers': value => $public_workers; } if $manage_service { @@ -870,7 +914,7 @@ validate => false, } } - warning('Keystone under Eventlet has been drepecated during the Kilo cycle. Support for deploying under eventlet will be dropped as of the M-release of OpenStack.') + warning('Keystone under Eventlet has been deprecated during the Kilo cycle. Support for deploying under eventlet will be dropped as of the M-release of OpenStack.') } elsif $service_name == 'httpd' { include ::apache::params class { '::keystone::service': diff --git a/keystone/manifests/params.pp b/keystone/manifests/params.pp index 12660caee..fe5078307 100644 --- a/keystone/manifests/params.pp +++ b/keystone/manifests/params.pp @@ -9,19 +9,15 @@ $package_name = 'keystone' $service_name = 'keystone' $keystone_wsgi_script_path = '/usr/lib/cgi-bin/keystone' + $keystone_wsgi_script_source = '/usr/share/keystone/wsgi.py' $python_memcache_package_name = 'python-memcache' $paste_config = undef case $::operatingsystem { 'Debian': { $service_provider = undef - $keystone_wsgi_script_source = '/usr/share/keystone/wsgi.py' } default: { - # NOTE: Ubuntu does not currently provide the keystone wsgi script in the - # keystone packages. When Ubuntu does provide the script, change this - # to use the correct path (which I'm assuming will be the same as Debian). $service_provider = 'upstart' - $keystone_wsgi_script_source = 'puppet:///modules/keystone/httpd/keystone.py' } } } diff --git a/keystone/spec/acceptance/basic_keystone_spec.rb b/keystone/spec/acceptance/basic_keystone_spec.rb index 4de4df1ed..d53e9a11c 100644 --- a/keystone/spec/acceptance/basic_keystone_spec.rb +++ b/keystone/spec/acceptance/basic_keystone_spec.rb @@ -29,15 +29,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, @@ -70,9 +74,8 @@ class { '::keystone::roles::admin': email => 'test@example.tld', password => 'a_big_secret', } + # Default Keystone endpoints use localhost, default ports and v2.0 class { '::keystone::endpoint': - public_url => "http://127.0.0.1:5000/", - admin_url => "http://127.0.0.1:35357/", default_domain => 'admin', } ::keystone::resource::service_identity { 'beaker-ci': diff --git a/keystone/spec/acceptance/keystone_wsgi_apache_spec.rb b/keystone/spec/acceptance/keystone_wsgi_apache_spec.rb index 796e819e9..3093c6387 100644 --- a/keystone/spec/acceptance/keystone_wsgi_apache_spec.rb +++ b/keystone/spec/acceptance/keystone_wsgi_apache_spec.rb @@ -22,15 +22,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, @@ -69,9 +73,8 @@ class { '::keystone::roles::admin': email => 'test@example.tld', password => 'a_big_secret', } + # Default Keystone endpoints use localhost, default ports and v2.0 class { '::keystone::endpoint': - public_url => "http://127.0.0.1:5000/", - admin_url => "http://127.0.0.1:35357/", default_domain => 'admin', } ::keystone::resource::service_identity { 'beaker-ci': diff --git a/keystone/spec/classes/keystone_endpoint_spec.rb b/keystone/spec/classes/keystone_endpoint_spec.rb index 59390ec98..bafad575e 100644 --- a/keystone/spec/classes/keystone_endpoint_spec.rb +++ b/keystone/spec/classes/keystone_endpoint_spec.rb @@ -34,6 +34,21 @@ )} end + describe 'without a version' do + # We need to test empty value '' to override the default value, using undef + # cannot un-set classes parameters. + let :params do + { :version => '' } + end + + it { is_expected.to contain_keystone_endpoint('RegionOne/keystone').with( + :ensure => 'present', + :public_url => 'http://127.0.0.1:5000', + :admin_url => 'http://127.0.0.1:35357', + :internal_url => 'http://127.0.0.1:5000' + )} + end + describe 'without internal_url parameter' do let :params do diff --git a/keystone/spec/classes/keystone_spec.rb b/keystone/spec/classes/keystone_spec.rb index 1ad965a46..ed6a00545 100644 --- a/keystone/spec/classes/keystone_spec.rb +++ b/keystone/spec/classes/keystone_spec.rb @@ -212,14 +212,14 @@ it 'should ensure proper setting of admin_workers and public_workers' do if param_hash['admin_workers'] - is_expected.to contain_keystone_config('DEFAULT/admin_workers').with_value(param_hash['admin_workers']) + is_expected.to contain_keystone_config('eventlet_server/admin_workers').with_value(param_hash['admin_workers']) else - is_expected.to contain_keystone_config('DEFAULT/admin_workers').with_value('2') + is_expected.to contain_keystone_config('eventlet_server/admin_workers').with_value('2') end if param_hash['public_workers'] - is_expected.to contain_keystone_config('DEFAULT/public_workers').with_value(param_hash['public_workers']) + is_expected.to contain_keystone_config('eventlet_server/public_workers').with_value(param_hash['public_workers']) else - is_expected.to contain_keystone_config('DEFAULT/public_workers').with_value('2') + is_expected.to contain_keystone_config('eventlet_server/public_workers').with_value('2') end end @@ -492,11 +492,15 @@ describe 'configure memcache servers if set' do let :params do { - 'admin_token' => 'service_token', - 'memcache_servers' => [ 'SERVER1:11211', 'SERVER2:11211' ], - 'token_driver' => 'keystone.token.backends.memcache.Token', - 'cache_backend' => 'dogpile.cache.memcached', - 'cache_backend_argument' => ['url:SERVER1:12211'], + 'admin_token' => 'service_token', + 'memcache_servers' => [ 'SERVER1:11211', 'SERVER2:11211' ], + 'token_driver' => 'keystone.token.backends.memcache.Token', + 'cache_backend' => 'dogpile.cache.memcached', + 'cache_backend_argument' => ['url:SERVER1:12211'], + 'memcache_dead_retry' => '60', + 'memcache_socket_timeout' => '2', + 'memcache_pool_maxsize' => '1000', + 'memcache_pool_unused_timeout' => '60', } end @@ -505,6 +509,14 @@ it { is_expected.to contain_keystone_config('token/caching').with_value(true) } it { is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcached') } it { is_expected.to contain_keystone_config('cache/backend_argument').with_value('url:SERVER1:12211') } + it { is_expected.to contain_keystone_config('memcache/dead_retry').with_value('60') } + it { is_expected.to contain_keystone_config('memcache/socket_timeout').with_value('2') } + it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_value('1000') } + it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_value('60') } + it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('60') } + it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('2') } + it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('1000') } + it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60') } it { is_expected.to contain_package('python-memcache').with( :name => 'python-memcache', :ensure => 'present' @@ -522,6 +534,13 @@ it { is_expected.to contain_keystone_config("cache/backend_argument").with_ensure('absent') } it { is_expected.to contain_keystone_config("cache/debug_cache_backend").with_ensure('absent') } it { is_expected.to contain_keystone_config("memcache/servers").with_ensure('absent') } + it { is_expected.to contain_keystone_config('memcache/dead_retry').with_ensure('absent') } + it { is_expected.to contain_keystone_config('memcache/pool_maxsize').with_ensure('absent') } + it { is_expected.to contain_keystone_config('memcache/pool_unused_timeout').with_ensure('absent') } + it { is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_ensure('absent') } + it { is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_ensure('absent') } + it { is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_ensure('absent') } + it { is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_ensure('absent') } end describe 'raise error if memcache_servers is not an array' do diff --git a/keystone/spec/spec_helper.rb b/keystone/spec/spec_helper.rb index 3be0498d1..7f60bfd4e 100644 --- a/keystone/spec/spec_helper.rb +++ b/keystone/spec/spec_helper.rb @@ -10,3 +10,16 @@ end at_exit { RSpec::Puppet::Coverage.report! } + +def setup_provider_tests + Puppet::Provider::Keystone.class_exec do + def self.reset + @admin_endpoint = nil + @tenant_hash = nil + @admin_token = nil + @keystone_file = nil + Puppet::Provider::Keystone.default_domain_id = nil + @domain_hash = nil + end + end +end diff --git a/keystone/spec/unit/provider/keystone_domain/openstack_spec.rb b/keystone/spec/unit/provider/keystone_domain/openstack_spec.rb index 497f09bae..c57373202 100644 --- a/keystone/spec/unit/provider/keystone_domain/openstack_spec.rb +++ b/keystone/spec/unit/provider/keystone_domain/openstack_spec.rb @@ -2,26 +2,12 @@ require 'spec_helper' require 'puppet/provider/keystone_domain/openstack' -provider_class = Puppet::Type.type(:keystone_domain).provider(:openstack) +setup_provider_tests -class Puppet::Provider::Keystone - def self.reset - @admin_endpoint = nil - @tenant_hash = nil - @admin_token = nil - @keystone_file = nil - @domain_id_to_name = nil - @default_domain_id = nil - @domain_hash = nil - end -end +provider_class = Puppet::Type.type(:keystone_domain).provider(:openstack) describe provider_class do - after :each do - provider_class.reset - end - shared_examples 'authenticated with environment variables' do ENV['OS_USERNAME'] = 'test' ENV['OS_PASSWORD'] = 'abc123' @@ -48,6 +34,18 @@ def self.reset provider_class.new(resource) end + let(:another_class) do + class AnotherKlass < Puppet::Provider::Keystone + @credentials = Puppet::Provider::Openstack::CredentialsV3.new + end + AnotherKlass + end + + after :each do + provider_class.reset + another_class.reset + end + it_behaves_like 'authenticated with environment variables' do describe '#create' do it 'creates a domain' do @@ -115,12 +113,12 @@ def self.reset end it 'creates a default domain' do - File.expects(:exists?).returns(true) + File.expects(:exists?).twice.returns(true) mock = { 'identity' => {'default_domain_id' => ' default'} } - Puppet::Util::IniConfig::File.expects(:new).returns(mock) - mock.expects(:read).with('/etc/keystone/keystone.conf') + Puppet::Util::IniConfig::File.expects(:new).twice.returns(mock) + mock.expects(:read).twice.with('/etc/keystone/keystone.conf') mock.expects(:store) provider.class.expects(:openstack) .with('domain', 'create', '--format', 'shell', ['foo', '--enable', '--description', 'foo']) @@ -129,9 +127,13 @@ def self.reset description="foo" enabled=True ') + expect(provider.class.default_domain_id).to eq('default') + expect(another_class.default_domain_id).to eq('default') provider.create expect(provider.exists?).to be_truthy expect(mock['identity']['default_domain_id']).to eq('1cb05cfed7c24279be884ba4f6520262') + expect(provider.class.default_domain_id).to eq('1cb05cfed7c24279be884ba4f6520262') + expect(another_class.default_domain_id).to eq('1cb05cfed7c24279be884ba4f6520262') end end @@ -154,6 +156,8 @@ def self.reset provider.destroy expect(provider.exists?).to be_falsey expect(kcmock['identity']['default_domain_id']).to eq('default') + expect(provider.class.default_domain_id).to eq('default') + expect(another_class.default_domain_id).to eq('default') end end diff --git a/keystone/spec/unit/provider/keystone_endpoint/openstack_spec.rb b/keystone/spec/unit/provider/keystone_endpoint/openstack_spec.rb index 9ca5b436f..f6d0b1af5 100644 --- a/keystone/spec/unit/provider/keystone_endpoint/openstack_spec.rb +++ b/keystone/spec/unit/provider/keystone_endpoint/openstack_spec.rb @@ -10,7 +10,7 @@ ENV['OS_USERNAME'] = 'test' ENV['OS_PASSWORD'] = 'abc123' ENV['OS_PROJECT_NAME'] = 'test' - ENV['OS_AUTH_URL'] = 'http://127.0.0.1:35357/v2.0' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:5000' end describe 'when managing an endpoint' do @@ -19,9 +19,9 @@ { :name => 'foo/bar', :ensure => 'present', - :public_url => 'http://127.0.0.1:5000/v2.0', - :internal_url => 'http://127.0.0.1:5001/v2.0', - :admin_url => 'http://127.0.0.1:5002/v2.0', + :public_url => 'http://127.0.0.1:5000', + :internal_url => 'http://127.0.0.1:5001', + :admin_url => 'http://127.0.0.1:5002', } end @@ -42,11 +42,11 @@ "1cb05cfed7c24279be884ba4f6520262","foo","bar","","http://127.0.0.1:5000/v2.0","http://127.0.0.1:5001/v2.0","http://127.0.0.1:5002/v2.0" ') provider.class.stubs(:openstack) - .with('endpoint', 'create', '--format', 'shell', ['bar', '--region', 'foo', '--publicurl', 'http://127.0.0.1:5000/v2.0', '--internalurl', 'http://127.0.0.1:5001/v2.0', '--adminurl', 'http://127.0.0.1:5002/v2.0']) - .returns('adminurl="http://127.0.0.1:5002/v2.0" + .with('endpoint', 'create', '--format', 'shell', ['bar', '--region', 'foo', '--publicurl', 'http://127.0.0.1:5000', '--internalurl', 'http://127.0.0.1:5001', '--adminurl', 'http://127.0.0.1:5002']) + .returns('adminurl="http://127.0.0.1:5002" id="3a5c4378981e4112a0d44902a43e16ef" -internalurl="http://127.0.0.1:5001/v2.0" -publicurl="http://127.0.0.1:5000/v2.0" +internalurl="http://127.0.0.1:5001" +publicurl="http://127.0.0.1:5000" region="foo" service_id="8137d72980fd462192f276585a002426" service_name="bar" @@ -62,7 +62,7 @@ provider.class.stubs(:openstack) .with('endpoint', 'list', '--quiet', '--format', 'csv', '--long') .returns('"ID","Region","Service Name","Service Type","PublicURL","AdminURL","InternalURL" -"1cb05cfed7c24279be884ba4f6520262","foo","bar","test","http://127.0.0.1:5000/v2.0","http://127.0.0.1:5001/v2.0","http://127.0.0.1:5002/v2.0" +"1cb05cfed7c24279be884ba4f6520262","foo","bar","test","http://127.0.0.1:5000","http://127.0.0.1:5001","http://127.0.0.1:5002" ') provider.class.stubs(:openstack) .with('endpoint', 'delete', []) @@ -89,7 +89,7 @@ provider.class.stubs(:openstack) .with('endpoint', 'list', '--quiet', '--format', 'csv', '--long') .returns('"ID","Region","Service Name","Service Type","PublicURL","AdminURL","InternalURL" -"3a5c4378981e4112a0d44902a43e16ef","foo","bar","test","http://127.0.0.1:5000/v2.0","http://127.0.0.1:5001/v2.0","http://127.0.0.1:5002/v2.0" +"3a5c4378981e4112a0d44902a43e16ef","foo","bar","test","http://127.0.0.1:5000","http://127.0.0.1:5001","http://127.0.0.1:5002" ') instances = Puppet::Type::Keystone_endpoint::ProviderOpenstack.instances expect(instances.count).to eq(1) diff --git a/keystone/spec/unit/provider/keystone_spec.rb b/keystone/spec/unit/provider/keystone_spec.rb index 7efc00c65..e1035540f 100644 --- a/keystone/spec/unit/provider/keystone_spec.rb +++ b/keystone/spec/unit/provider/keystone_spec.rb @@ -3,26 +3,26 @@ require 'puppet/provider/keystone' require 'tempfile' +setup_provider_tests + klass = Puppet::Provider::Keystone class Puppet::Provider::Keystone @credentials = Puppet::Provider::Openstack::CredentialsV3.new - - def self.reset - @admin_endpoint = nil - @tenant_hash = nil - @admin_token = nil - @keystone_file = nil - @domain_id_to_name = nil - @default_domain_id = nil - @domain_hash = nil - end end describe Puppet::Provider::Keystone do + let(:another_class) do + class AnotherKlass < Puppet::Provider::Keystone + @credentials = Puppet::Provider::Openstack::CredentialsV3.new + end + AnotherKlass + end + after :each do klass.reset + another_class.reset end describe '#ssl?' do @@ -231,6 +231,29 @@ def self.reset ') expect(klass.name_and_domain('foo')).to eq(['foo', 'SomeName']) end + it 'should return the default_domain_id from one class set in another class' do + ENV['OS_USERNAME'] = 'test' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:35357/v3' + klass.expects(:openstack) + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"default","Default",True,"default domain" +"somename","SomeName",True,"some domain" +') + another_class.expects(:openstack) + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"default","Default",True,"default domain" +"somename","SomeName",True,"some domain" +') + expect(klass.default_domain).to eq('Default') + expect(another_class.default_domain).to eq('Default') + klass.default_domain_id = 'somename' + expect(klass.default_domain).to eq('SomeName') + expect(another_class.default_domain).to eq('SomeName') + end it 'should return Default if default_domain_id is not configured' do ENV['OS_USERNAME'] = 'test' ENV['OS_PASSWORD'] = 'abc123' @@ -247,5 +270,54 @@ def self.reset ') expect(klass.name_and_domain('foo')).to eq(['foo', 'Default']) end + it 'should list all domains when requesting a domain name from an ID' do + ENV['OS_USERNAME'] = 'test' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:35357/v3' + klass.expects(:openstack) + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"somename","SomeName",True,"default domain" +') + expect(klass.domain_name_from_id('somename')).to eq('SomeName') + end + it 'should lookup a domain when not found in the hash' do + ENV['OS_USERNAME'] = 'test' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:35357/v3' + klass.expects(:openstack) + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"somename","SomeName",True,"default domain" +') + klass.expects(:openstack) + .with('domain', 'show', '--format', 'shell', 'another') + .returns(' +name="AnOther" +id="another" +') + expect(klass.domain_name_from_id('somename')).to eq('SomeName') + expect(klass.domain_name_from_id('another')).to eq('AnOther') + end + it 'should print an error when there is no such domain' do + ENV['OS_USERNAME'] = 'test' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:35357/v3' + klass.expects(:openstack) + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"somename","SomeName",True,"default domain" +') + klass.expects(:openstack) + .with('domain', 'show', '--format', 'shell', 'doesnotexist') + .returns(' +') + klass.expects(:err) + .with('Could not find domain with id [doesnotexist]') + expect(klass.domain_name_from_id('doesnotexist')).to eq(nil) + end end end diff --git a/keystone/spec/unit/provider/keystone_tenant/openstack_spec.rb b/keystone/spec/unit/provider/keystone_tenant/openstack_spec.rb index fd17e4250..8cfcf1b24 100644 --- a/keystone/spec/unit/provider/keystone_tenant/openstack_spec.rb +++ b/keystone/spec/unit/provider/keystone_tenant/openstack_spec.rb @@ -2,19 +2,9 @@ require 'spec_helper' require 'puppet/provider/keystone_tenant/openstack' -provider_class = Puppet::Type.type(:keystone_tenant).provider(:openstack) +setup_provider_tests -class Puppet::Provider::Keystone - def self.reset - @admin_endpoint = nil - @tenant_hash = nil - @admin_token = nil - @keystone_file = nil - @domain_id_to_name = nil - @default_domain_id = nil - @domain_hash = nil - end -end +provider_class = Puppet::Type.type(:keystone_tenant).provider(:openstack) describe provider_class do @@ -203,6 +193,7 @@ def before_hook(domainlist) provider.create expect(provider.exists?).to be_truthy expect(provider.id).to eq("project-id") + expect(provider.name).to eq('foo::foo_domain') end end @@ -230,6 +221,7 @@ def before_hook(domainlist) provider.create expect(provider.exists?).to be_truthy expect(provider.id).to eq("project-id") + expect(provider.name).to eq('foo::bar_domain') end end end diff --git a/keystone/spec/unit/provider/keystone_user/openstack_spec.rb b/keystone/spec/unit/provider/keystone_user/openstack_spec.rb index f74a1ac7d..f3836ef1d 100644 --- a/keystone/spec/unit/provider/keystone_user/openstack_spec.rb +++ b/keystone/spec/unit/provider/keystone_user/openstack_spec.rb @@ -3,6 +3,8 @@ require 'puppet/provider/keystone_user/openstack' require 'puppet/provider/openstack' +setup_provider_tests + provider_class = Puppet::Type.type(:keystone_user).provider(:openstack) def project_class @@ -18,6 +20,11 @@ def project_class ENV['OS_AUTH_URL'] = 'http://127.0.0.1:5000' end + after :each do + provider_class.reset + project_class.reset + end + let(:user_attrs) do { :name => 'foo', @@ -38,10 +45,27 @@ def project_class provider_class.new(resource) end - def before_hook(delete, missing, noproject, user_cached) + def before_hook(delete, missing, noproject, user_cached, project_only) + unless noproject + project_class.expects(:openstack).once + .with('domain', 'list', '--quiet', '--format', 'csv', []) + .returns('"ID","Name","Enabled","Description" +"default","Default",True,"default" +"foo_domain_id","foo_domain",True,"foo domain" +"bar_domain_id","bar_domain",True,"bar domain" +"another_domain_id","another_domain",True,"another domain" +"disabled_domain_id","disabled_domain",False,"disabled domain" +') + end + + if project_only + return + end + provider.class.expects(:openstack).once .with('domain', 'list', '--quiet', '--format', 'csv', []) .returns('"ID","Name","Enabled","Description" +"default","Default",True,"default" "foo_domain_id","foo_domain",True,"foo domain" "bar_domain_id","bar_domain",True,"bar domain" "another_domain_id","another_domain",True,"another domain" @@ -75,39 +99,37 @@ def before_hook(delete, missing, noproject, user_cached) end before :each, :default => true do - before_hook(false, false, false, false) + before_hook(false, false, false, false, false) end before :each, :delete => true do - before_hook(true, false, false, false) + before_hook(true, false, false, false, false) end before :each, :missing => true do - before_hook(false, true, false, false) + before_hook(false, true, false, false, false) end before :each, :noproject => true do - before_hook(false, false, true, false) + before_hook(false, false, true, false, false) end before :each, :default_https => true do - before_hook(false, false, false, false) + before_hook(false, false, false, false, false) end before :each, :user_cached => true do - before_hook(false, false, false, true) + before_hook(false, false, false, true, false) end before :each, :nohooks => true do # do nothing end + before :each, :project_only => true do + before_hook(false, false, false, false, true) + end + before :each, :noproject_user_cached => true do + before_hook(false, false, true, true, false) + end describe 'when managing a user' do it_behaves_like 'authenticated with environment variables' do - describe '#create' do + describe '#create', :project_only => true do it 'creates a user' do - project_class.expects(:openstack).once - .with('domain', 'list', '--quiet', '--format', 'csv', []) - .returns('"ID","Name","Enabled","Description" -"foo_domain_id","foo_domain",True,"foo domain" -"bar_domain_id","bar_domain",True,"bar domain" -"another_domain_id","another_domain",True,"another domain" -"disabled_domain_id","disabled_domain",False,"disabled domain" -') project_class.expects(:openstack) .with('project', 'list', '--quiet', '--format', 'csv', '--long') .returns('"ID","Name","Domain ID","Description","Enabled" @@ -155,7 +177,7 @@ def before_hook(delete, missing, noproject, user_cached) end end - describe '#instances', :default => true do + describe '#instances', :noproject => true do it 'finds every user' do instances = provider.class.instances expect(instances.count).to eq(3) @@ -167,10 +189,10 @@ def before_hook(delete, missing, noproject, user_cached) end describe '#tenant' do - it 'gets the tenant with default backend', :nohooks => true do - project_class.expects(:openstack) - .with('project', 'list', '--quiet', '--format', 'csv', '--long') - .returns('"ID","Name","Domain ID","Description","Enabled" + it 'gets the tenant with default backend', :user_cached => true do + project_class.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', '--long') + .returns('"ID","Name","Domain ID","Description","Enabled" "1cb05cfed7c24279be884ba4f6520262","foo","foo_domain_id","foo",True "2cb05cfed7c24279be884ba4f6520262","bar","bar_domain_id","bar",True ') @@ -184,11 +206,11 @@ def before_hook(delete, missing, noproject, user_cached) expect(tenant).to eq('foo') end - it 'gets the tenant with LDAP backend', :nohooks => true do + it 'gets the tenant with LDAP backend', :user_cached => true do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' - project_class.expects(:openstack) - .with('project', 'list', '--quiet', '--format', 'csv', '--long') - .returns('"ID","Name","Domain ID","Description","Enabled" + project_class.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', '--long') + .returns('"ID","Name","Domain ID","Description","Enabled" "1cb05cfed7c24279be884ba4f6520262","foo","foo_domain_id","foo",True "2cb05cfed7c24279be884ba4f6520262","bar","bar_domain_id","bar",True ') @@ -203,8 +225,8 @@ def before_hook(delete, missing, noproject, user_cached) expect(tenant).to eq('foo') end end - describe '#tenant=' do - context 'when using default backend', :nohooks => true do + describe '#tenant=', :project_only => true do + context 'when using default backend' do it 'sets the tenant' do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' provider.instance_variable_get('@property_hash')[:domain] = 'foo_domain' @@ -222,7 +244,7 @@ def before_hook(delete, missing, noproject, user_cached) provider.tenant=('bar') end end - context 'when using LDAP read-write backend', :nohooks => true do + context 'when using LDAP read-write backend' do it 'sets the tenant when _member_ role exists' do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' provider.instance_variable_get('@property_hash')[:domain] = 'foo_domain' @@ -281,7 +303,7 @@ def before_hook(delete, missing, noproject, user_cached) end end - describe "#password", :nohooks => true do + describe "#password" do let(:user_attrs) do { :name => 'foo', @@ -307,7 +329,7 @@ def before_hook(delete, missing, noproject, user_cached) end it_behaves_like 'with auth-url environment variable' do - it 'checks the password' do + it 'checks the password', :noproject_user_cached => true do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' mock_creds = Puppet::Provider::Openstack::CredentialsV3.new mock_creds.auth_url='http://127.0.0.1:5000' @@ -332,7 +354,7 @@ def before_hook(delete, missing, noproject, user_cached) expect(password).to eq('foo') end - it 'fails the password check' do + it 'fails the password check', :noproject_user_cached => true do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' Puppet::Provider::Openstack.expects(:openstack) .with('project', 'list', '--quiet', '--format', 'csv', ['--user', '1cb05cfed7c24279be884ba4f6520262', '--long']) @@ -346,7 +368,7 @@ def before_hook(delete, missing, noproject, user_cached) expect(password).to eq(nil) end - it 'checks the password with domain scoped token' do + it 'checks the password with domain scoped token', :nohooks => true do provider.instance_variable_get('@property_hash')[:id] = '1cb05cfed7c24279be884ba4f6520262' provider.instance_variable_get('@property_hash')[:domain] = 'foo_domain' mock_creds = Puppet::Provider::Openstack::CredentialsV3.new @@ -405,7 +427,7 @@ def before_hook(delete, missing, noproject, user_cached) end it_behaves_like 'authenticated with environment variables' do - describe 'v3 domains with no domain in resource', :nohooks => true do + describe 'v3 domains with no domain in resource', :user_cached => true do let(:user_attrs) do { :name => 'foo', @@ -418,9 +440,6 @@ def before_hook(delete, missing, noproject, user_cached) end it 'adds default domain to commands' do - provider_class.class_exec { - @default_domain_id = nil - } mock = { 'identity' => {'default_domain_id' => 'foo_domain_id'} } @@ -458,7 +477,7 @@ def before_hook(delete, missing, noproject, user_cached) end end - describe 'v3 domains with domain in resource' do + describe 'v3 domains with domain in resource', :project_only => true do let(:user_attrs) do { :name => 'foo', @@ -499,7 +518,7 @@ def before_hook(delete, missing, noproject, user_cached) end end - describe 'v3 domains with domain in name/title' do + describe 'v3 domains with domain in name/title', :project_only => true do let(:user_attrs) do { :name => 'foo::bar_domain', @@ -536,10 +555,11 @@ def before_hook(delete, missing, noproject, user_cached) provider.create expect(provider.exists?).to be_truthy expect(provider.id).to eq("2cb05cfed7c24279be884ba4f6520262") + expect(provider.name).to eq('foo::bar_domain') end end - describe 'v3 domains with domain in name/title and in resource' do + describe 'v3 domains with domain in name/title and in resource', :project_only => true do let(:user_attrs) do { :name => 'foo::bar_domain', @@ -577,10 +597,11 @@ def before_hook(delete, missing, noproject, user_cached) provider.create expect(provider.exists?).to be_truthy expect(provider.id).to eq("2cb05cfed7c24279be884ba4f6520262") + expect(provider.name).to eq('foo::bar_domain') end end - describe 'v3 domains with domain in name/title and in resource and in tenant' do + describe 'v3 domains with domain in name/title and in resource and in tenant', :project_only => true do let(:user_attrs) do { :name => 'foo::bar_domain', @@ -618,6 +639,7 @@ def before_hook(delete, missing, noproject, user_cached) provider.create expect(provider.exists?).to be_truthy expect(provider.id).to eq("2cb05cfed7c24279be884ba4f6520262") + expect(provider.name).to eq('foo::bar_domain') end end end diff --git a/keystone/spec/unit/provider/keystone_user_role/openstack_spec.rb b/keystone/spec/unit/provider/keystone_user_role/openstack_spec.rb index 7a88d85c3..51c147535 100644 --- a/keystone/spec/unit/provider/keystone_user_role/openstack_spec.rb +++ b/keystone/spec/unit/provider/keystone_user_role/openstack_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' require 'puppet/provider/keystone_user_role/openstack' +setup_provider_tests + provider_class = Puppet::Type.type(:keystone_user_role).provider(:openstack) def user_class Puppet::Type.type(:keystone_user).provider(:openstack) @@ -12,6 +14,10 @@ def project_class describe provider_class do + after :each do + provider_class.reset + end + # assumes Enabled is the last column - no quotes def list_to_csv(thelist) if thelist.is_a?(String) diff --git a/manila/spec/acceptance/basic_manila_spec.rb b/manila/spec/acceptance/basic_manila_spec.rb index 00fdad668..9095f0e14 100644 --- a/manila/spec/acceptance/basic_manila_spec.rb +++ b/manila/spec/acceptance/basic_manila_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/manila/spec/acceptance/manila_config_spec.rb b/manila/spec/acceptance/manila_config_spec.rb index 12488fdf5..d2c2ad4ce 100644 --- a/manila/spec/acceptance/manila_config_spec.rb +++ b/manila/spec/acceptance/manila_config_spec.rb @@ -43,11 +43,14 @@ end describe file('/etc/manila/manila.conf') do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.to_not match /thisshouldnotexist/ } + end end diff --git a/module-collectd/README.md b/module-collectd/README.md index aa88642d9..a1937c05c 100644 --- a/module-collectd/README.md +++ b/module-collectd/README.md @@ -116,6 +116,7 @@ documentation for each plugin for configurable attributes. * `write_http` (see [collectd::plugin::write_http](#class-collectdpluginwrite_http) below) * `write_network` (see [collectd::plugin::write_network](#class-collectdpluginwrite_network) below) * `write_riemann` (see [collectd::plugin::write_riemann](#class-collectdpluginwrite_riemann) below) +* `write_sensu` (see [collectd::plugin::write_sensu](#class-collectdpluginwrite_sensu) below) * `zfs_arc` (see [collectd::plugin::zfs_arc](#class-collectdpluginzfs_arc) below) ####Class: `collectd::plugin::aggregation` @@ -1115,6 +1116,14 @@ class { 'collectd::plugin::write_riemann': } ``` +####Class: `collectd::plugin::write_sensu` + +```puppet +class { 'collectd::plugin::write_sensu': + riemann_host => 'sensu.example.org', + riemann_port => 3030, +} +``` ####Class: `collectd::plugin::zfs_arc` diff --git a/module-collectd/manifests/plugin/write_sensu.pp b/module-collectd/manifests/plugin/write_sensu.pp new file mode 100644 index 000000000..3613e0e7d --- /dev/null +++ b/module-collectd/manifests/plugin/write_sensu.pp @@ -0,0 +1,28 @@ +# https://collectd.org/wiki/index.php/Plugin:Write_Riemann +class collectd::plugin::write_sensu ( + $ensure = present, + $sensu_host = 'localhost', + $sensu_port = 3030, + $store_rates = false, + $always_append_ds = false, + $interval = undef, + $metrics = false, + $metrics_handler = 'example_metric_handler', + $notifications = false, + $notifs_handler = 'example_notification_handler', +) { + validate_bool($store_rates) + validate_bool($always_append_ds) + + if $::osfamily == 'Redhat' { + package { 'collectd-write_sensu': + ensure => $ensure, + } + } + + collectd::plugin {'write_sensu': + ensure => $ensure, + content => template('collectd/plugin/write_sensu.conf.erb'), + interval => $interval, + } +} diff --git a/module-collectd/templates/plugin/snmp.conf.erb b/module-collectd/templates/plugin/snmp.conf.erb index e92e3bfdd..39f65cf3f 100644 --- a/module-collectd/templates/plugin/snmp.conf.erb +++ b/module-collectd/templates/plugin/snmp.conf.erb @@ -14,8 +14,8 @@ <% if val['Scale'] -%> Scale <%= val['Scale'] %> <% end -%> -<% if val['Shitf'] -%> - Shitf <%= val['Shitf'] %> +<% if val['Shift'] -%> + Shift <%= val['Shift'] %> <% end -%> <% end -%> diff --git a/module-collectd/templates/plugin/write_sensu.conf.erb b/module-collectd/templates/plugin/write_sensu.conf.erb new file mode 100644 index 000000000..f5e46c84f --- /dev/null +++ b/module-collectd/templates/plugin/write_sensu.conf.erb @@ -0,0 +1,26 @@ +LoadPlugin "write_sensu" + + Attribute "production" "true" + Tag "appserver" + + Host "<%= @sensu_host %>" + Port "<%= @sensu_port %>" + EventServicePrefix "collectd/" + Separator "/" + StoreRates <%= @store_rates %> + AlwaysAppendDS <%= @always_append_ds %> + # Optionally specify Sensu handlers + Metrics <%= @metrics %> + <%- if @metrics -%> + MetricHandler "<%= @metrics_handler %>" + <%- else -%> + #MetricHandler "<%= @metrics_handler %>" + <%- end -%> + Notifications <%= @notifications %> + <%- if @notifications -%> + NotificationHandler "<%= @notifs_handler %>" + <%- else -%> + #NotificationHandler "<%= @notifs_handler %>" + <%- end -%> + + \ No newline at end of file diff --git a/neutron/examples/cisco_ml2.pp b/neutron/examples/cisco_ml2.pp index 9d2efe623..0a3c5a63c 100644 --- a/neutron/examples/cisco_ml2.pp +++ b/neutron/examples/cisco_ml2.pp @@ -38,20 +38,28 @@ 'nve_src_intf' => 1, 'physnet' => 'physnet', 'servers' => { - 'control1' => 'ethernet:1/1', - 'control2' => 'ethernet:1/2' + 'control1' => { + 'ports' => 'ethernet:1/1', + }, + 'control2' => { + 'ports' => 'ethernet:1/2', + }, } }, 'n9372-2' => { 'username' => 'admin', 'password' => 'password', 'ssh_port' => 22, - 'ip_address' => '127.0.0.1', + 'ip_address' => '127.0.0.2', 'nve_src_intf' => 1, 'physnet' => 'physnet', 'servers' => { - 'compute1' => 'ethernet:1/1', - 'compute2' => 'ethernet:1/2' + 'compute1' => { + 'ports' => 'ethernet:1/1', + }, + 'compute2' => { + 'ports' => 'ethernet:1/2', + }, } } }, diff --git a/neutron/manifests/agents/ml2/ovs.pp b/neutron/manifests/agents/ml2/ovs.pp index 73550ac79..cc9a454e3 100644 --- a/neutron/manifests/agents/ml2/ovs.pp +++ b/neutron/manifests/agents/ml2/ovs.pp @@ -97,6 +97,14 @@ # flow tables resetting # Defaults to false # +# [*manage_vswitch*] +# (optional) This boolean is used to indicate if this class should manage the +# vswitch software installation and the ovs bridges/ports from the +# $bridge_mappings parameter. If manage_vswitch is set to true, then we will +# require the vswitch::ovs and configure the ovs bridges/ports using the +# mappings provided as part of the $bridge_mappings parameters. +# Defaults to true +# class neutron::agents::ml2::ovs ( $package_ensure = 'present', $enabled = true, @@ -115,10 +123,13 @@ $firewall_driver = 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', $enable_distributed_routing = false, $drop_flows_on_start = false, + $manage_vswitch = true, ) { include ::neutron::params - require vswitch::ovs + if $manage_vswitch { + require vswitch::ovs + } if $enable_tunneling and ! $local_ip { fail('Local ip for ovs agent must be set when tunneling is enabled') @@ -149,11 +160,13 @@ neutron_agent_ovs { 'ovs/bridge_mappings': value => $br_map_str; } - neutron::plugins::ovs::bridge{ $bridge_mappings: - before => Service['neutron-ovs-agent-service'], - } - neutron::plugins::ovs::port{ $bridge_uplinks: - before => Service['neutron-ovs-agent-service'], + if ($manage_vswitch) { + neutron::plugins::ovs::bridge{ $bridge_mappings: + before => Service['neutron-ovs-agent-service'], + } + neutron::plugins::ovs::port{ $bridge_uplinks: + before => Service['neutron-ovs-agent-service'], + } } } diff --git a/neutron/manifests/plugins/ml2/bigswitch.pp b/neutron/manifests/plugins/ml2/bigswitch.pp new file mode 100644 index 000000000..889b00d8e --- /dev/null +++ b/neutron/manifests/plugins/ml2/bigswitch.pp @@ -0,0 +1,29 @@ +# +# Install the Big Switch ML2 plugin. +# +# === Parameters +# +# [*package_ensure*] +# (optional) The intended state of the Big Switch ML2 plugin package +# (python-bsnstacklib) package, i.e. any of the possible values of the +# 'ensure' property for a package resource type. Defaults to +# 'present' +# +class neutron::plugins::ml2::bigswitch ( + $package_ensure = 'present', +) { + include ::neutron::params + require ::neutron::plugins::ml2 + + if($::osfamily != 'Redhat') { + # Drivers are only packaged for RedHat at this time + fail("Unsupported osfamily ${::osfamily}") + } + + ensure_packages('python-networking-bigswitch', + { + ensure => $package_ensure, + tag => 'openstack', + } + ) +} diff --git a/neutron/manifests/plugins/ml2/bigswitch/restproxy.pp b/neutron/manifests/plugins/ml2/bigswitch/restproxy.pp new file mode 100644 index 000000000..a53ab769b --- /dev/null +++ b/neutron/manifests/plugins/ml2/bigswitch/restproxy.pp @@ -0,0 +1,58 @@ +# +# Set config file parameters for connecting Neutron server to Big +# Switch controllers. +# +# === Parameters +# +# [*servers*] +# Comma-separated list of Big Switch controllers. +# The format is "IP:port,IP:port". +# +# [*server_auth*] +# Credentials for the Big Switch controllers. +# The format is "username:password". +# +# [*auto_sync_on_failure*] +# (optional) When a failover happens in active/passive Big Switch +# controllers, resynchronize with the new master server. Defaults to +# true. +# +# [*consistency_interval*] +# (optional) Interval of a keepalive message sent from Neutron server +# to a Big Switch controller. Defaults to 60. +# +# [*neutron_id*] +# (optional) Unique identifier of the Neutron instance for the Big +# Switch controller. Defaults to 'neutron'. +# +# [*server_ssl*] +# (optional) Whether Neutron should use SSL to talk to the Big Switch +# controllers. Defaults to true. +# +# [*ssl_cert_directory*] +# (optional) Directory where Big Switch controller certificate will be +# stored. Defaults to '/var/lib/neutron'. +# +class neutron::plugins::ml2::bigswitch::restproxy ( + $servers, + $server_auth, + + $auto_sync_on_failure = true, + $consistency_interval = 60, + $neutron_id = 'neutron', + $server_ssl = true, + $ssl_cert_directory = '/var/lib/neutron', +) { + require ::neutron::plugins::ml2::bigswitch + + neutron_plugin_ml2 { + 'restproxy/servers' : value => $servers; + 'restproxy/server_auth' : value => $server_auth; + + 'restproxy/auto_sync_on_failure' : value => $auto_sync_on_failure; + 'restproxy/consistency_interval' : value => $consistency_interval; + 'restproxy/neutron_id' : value => $neutron_id; + 'restproxy/server_ssl' : value => $server_ssl; + 'restproxy/ssl_cert_directory' : value => $ssl_cert_directory; + } +} diff --git a/neutron/manifests/plugins/ml2/cisco/nexus.pp b/neutron/manifests/plugins/ml2/cisco/nexus.pp index c5f9cf38e..bbd42e7c3 100644 --- a/neutron/manifests/plugins/ml2/cisco/nexus.pp +++ b/neutron/manifests/plugins/ml2/cisco/nexus.pp @@ -16,8 +16,8 @@ # 'nve_src_intf' => 1, # 'physnet' => "physnet1", # 'servers' => { -# 'control01' => "portchannel:20", -# 'control02' => "portchannel:10" +# 'control01' => {"ports" => "portchannel:20"}, +# 'control02' => {"ports" => "portchannel:10"} # }}} # # [*managed_physical_network*] @@ -124,13 +124,7 @@ 'ml2_cisco/host_key_checks' : value => $host_key_checks; } - file { 'nexus_config': - path => $::neutron::params::cisco_ml2_mech_cisco_nexus_config_file, - owner => 'root', - group => 'neutron', - mode => '0644', - content => template('neutron/ml2_mech_cisco_nexus_conf.erb'), - } ~> Service['neutron-server'] + create_resources(neutron::plugins::ml2::cisco::nexus_switch, $nexus_config) create_resources(neutron::plugins::ml2::cisco::nexus_creds, $nexus_config) diff --git a/neutron/manifests/plugins/ml2/cisco/nexus_switch.pp b/neutron/manifests/plugins/ml2/cisco/nexus_switch.pp new file mode 100644 index 000000000..e18fe5a3c --- /dev/null +++ b/neutron/manifests/plugins/ml2/cisco/nexus_switch.pp @@ -0,0 +1,105 @@ +# == Define: neutron::plugins::ml2::cisco::nexus_switch +# +# Defined type to configure the Cisco Nexus Switch parameters +# for use by the ML2 Mech Driver for Cisco Nexus Switches. +# +# More info available here: +# https://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus +# +# +# neutron::plugins::ml2::cisco::nexus_switch used by +# neutron::plugins::ml2::cisco::nexus +# +# === Parameters: +# [*username*] +# (required) The username for logging into the switch to manage it. +# +# [*password*] +# (required) The password for logging into the switch to manage it. +# +# [*ip_address*] +# (required) The IP address of the switch. +# +# [*ssh_port*] +# (required) The SSH port to use when connecting to the switch. +# +# [*servers*] +# (required) A hash of server names (key) mapped to the switch's +# interfaces (value). For each host connected to a port on the +# switch, specify the hostname and the Nexus physical port/s +# (interface/s) it is connected to. The values in the hash can +# be a comma separated list of interfaces mapped to the server. +# +# Hash Format: +# +# { +# => {"ports" => ",, ..."}, +# => {"ports" => ",, ..."}, +# } +# +# Interface ID format options: +# ":" +# Valid intf_type's are 'ethernet' and 'port-channel'. +# The default setting for is 'ethernet' and need not be +# added to this setting. +# +# Example: +# { +# 'control1' => {"ports" => 'ethernet:1/1'}, +# 'control2' => {"ports" => 'ethernet:1/2'}, +# 'compute1' => {"ports" => '1/3,1/4'} +# } +# +# [*switchname*] +# (required) An identifier for the switch--ie. hostname or IP +# address of the switch. +# +# [*nve_src_intf*] +# (optional) Only valid if VXLAN overlay is configured and +# vxlan_global_config is set to True. +# +# The NVE source interface is a loopback interface that is configured on +# the switch with valid /32 IP address. This /32 IP address must be known +# by the transient devices in the transport network and the remote VTEPs. +# This is accomplished by advertising it through a dynamic routing protocol +# in the transport network. (NB: If no nve_src_intf is defined then a +# default setting of 0 (creates "loopback0") will be used.) +# +# Defaults to undef. +# +# [*physnet*] +# (optional) Only valid if VXLAN overlay is configured. +# The physical network name defined in the network_vlan_ranges variable +# (defined under the ml2_type_vlan section) that this switch is controlling. +# The configured 'physnet' is the physical network domain that is connected +# to this switch. The vlan ranges defined in network_vlan_ranges for a +# a physical network are allocated dynamically and are unique per physical +# network. These dynamic vlans may be reused across physical networks. +# +# Defaults to undef. +# +define neutron::plugins::ml2::cisco::nexus_switch( + $username, + $password, + $ip_address, + $ssh_port, + $servers, + $switchname = $title, + $nve_src_intf = undef, + $physnet = undef +) { + $section = "ML2_MECH_CISCO_NEXUS:${ip_address}" + neutron_plugin_ml2 { + "${section}/username": value => $username; + "${section}/password": value => $password; + "${section}/ssh_port": value => $ssh_port; + "${section}/nve_src_intf": value => $nve_src_intf; + "${section}/physnet": value => $physnet; + } + + $server_defaults = { + 'switch_ip_address' => $ip_address + } + create_resources(neutron::plugins::ml2::cisco::nexus_switch_server, + $servers, $server_defaults) +} diff --git a/neutron/manifests/plugins/ml2/cisco/nexus_switch_server.pp b/neutron/manifests/plugins/ml2/cisco/nexus_switch_server.pp new file mode 100644 index 000000000..5c63dff1c --- /dev/null +++ b/neutron/manifests/plugins/ml2/cisco/nexus_switch_server.pp @@ -0,0 +1,33 @@ +# == Define: neutron::plugins::ml2::cisco::nexus_switch +# +# Defined type to configure the Cisco Nexus Switch parameters +# for servers connected to the switch for use by the ML2 Mech +# Driver for Cisco Nexus Switches. +# +# More info available here: +# https://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus +# +# +# neutron::plugins::ml2::cisco::nexus_switch_server used by +# neutron::plugins::ml2::cisco::nexus_switch +# +# === Parameters: +# [*switch_ip_address*] +# (required) The IP address for the switch. +# +# [*ports*] +# (required) The switch ports connected to this server. +# +# [*hostname*] +# (required) The hostname of a host connected to the switch. +# +define neutron::plugins::ml2::cisco::nexus_switch_server( + $switch_ip_address, + $ports, + $hostname = $title, +) { + $section = "ML2_MECH_CISCO_NEXUS:${switch_ip_address}" + neutron_plugin_ml2 { + "${section}/${hostname}": value => $ports; + } +} diff --git a/neutron/spec/acceptance/basic_neutron_spec.rb b/neutron/spec/acceptance/basic_neutron_spec.rb index a9215df39..fdee5aeb5 100644 --- a/neutron/spec/acceptance/basic_neutron_spec.rb +++ b/neutron/spec/acceptance/basic_neutron_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/neutron/spec/acceptance/neutron_config_spec.rb b/neutron/spec/acceptance/neutron_config_spec.rb index 2c7bc3b23..83df02982 100644 --- a/neutron/spec/acceptance/neutron_config_spec.rb +++ b/neutron/spec/acceptance/neutron_config_spec.rb @@ -494,11 +494,14 @@ $neutron_files.each do |neutron_conf_file| describe file(neutron_conf_file) do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.to_not match /thisshouldnotexist/ } + end end end diff --git a/neutron/spec/classes/neutron_agents_ml2_ovs_spec.rb b/neutron/spec/classes/neutron_agents_ml2_ovs_spec.rb index dc62d3cce..0f32a63a6 100644 --- a/neutron/spec/classes/neutron_agents_ml2_ovs_spec.rb +++ b/neutron/spec/classes/neutron_agents_ml2_ovs_spec.rb @@ -20,7 +20,8 @@ :arp_responder => false, :drop_flows_on_start => false, :enable_distributed_routing => false, - :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver' } + :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', + :manage_vswitch => true } end let :default_facts do @@ -116,6 +117,10 @@ params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex']) end + it 'should require vswitch::ovs' do + is_expected.to contain_class('vswitch::ovs') + end + it 'configures bridge mappings' do is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings') end @@ -133,6 +138,32 @@ end end + context 'when supplying bridge mappings for provider networks with manage vswitch set to false' do + before :each do + params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex'], :manage_vswitch => false) + end + + it 'should not require vswitch::ovs' do + is_expected.not_to contain_class('vswitch::ovs') + end + + it 'configures bridge mappings' do + is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings') + end + + it 'should not configure bridge mappings' do + is_expected.not_to contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with( + :before => 'Service[neutron-ovs-agent-service]' + ) + end + + it 'should not configure bridge uplinks' do + is_expected.not_to contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with( + :before => 'Service[neutron-ovs-agent-service]' + ) + end + end + context 'when enabling tunneling' do context 'without local ip address' do before :each do diff --git a/neutron/spec/classes/neutron_plugins_ml2_bigswitch_restproxy_spec.rb b/neutron/spec/classes/neutron_plugins_ml2_bigswitch_restproxy_spec.rb new file mode 100644 index 000000000..42fc79e78 --- /dev/null +++ b/neutron/spec/classes/neutron_plugins_ml2_bigswitch_restproxy_spec.rb @@ -0,0 +1,78 @@ +# +# Unit tests for neutron::plugins::ml2::cisco::nexus class +# + +require 'spec_helper' + +describe 'neutron::plugins::ml2::bigswitch::restproxy' do + + let :pre_condition do + "class { 'neutron::server': auth_password => 'password'} + class { 'neutron': + rabbit_password => 'passw0rd', + core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin' }" + end + + let :required_params do + { + :servers => '192.168.0.10:8000,192.168.0.11:8000', + :server_auth => 'admin:password', + } + end + + let :params do + required_params + end + + let :default_facts do + { :operatingsystem => 'default', + :operatingsystemrelease => 'default', + } + end + + shared_examples_for 'neutron bigswitch ml2 restproxy' do + + it { is_expected.to contain_class('neutron::params') } + it { is_expected.to contain_class('neutron::plugins::ml2::bigswitch') } + + it do + is_expected.to contain_neutron_plugin_ml2('restproxy/servers').with_value(params[:servers]) + is_expected.to contain_neutron_plugin_ml2('restproxy/server_auth').with_value(params[:server_auth]) + + is_expected.to contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value(true) + is_expected.to contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value(60) + is_expected.to contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('neutron') + is_expected.to contain_neutron_plugin_ml2('restproxy/server_ssl').with_value(true) + is_expected.to contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/neutron') + end + + context 'with custom params' do + let :params do + required_params.merge({ + :auto_sync_on_failure => false, + :consistency_interval => 10, + :neutron_id => 'openstack', + :server_ssl => false, + :ssl_cert_directory => '/var/lib/bigswitch', + }) + end + + it do + is_expected.to contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value(false) + is_expected.to contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value(10) + is_expected.to contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('openstack') + is_expected.to contain_neutron_plugin_ml2('restproxy/server_ssl').with_value(false) + is_expected.to contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/bigswitch') + end + end + + end + + context 'on RedHat platforms' do + let :facts do + default_facts.merge({:osfamily => 'RedHat'}) + end + + it_configures 'neutron bigswitch ml2 restproxy' + end +end diff --git a/neutron/spec/classes/neutron_plugins_ml2_bigswitch_spec.rb b/neutron/spec/classes/neutron_plugins_ml2_bigswitch_spec.rb new file mode 100644 index 000000000..80ace6c08 --- /dev/null +++ b/neutron/spec/classes/neutron_plugins_ml2_bigswitch_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +describe 'neutron::plugins::ml2::bigswitch' do + + let :pre_condition do + "class { 'neutron::server': auth_password => 'password'} + class { 'neutron': + rabbit_password => 'passw0rd', + core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin' }" + end + + let :default_params do + { + :package_ensure => 'present' + } + end + + let :params do + {} + end + + let :default_facts do + { + :operatingsystem => 'default', + :operatingsystemrelease => 'default', + } + end + + + shared_examples_for 'neutron plugin bigswitch ml2' do + before do + params.merge!(default_params) + end + + it { is_expected.to contain_class('neutron::params') } + + it 'should have' do + is_expected.to contain_package('python-networking-bigswitch').with( + :ensure => params[:package_ensure], + :tag => 'openstack' + ) + end + end + + context 'on RedHat platforms' do + let :facts do + default_facts.merge({:osfamily => 'RedHat'}) + end + + it_configures 'neutron plugin bigswitch ml2' + end + + context 'on Debian platforms' do + let :facts do + default_facts.merge({:osfamily => 'Debian'}) + end + + it { is_expected.to raise_error(Puppet::Error, /Unsupported osfamily Debian/) } + end +end diff --git a/neutron/spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb b/neutron/spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb index cab9d7acb..7bbd167e5 100644 --- a/neutron/spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb +++ b/neutron/spec/classes/neutron_plugins_ml2_cisco_nexus_spec.rb @@ -24,8 +24,8 @@ class { 'neutron': "nve_src_intf" => 1, "physnet" => "physnet1", "servers" => { - "control02" => "portchannel:20", - "control01" => "portchannel:10" + "control02" => {"ports" => "portchannel:20"}, + "control01" => {"ports" => "portchannel:10"} } } }, @@ -76,14 +76,11 @@ class { 'neutron': is_expected.to contain_neutron_plugin_ml2('ml2_cisco/host_key_checks').with_value(params[:host_key_checks]) end - it { should contain_file('nexus_config').with({ - :path => platform_params[:cisco_ml2_config_file]}) } - it { # Stored as an array of arrays with the first element consisting of the name and # the second element consisting of the config hash params[:nexus_config].each do |switch_config| - should contain_neutron__plugins__ml2__cisco__nexus_creds(switch_config.first) + is_expected.to contain_neutron__plugins__ml2__cisco__nexus_creds(switch_config.first) end } diff --git a/neutron/templates/ml2_mech_cisco_nexus_conf.erb b/neutron/templates/ml2_mech_cisco_nexus_conf.erb deleted file mode 100644 index b9209274b..000000000 --- a/neutron/templates/ml2_mech_cisco_nexus_conf.erb +++ /dev/null @@ -1,59 +0,0 @@ -# Cisco Nexus Switch configurations. -# Each switch to be managed by Openstack Neutron must be configured here. -# -# Cisco Nexus Switch Format. -# [ml2_mech_cisco_nexus:] -# = (1) -# ssh_port= (2) -# username= (3) -# password= (4) -# nve_src_intf= (5) -# physnet= (6) -# -# (1) For each host connected to a port on the switch, specify the hostname -# and the Nexus physical port (interface) it is connected to. -# Valid intf_type's are 'ethernet' and 'port-channel'. -# The default setting for is 'ethernet' and need not be -# added to this setting. -# (2) The TCP port for connecting via SSH to manage the switch. This is -# port number 22 unless the switch has been configured otherwise. -# (3) The username for logging into the switch to manage it. -# (4) The password for logging into the switch to manage it. -# (5) Only valid if VXLAN overlay is configured and vxlan_global_config is -# set to True. -# The NVE source interface is a loopback interface that is configured on -# the switch with valid /32 IP address. This /32 IP address must be known -# by the transient devices in the transport network and the remote VTEPs. -# This is accomplished by advertising it through a dynamic routing protocol -# in the transport network. (NB: If no nve_src_intf is defined then a -# default setting of 0 (creates "loopback0") will be used.) -# (6) Only valid if VXLAN overlay is configured. -# The physical network name defined in the network_vlan_ranges variable -# (defined under the ml2_type_vlan section) that this switch is controlling. -# The configured 'physnet' is the physical network domain that is connected -# to this switch. The vlan ranges defined in network_vlan_ranges for a -# a physical network are allocated dynamically and are unique per physical -# network. These dynamic vlans may be reused across physical networks. -# -# Example: -# [ml2_mech_cisco_nexus:1.1.1.1] -# compute1=1/1 -# compute2=ethernet:1/2 -# compute3=port-channel:1 -# ssh_port=22 -# username=admin -# password=mySecretPassword -# nve_src_intf=1 -# physnet=physnet1 - -<% @nexus_config.each do |switch_hostname, switch_data| %> -[ML2_MECH_CISCO_NEXUS:<%= switch_data['ip_address'] %>] -<%- switch_data['servers'].each do |host_name, port| -%> -<%=host_name-%>=<%= port %> -<%- end -%> -ssh_port=<%= switch_data['ssh_port'] %> -username=<%= switch_data['username'] %> -password=<%= switch_data['password'] %> -nve_src_intf=<%= switch_data['nve_src_intf'] %> -physnet=<%= switch_data['physnet'] %> -<% end %> diff --git a/nova/lib/puppet/provider/nova_network/nova_manage.rb b/nova/lib/puppet/provider/nova_network/nova_manage.rb index ce5337119..b89f61ef0 100644 --- a/nova/lib/puppet/provider/nova_network/nova_manage.rb +++ b/nova/lib/puppet/provider/nova_network/nova_manage.rb @@ -1,4 +1,7 @@ -Puppet::Type.type(:nova_network).provide(:nova_manage) do +require File.join(File.dirname(__FILE__), '..','..','..', + 'puppet/provider/nova') + +Puppet::Type.type(:nova_network).provide(:nova_manage, :parent => Puppet::Provider::Nova) do desc "Manage nova network" @@ -40,7 +43,7 @@ def create end end - nova('network-create', + auth_nova('network-create', resource[:label], '--fixed-range-v4', resource[:name], diff --git a/nova/manifests/compute.pp b/nova/manifests/compute.pp index beea4e8c5..a1901e9e3 100644 --- a/nova/manifests/compute.pp +++ b/nova/manifests/compute.pp @@ -111,6 +111,10 @@ # "[ { 'vendor_id':'1234','product_id':'5678' }, # { 'vendor_id':'4321','product_id':'8765','physical_network':'default' } ] " # +# [*config_drive_format*] +# (optional) Config drive format. One of iso9660 (default) or vfat +# Defaults to undef +# class nova::compute ( $enabled = true, $manage_service = true, @@ -137,6 +141,7 @@ $internal_service_availability_zone = 'internal', $heal_instance_info_cache_interval = '60', $pci_passthrough = undef, + $config_drive_format = undef, ) { include ::nova::params @@ -231,4 +236,10 @@ 'DEFAULT/pci_passthrough_whitelist': value => check_array_of_hash($pci_passthrough); } } + + if ($config_drive_format) { + nova_config { + 'DEFAULT/config_drive_format': value => $config_drive_format; + } + } } diff --git a/nova/manifests/init.pp b/nova/manifests/init.pp index 6b7339c74..3b5737f48 100644 --- a/nova/manifests/init.pp +++ b/nova/manifests/init.pp @@ -30,7 +30,7 @@ # # [*image_service*] # (optional) Service used to search for and retrieve images. -# Defaults to 'nova.image.local.LocalImageService' +# Defaults to 'nova.image.glance.GlanceImageService' # # [*glance_api_servers*] # (optional) List of addresses for api servers. diff --git a/nova/spec/acceptance/basic_nova_spec.rb b/nova/spec/acceptance/basic_nova_spec.rb index cec443d9f..476930667 100644 --- a/nova/spec/acceptance/basic_nova_spec.rb +++ b/nova/spec/acceptance/basic_nova_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/nova/spec/classes/nova_compute_spec.rb b/nova/spec/classes/nova_compute_spec.rb index 01a4d484b..89e0d3bc6 100644 --- a/nova/spec/classes/nova_compute_spec.rb +++ b/nova/spec/classes/nova_compute_spec.rb @@ -59,7 +59,8 @@ :default_schedule_zone => 'az2', :internal_service_availability_zone => 'az_int1', :heal_instance_info_cache_interval => '120', - :pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]" + :pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]", + :config_drive_format => 'vfat' } end @@ -110,6 +111,9 @@ 'value' => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]" ) end + it 'configures nova config_drive_format to vfat' do + is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat') + end end context 'with neutron_enabled set to false' do diff --git a/openstack_extras/spec/classes/openstack_extras_auth_file_spec.rb b/openstack_extras/spec/classes/openstack_extras_auth_file_spec.rb index 1e695b8f9..343d2fd1a 100644 --- a/openstack_extras/spec/classes/openstack_extras_auth_file_spec.rb +++ b/openstack_extras/spec/classes/openstack_extras_auth_file_spec.rb @@ -93,6 +93,6 @@ } end - it { should contain_file('/tmp/openrc')} + it { is_expected.to contain_file('/tmp/openrc')} end end diff --git a/openstack_extras/spec/classes/openstack_extras_repo_debian_debian_spec.rb b/openstack_extras/spec/classes/openstack_extras_repo_debian_debian_spec.rb index 56c0a4c78..31232803f 100644 --- a/openstack_extras/spec/classes/openstack_extras_repo_debian_debian_spec.rb +++ b/openstack_extras/spec/classes/openstack_extras_repo_debian_debian_spec.rb @@ -34,19 +34,19 @@ {}.merge!(default_params) end - it { should contain_apt__source('debian_wheezy').with( + it { is_expected.to contain_apt__source('debian_wheezy').with( :location => 'http://archive.gplhost.com/debian', :release => 'kilo', :repos => 'main', )} - it { should contain_apt__source('debian_wheezy_backports').with( + it { is_expected.to contain_apt__source('debian_wheezy_backports').with( :location => 'http://archive.gplhost.com/debian', :release => 'kilo-backports', :repos => 'main' )} - it { should contain_exec('installing gplhost-archive-keyring') } + it { is_expected.to contain_exec('installing gplhost-archive-keyring') } end describe 'with overridden release' do @@ -54,19 +54,19 @@ default_params.merge!({ :release => 'juno' }) end - it { should contain_apt__source('debian_wheezy').with( + it { is_expected.to contain_apt__source('debian_wheezy').with( :location => 'http://archive.gplhost.com/debian', :release => 'juno', :repos => 'main', )} - it { should contain_apt__source('debian_wheezy_backports').with( + it { is_expected.to contain_apt__source('debian_wheezy_backports').with( :location => 'http://archive.gplhost.com/debian', :release => 'juno-backports', :repos => 'main' )} - it { should contain_exec('installing gplhost-archive-keyring') } + it { is_expected.to contain_exec('installing gplhost-archive-keyring') } end describe 'when not managing wheezy repo' do @@ -74,7 +74,7 @@ default_params.merge!({ :manage_whz => false }) end - it { should_not contain_exec('installing gplhost-archive-keyring') } + it { is_expected.to_not contain_exec('installing gplhost-archive-keyring') } end describe 'with overridden source hash' do @@ -96,13 +96,13 @@ }) end - it { should contain_apt__source('debian_unstable').with( + it { is_expected.to contain_apt__source('debian_unstable').with( :location => 'http://mymirror/debian/', :release => 'unstable', :repos => 'main' )} - it { should contain_apt__source('puppetlabs').with( + it { is_expected.to contain_apt__source('puppetlabs').with( :location => 'http://apt.puppetlabs.com', :repos => 'main', :release => 'wheezy', @@ -110,7 +110,7 @@ :key_server => 'pgp.mit.edu' )} - it { should contain_exec('installing gplhost-archive-keyring') } + it { is_expected.to contain_exec('installing gplhost-archive-keyring') } end describe 'with overridden source default' do @@ -129,14 +129,14 @@ }) end - it { should contain_apt__source('debian_unstable').with( + it { is_expected.to contain_apt__source('debian_unstable').with( :location => 'http://mymirror/debian/', :release => 'unstable', :repos => 'main', :include_src => 'true' )} - it { should contain_exec('installing gplhost-archive-keyring') } + it { is_expected.to contain_exec('installing gplhost-archive-keyring') } end end end diff --git a/openstack_extras/spec/classes/openstack_extras_repo_debian_ubuntu_spec.rb b/openstack_extras/spec/classes/openstack_extras_repo_debian_ubuntu_spec.rb index 7489b480f..4cefc7a38 100644 --- a/openstack_extras/spec/classes/openstack_extras_repo_debian_ubuntu_spec.rb +++ b/openstack_extras/spec/classes/openstack_extras_repo_debian_ubuntu_spec.rb @@ -35,13 +35,13 @@ {}.merge!(default_params) end - it { should contain_apt__source('ubuntu-cloud-archive').with( + it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with( :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :release => 'trusty-updates/kilo', :repos => 'main', )} - it { should contain_exec('installing ubuntu-cloud-keyring') } + it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') } end @@ -50,13 +50,13 @@ default_params.merge!({ :release => 'juno' }) end - it { should contain_apt__source('ubuntu-cloud-archive').with( + it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with( :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :release => 'trusty-updates/juno', :repos => 'main', )} - it { should contain_exec('installing ubuntu-cloud-keyring') } + it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') } end describe 'when not managing UCA' do @@ -64,7 +64,7 @@ default_params.merge!({ :manage_uca => false }) end - it { should_not contain_exec('installing ubuntu-cloud-keyring') } + it { is_expected.to_not contain_exec('installing ubuntu-cloud-keyring') } end describe 'with overridden source hash' do @@ -86,13 +86,13 @@ }) end - it { should contain_apt__source('local_mirror').with( + it { is_expected.to contain_apt__source('local_mirror').with( :location => 'http://mymirror/ubuntu/', :release => 'trusty', :repos => 'main' )} - it { should contain_apt__source('puppetlabs').with( + it { is_expected.to contain_apt__source('puppetlabs').with( :location => 'http://apt.puppetlabs.com', :release => 'trusty', :repos => 'main', @@ -100,7 +100,7 @@ :key_server => 'pgp.mit.edu' )} - it { should contain_exec('installing ubuntu-cloud-keyring') } + it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') } end describe 'with overridden source default' do @@ -119,14 +119,14 @@ }) end - it { should contain_apt__source('local_mirror').with( + it { is_expected.to contain_apt__source('local_mirror').with( :include_src => 'true', :location => 'http://mymirror/ubuntu/', :release => 'trusty', :repos => 'main', )} - it { should contain_exec('installing ubuntu-cloud-keyring') } + it { is_expected.to contain_exec('installing ubuntu-cloud-keyring') } end describe 'with overridden uca repo name' do @@ -134,7 +134,7 @@ default_params.merge!({ :repo => 'proposed' }) end - it { should contain_apt__source('ubuntu-cloud-archive').with( + it { is_expected.to contain_apt__source('ubuntu-cloud-archive').with( :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :release => 'trusty-proposed/kilo', :repos => 'main', diff --git a/openstack_extras/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb b/openstack_extras/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb index 135ccf7b6..d8e762bec 100644 --- a/openstack_extras/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb +++ b/openstack_extras/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb @@ -49,7 +49,7 @@ {}.merge!(default_params) end - it { should contain_yumrepo('rdo-release').with( + it { is_expected.to contain_yumrepo('rdo-release').with( :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/", :descr => "OpenStack Kilo Repository", :priority => 98, @@ -63,7 +63,7 @@ # 'metalink' property is supported from Puppet 3.5 if Puppet.version.to_f >= 3.5 - it { should contain_yumrepo('epel').with( + it { is_expected.to contain_yumrepo('epel').with( :metalink => "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch", :descr => 'Extra Packages for Enterprise Linux 7 - $basearch', :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7", @@ -75,7 +75,7 @@ :notify => "Exec[yum_refresh]" )} else - it { should contain_yumrepo('epel').with( + it { is_expected.to contain_yumrepo('epel').with( :baseurl => "https://download.fedoraproject.org/pub/epel/7/\$basearch", :descr => 'Extra Packages for Enterprise Linux 7 - $basearch', :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7", @@ -88,7 +88,7 @@ )} end - it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( + it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( :source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Kilo", :owner => 'root', :group => 'root', @@ -103,13 +103,13 @@ default_params.merge!({ :release => 'juno' }) end - it { should contain_yumrepo('rdo-release').with( + it { is_expected.to contain_yumrepo('rdo-release').with( :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7/", :descr => "OpenStack Juno Repository", :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno" )} - it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno').with( + it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Juno').with( :source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-RDO-Juno" )} end @@ -131,7 +131,7 @@ }) end - it { should contain_yumrepo('CentOS-Base').with( + it { is_expected.to contain_yumrepo('CentOS-Base').with( :baseurl => "http://mymirror/$releasever/os/$basearch/", :descr => "CentOS-$releasever - Base", :enabled => '1', @@ -142,7 +142,7 @@ :notify => "Exec[yum_refresh]" )} - it { should contain_yumrepo('CentOS-Updates').with( + it { is_expected.to contain_yumrepo('CentOS-Updates').with( :baseurl => "http://mymirror/$releasever/updates/$basearch/", :descr => "CentOS-$releasever - Updates", :enabled => '1', @@ -163,7 +163,7 @@ }) end - it { should contain_yumrepo('rdo-release').with( + it { is_expected.to contain_yumrepo('rdo-release').with( :baseurl => "http://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/", :descr => "OpenStack Kilo Repository", :gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo", @@ -179,7 +179,7 @@ }) end - it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( + it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-RDO-Kilo').with( :owner => "steve" )} end @@ -189,7 +189,7 @@ default_params.merge!({ :manage_epel => false }) end - it { should_not contain_yumrepo('epel') } + it { is_expected.to_not contain_yumrepo('epel') } end describe 'with rdo management disabled' do @@ -197,7 +197,7 @@ default_params.merge!({ :manage_rdo => false }) end - it { should_not contain_yumrepo('rdo-release') } + it { is_expected.to_not contain_yumrepo('rdo-release') } end end end diff --git a/openstack_extras/spec/defines/openstack_extras_pacemaker_service_spec.rb b/openstack_extras/spec/defines/openstack_extras_pacemaker_service_spec.rb index 62ebe49ef..02575f96c 100644 --- a/openstack_extras/spec/defines/openstack_extras_pacemaker_service_spec.rb +++ b/openstack_extras/spec/defines/openstack_extras_pacemaker_service_spec.rb @@ -30,18 +30,18 @@ context 'with defaults' do it 'should contain openstack_extras::pacemaker::service definition' do - should contain_openstack_extras__pacemaker__service(title).with(default_params) + is_expected.to contain_openstack_extras__pacemaker__service(title).with(default_params) end it 'should override existing service provider' do - should contain_service('foo-api').with( + is_expected.to contain_service('foo-api').with( { :provider => 'pacemaker' }) end it 'should create a pacemaker primitive' do - should contain_cs_primitive('p_foo-api').with( + is_expected.to contain_cs_primitive('p_foo-api').with( { 'ensure' => default_params[:ensure], 'primitive_class' => default_params[:primitive_class], @@ -54,7 +54,7 @@ }) end it 'should not create a cloned resource' do - should contain_cs_clone('p_foo-api-clone').with( + is_expected.to contain_cs_clone('p_foo-api-clone').with( { 'ensure' => 'absent', }) @@ -75,7 +75,7 @@ let (:ocf_handler_path) { "#{params[:handler_root_path]}/#{ocf_handler_name}" } it 'should create an OCF file' do - should contain_file("#{title}-ocf-file").with( + is_expected.to contain_file("#{title}-ocf-file").with( { 'ensure' => 'present', 'path' => ocf_script_path, @@ -87,7 +87,7 @@ end it 'should create a handler file' do - should contain_file("#{ocf_handler_name}").with( + is_expected.to contain_file("#{ocf_handler_name}").with( { 'ensure' => 'present', 'path' => ocf_handler_path, @@ -115,7 +115,7 @@ } it 'should create an OCF file from template' do - should contain_file("#{title}-ocf-file").with( + is_expected.to contain_file("#{title}-ocf-file").with( { 'path' => ocf_script_path, 'mode' => '0755', @@ -125,11 +125,11 @@ end it 'should not create a handler file' do - should_not contain_file("#{params[:ocf_handler_name]}") + is_expected.to_not contain_file("#{params[:ocf_handler_name]}") end it 'should create a pacemaker primitive' do - should contain_cs_primitive('p_foo-api').with( + is_expected.to contain_cs_primitive('p_foo-api').with( { 'ensure' => params[:ensure], 'primitive_class' => params[:primitive_class], @@ -151,7 +151,7 @@ }) end it 'should create a cloned resource' do - should contain_cs_clone('p_foo-api-clone').with( + is_expected.to contain_cs_clone('p_foo-api-clone').with( { 'ensure' => 'present', 'primitive' => 'p_foo-api', diff --git a/rabbitmq/README.md b/rabbitmq/README.md index 3a0e4ab22..d8fa615fc 100644 --- a/rabbitmq/README.md +++ b/rabbitmq/README.md @@ -390,6 +390,11 @@ Functionality can be tested with cipherscan or similar tool: https://github.com/ The port to use for Stomp. +####`stomp_ssl_only` + +Configures STOMP to only use SSL. No cleartext STOMP TCP listeners will be created. +Requires setting ssl_stomp_port also. + ####`stomp_ensure` Boolean to install the stomp plugin. diff --git a/rabbitmq/manifests/config.pp b/rabbitmq/manifests/config.pp index 7f7ffd693..fce23ceae 100644 --- a/rabbitmq/manifests/config.pp +++ b/rabbitmq/manifests/config.pp @@ -40,6 +40,7 @@ $ssl_versions = $rabbitmq::ssl_versions $ssl_ciphers = $rabbitmq::ssl_ciphers $stomp_port = $rabbitmq::stomp_port + $stomp_ssl_only = $rabbitmq::stomp_ssl_only $ldap_auth = $rabbitmq::ldap_auth $ldap_server = $rabbitmq::ldap_server $ldap_user_dn_pattern = $rabbitmq::ldap_user_dn_pattern diff --git a/rabbitmq/manifests/init.pp b/rabbitmq/manifests/init.pp index 36e0ca0c2..f1346bbc8 100644 --- a/rabbitmq/manifests/init.pp +++ b/rabbitmq/manifests/init.pp @@ -57,6 +57,7 @@ $ldap_log = $rabbitmq::params::ldap_log, $ldap_config_variables = $rabbitmq::params::ldap_config_variables, $stomp_port = $rabbitmq::params::stomp_port, + $stomp_ssl_only = $rabbitmq::params::stomp_ssl_only, $version = $rabbitmq::params::version, $wipe_db_on_cookie_change = $rabbitmq::params::wipe_db_on_cookie_change, $cluster_partition_handling = $rabbitmq::params::cluster_partition_handling, @@ -123,6 +124,7 @@ validate_re($ssl_stomp_port, '\d+') } validate_bool($stomp_ensure) + validate_bool($stomp_ssl_only) validate_bool($ldap_auth) validate_string($ldap_server) validate_string($ldap_user_dn_pattern) @@ -143,6 +145,10 @@ warning('$ssl_stomp_port requires that $ssl => true and will be ignored') } + if $config_stomp and $stomp_ssl_only and ! $ssl_stomp_port { + fail('$stomp_ssl_only requires that $ssl_stomp_port be set') + } + if $ssl_versions { if $ssl { validate_array($ssl_versions) diff --git a/rabbitmq/manifests/params.pp b/rabbitmq/manifests/params.pp index d037b3602..b90831040 100644 --- a/rabbitmq/manifests/params.pp +++ b/rabbitmq/manifests/params.pp @@ -113,6 +113,7 @@ $ldap_log = false $ldap_config_variables = {} $stomp_port = '61613' + $stomp_ssl_only = false $wipe_db_on_cookie_change = false $cluster_partition_handling = 'ignore' $environment_variables = {} diff --git a/rabbitmq/templates/rabbitmq.config.erb b/rabbitmq/templates/rabbitmq.config.erb index 3426ebd7e..8a7502f6b 100644 --- a/rabbitmq/templates/rabbitmq.config.erb +++ b/rabbitmq/templates/rabbitmq.config.erb @@ -94,8 +94,13 @@ <% if @config_stomp -%>, % Configure the Stomp Plugin listening port {rabbitmq_stomp, [ + <%- if @stomp_ssl_only -%> + {tcp_listeners, []} + <%- else -%> {tcp_listeners, [<%= @stomp_port %>]} - <%- if @ssl && @ssl_stomp_port -%>, + <%- end -%> + <%- if @ssl && @ssl_stomp_port -%> + , {ssl_listeners, [<%= @ssl_stomp_port %>]} <%- end -%> ]} diff --git a/sahara/manifests/db.pp b/sahara/manifests/db.pp new file mode 100644 index 000000000..7fc7f7f46 --- /dev/null +++ b/sahara/manifests/db.pp @@ -0,0 +1,91 @@ +# == Class: sahara:db +# +# Configure the Sahara database +# +# == Parameters +# +# [*database_connection*] +# (Optional) The connection string to use to connect to the database. +# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara' +# +# [*database_max_retries*] +# (Optional) Maximum number of database connection retries during startup. +# Set to -1 to specify an infinite retry count. +# Defaults to 10. +# +# [*database_idle_timeout*] +# (Optional) Timeout before idle SQL connections are reaped. +# Defaults to 3600. +# +# [*database_retry_interval*] +# (optional) Interval between retries of opening a database connection. +# Defaults to 10. +# +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to 1. +# +# [*database_max_pool_size*] +# (optional) Maximum number of SQL connections to keep open in a pool. +# Defaults to 10. +# +# [*database_max_overflow*] +# (optional) If set, use this value for max_overflow with sqlalchemy. +# Defaults to 20. +# +class sahara::db ( + $database_connection = 'mysql://sahara:secrete@localhost:3306/sahara', + $database_idle_timeout = 3600, + $database_min_pool_size = 1, + $database_max_pool_size = 10, + $database_max_retries = 10, + $database_retry_interval = 10, + $database_max_overflow = 20, +) { + + # NOTE(degorenko): In order to keep backward compatibility we rely on the pick function + # to use sahara:: if sahara::db:: isn't specified. + $database_connection_real = pick($::sahara::database_connection, $database_connection) + $database_idle_timeout_real = pick($::sahara::database_idle_timeout, $database_idle_timeout) + $database_min_pool_size_real = pick($::sahara::database_min_pool_size, $database_min_pool_size) + $database_max_pool_size_real = pick($::sahara::database_max_pool_size, $database_max_pool_size) + $database_max_retries_real = pick($::sahara::database_max_retries, $database_max_retries) + $database_retry_interval_real = pick($::sahara::database_retry_interval, $database_retry_interval) + $database_max_overflow_real = pick($::sahara::database_max_overflow, $database_max_overflow) + + validate_re($database_connection_real, '(mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') + + case $database_connection_real { + /^mysql:\/\//: { + $backend_package = false + require mysql::bindings + require mysql::bindings::python + } + /^postgresql:\/\//: { + $backend_package = $::sahara::params::psycopg_package_name + require postgresql::lib::python + } + default: { + fail('Unsupported db backend configured') + } + } + + if $backend_package and !defined(Package[$backend_package]) { + package {'sahara-backend-package': + ensure => present, + name => $backend_package, + tag => 'openstack', + } + } + + sahara_config { + 'database/connection': value => $database_connection_real, secret => true; + 'database/idle_timeout': value => $database_idle_timeout_real; + 'database/min_pool_size': value => $database_min_pool_size_real; + 'database/max_retries': value => $database_max_retries_real; + 'database/retry_interval': value => $database_retry_interval_real; + 'database/max_pool_size': value => $database_max_pool_size_real; + 'database/max_overflow': value => $database_max_overflow_real; + } + +} diff --git a/sahara/manifests/init.pp b/sahara/manifests/init.pp index 1910afba0..c8eb4c5d6 100644 --- a/sahara/manifests/init.pp +++ b/sahara/manifests/init.pp @@ -41,6 +41,11 @@ # (Optional) Port for sahara to listen on # Defaults to 8386. # +# [*plugins*] +# (Optional) List of plugins to be loaded. +# Sahara preserves the order of the list when returning it. +# Defaults to undef +# # [*use_neutron*] # (Optional) Whether to use neutron # Defaults to 'false'. @@ -65,9 +70,36 @@ # (optional) CA certificate file to use to verify connecting clients # Defaults to undef # +# == database configuration options +# # [*database_connection*] # (Optional) Non-sqllite database for sahara -# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara' +# Defaults to undef. +# +# [*database_max_retries*] +# (Optional) Maximum number of database connection retries during startup. +# Set to -1 to specify an infinite retry count. +# Defaults to undef. +# +# [*database_idle_timeout*] +# (Optional) Timeout before idle SQL connections are reaped. +# Defaults to undef. +# +# [*database_retry_interval*] +# (optional) Interval between retries of opening a database connection. +# Defaults to undef. +# +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to undef. +# +# [*database_max_pool_size*] +# (optional) Maximum number of SQL connections to keep open in a pool. +# Defaults to undef. +# +# [*database_max_overflow*] +# (optional) If set, use this value for max_overflow with sqlalchemy. +# Defaults to undef. # # [*sync_db*] # (Optional) Enable dbsync @@ -299,65 +331,73 @@ # Defaults to undef. # class sahara( - $package_ensure = 'present', - $verbose = false, - $debug = false, - $use_syslog = false, - $use_stderr = true, - $log_facility = 'LOG_USER', - $log_dir = '/var/log/sahara', - $host = '0.0.0.0', - $port = '8386', - $use_neutron = false, - $use_floating_ips = true, - $use_ssl = false, - $ca_file = undef, - $cert_file = undef, - $key_file = undef, - $database_connection = 'mysql://sahara:secrete@localhost:3306/sahara', - $sync_db = true, - $admin_user = 'admin', - $admin_password = false, - $admin_tenant_name = 'admin', - $auth_uri = 'http://127.0.0.1:5000/v2.0/', - $identity_uri = 'http://127.0.0.1:35357/', - $rpc_backend = undef, - $amqp_durable_queues = false, - $rabbit_ha_queues = false, - $rabbit_host = 'localhost', - $rabbit_hosts = false, - $rabbit_port = 5672, - $rabbit_use_ssl = false, - $rabbit_userid = 'guest', - $rabbit_password = 'guest', - $rabbit_login_method = 'AMQPLAIN', - $rabbit_virtual_host = '/', - $rabbit_retry_interval = 1, - $rabbit_retry_backoff = 2, - $rabbit_max_retries = 0, - $qpid_hostname = 'localhost', - $qpid_port = 5672, - $qpid_hosts = false, - $qpid_username = 'guest', - $qpid_password = 'guest', - $qpid_sasl_mechanisms = '', - $qpid_heartbeat = 60, - $qpid_protocol = 'tcp', - $qpid_tcp_nodelay = true, - $qpid_receiver_capacity = 1, - $qpid_topology_version = 2, - $zeromq_bind_address = '*', - $zeromq_port = 9501, - $zeromq_contexts = 1, - $zeromq_topic_backlog = 'None', - $zeromq_ipc_dir = '/var/run/openstack', - $zeromq_host = 'sahara', - $cast_timeout = 30, - $kombu_ssl_version = 'TLSv1', - $kombu_ssl_keyfile = undef, - $kombu_ssl_certfile = undef, - $kombu_ssl_ca_certs = undef, - $kombu_reconnect_delay = '1.0', + $package_ensure = 'present', + $verbose = false, + $debug = false, + $use_syslog = false, + $use_stderr = true, + $log_facility = 'LOG_USER', + $log_dir = '/var/log/sahara', + $host = '0.0.0.0', + $port = '8386', + $plugins = undef, + $use_neutron = false, + $use_floating_ips = true, + $use_ssl = false, + $ca_file = undef, + $cert_file = undef, + $key_file = undef, + $database_connection = undef, + $database_max_retries = undef, + $database_idle_timeout = undef, + $database_min_pool_size = undef, + $database_max_pool_size = undef, + $database_max_retries = undef, + $database_retry_interval = undef, + $database_max_overflow = undef, + $sync_db = true, + $admin_user = 'admin', + $admin_password = false, + $admin_tenant_name = 'admin', + $auth_uri = 'http://127.0.0.1:5000/v2.0/', + $identity_uri = 'http://127.0.0.1:35357/', + $rpc_backend = undef, + $amqp_durable_queues = false, + $rabbit_ha_queues = false, + $rabbit_host = 'localhost', + $rabbit_hosts = false, + $rabbit_port = 5672, + $rabbit_use_ssl = false, + $rabbit_userid = 'guest', + $rabbit_password = 'guest', + $rabbit_login_method = 'AMQPLAIN', + $rabbit_virtual_host = '/', + $rabbit_retry_interval = 1, + $rabbit_retry_backoff = 2, + $rabbit_max_retries = 0, + $qpid_hostname = 'localhost', + $qpid_port = 5672, + $qpid_hosts = false, + $qpid_username = 'guest', + $qpid_password = 'guest', + $qpid_sasl_mechanisms = '', + $qpid_heartbeat = 60, + $qpid_protocol = 'tcp', + $qpid_tcp_nodelay = true, + $qpid_receiver_capacity = 1, + $qpid_topology_version = 2, + $zeromq_bind_address = '*', + $zeromq_port = 9501, + $zeromq_contexts = 1, + $zeromq_topic_backlog = 'None', + $zeromq_ipc_dir = '/var/run/openstack', + $zeromq_host = 'sahara', + $cast_timeout = 30, + $kombu_ssl_version = 'TLSv1', + $kombu_ssl_keyfile = undef, + $kombu_ssl_certfile = undef, + $kombu_ssl_ca_certs = undef, + $kombu_reconnect_delay = '1.0', # DEPRECATED PARAMETERS $manage_service = undef, $enabled = undef, @@ -370,6 +410,7 @@ $identity_url = undef, ) { include ::sahara::params + include ::sahara::db include ::sahara::policy if $service_host { @@ -421,47 +462,23 @@ $identity_uri_real = $identity_uri } - if $::osfamily == 'RedHat' { - $group_require = Package['sahara-common'] - $dir_require = Package['sahara-common'] - $conf_require = Package['sahara-common'] - } else { - # TO-DO(mmagr): This hack has to be removed as soon as following bug - # is fixed. On Ubuntu sahara-trove is not installable because it needs - # running database and prefilled sahara.conf in order to install package: - # https://bugs.launchpad.net/ubuntu/+source/sahara/+bug/1452698 - Sahara_config<| |> -> Package['sahara-common'] - - $group_require = undef - $dir_require = Group['sahara'] - $conf_require = File['/etc/sahara'] - } group { 'sahara': - ensure => 'present', - name => 'sahara', - system => true, - require => $group_require - } - - user { 'sahara': - ensure => 'present', - gid => 'sahara', - system => true, - require => Group['sahara'] + ensure => 'present', + name => 'sahara', } file { '/etc/sahara/': ensure => directory, owner => 'root', group => 'sahara', - require => $dir_require, + require => Group['sahara'], selinux_ignore_defaults => true } file { '/etc/sahara/sahara.conf': owner => 'root', group => 'sahara', - require => $conf_require, + require => File['/etc/sahara'], selinux_ignore_defaults => true } @@ -479,20 +496,20 @@ # https://bugs.launchpad.net/cloud-archive/+bug/1450945 File['/etc/sahara/sahara.conf'] -> Sahara_config<| |> - Package['sahara-common'] -> Class['sahara::policy'] + # degorenko: temporarily hack to avoid the problem with group mode for /etc/sahara + # folder, because of incorrect mode in RPM package. Will be deleted as soon as + # possible. + Package['sahara-common'] -> Group['sahara'] - validate_re($database_connection, '(mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') + Package['sahara-common'] -> Class['sahara::policy'] - case $database_connection { - /^mysql:\/\//: { - require mysql::bindings - require mysql::bindings::python - } - /^postgresql:\/\//: { - require postgresql::lib::python + if $plugins { + sahara_config { + 'DEFAULT/plugins': value => join(any2array($plugins),','); } - default: { - fail('Unsupported db backend configured') + } else { + sahara_config { + 'DEFAULT/plugins': ensure => absent; } } @@ -504,9 +521,6 @@ 'DEFAULT/debug': value => $debug; 'DEFAULT/verbose': value => $verbose; 'DEFAULT/use_stderr': value => $use_stderr; - 'database/connection': - value => $database_connection, - secret => true; } if $admin_password_real { diff --git a/sahara/manifests/params.pp b/sahara/manifests/params.pp index a7a20ae14..8a800c9c5 100644 --- a/sahara/manifests/params.pp +++ b/sahara/manifests/params.pp @@ -8,22 +8,24 @@ case $::osfamily { 'RedHat': { - $common_package_name = 'openstack-sahara-common' - $all_package_name = 'openstack-sahara' - $api_package_name = 'openstack-sahara-api' - $engine_package_name = 'openstack-sahara-engine' - $all_service_name = 'openstack-sahara-all' - $api_service_name = 'openstack-sahara-api' - $engine_service_name = 'openstack-sahara-engine' + $common_package_name = 'openstack-sahara-common' + $all_package_name = 'openstack-sahara' + $api_package_name = 'openstack-sahara-api' + $engine_package_name = 'openstack-sahara-engine' + $all_service_name = 'openstack-sahara-all' + $api_service_name = 'openstack-sahara-api' + $engine_service_name = 'openstack-sahara-engine' + $psycopg_package_name = 'python-psycopg2' } 'Debian': { - $common_package_name = 'sahara-common' - $all_package_name = 'sahara' - $api_package_name = 'sahara-api' - $engine_package_name = 'sahara-engine' - $all_service_name = 'sahara' - $api_service_name = 'sahara-api' - $engine_service_name = 'sahara-engine' + $common_package_name = 'sahara-common' + $all_package_name = 'sahara' + $api_package_name = 'sahara-api' + $engine_package_name = 'sahara-engine' + $all_service_name = 'sahara' + $api_service_name = 'sahara-api' + $engine_service_name = 'sahara-engine' + $psycopg_package_name = 'python-psycopg2' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}") diff --git a/sahara/spec/acceptance/basic_sahara_spec.rb b/sahara/spec/acceptance/basic_sahara_spec.rb index 405e031a5..23fcc385e 100644 --- a/sahara/spec/acceptance/basic_sahara_spec.rb +++ b/sahara/spec/acceptance/basic_sahara_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/sahara/spec/classes/sahara_db_spec.rb b/sahara/spec/classes/sahara_db_spec.rb new file mode 100644 index 000000000..2cc76c1ce --- /dev/null +++ b/sahara/spec/classes/sahara_db_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +describe 'sahara::db' do + + shared_examples 'sahara::db' do + context 'with default parameters' do + it { is_expected.to contain_sahara_config('database/connection').with_value('mysql://sahara:secrete@localhost:3306/sahara').with_secret(true) } + it { is_expected.to contain_sahara_config('database/idle_timeout').with_value('3600') } + it { is_expected.to contain_sahara_config('database/min_pool_size').with_value('1') } + it { is_expected.to contain_sahara_config('database/max_retries').with_value('10') } + it { is_expected.to contain_sahara_config('database/retry_interval').with_value('10') } + it { is_expected.to contain_sahara_config('database/max_pool_size').with_value('10') } + it { is_expected.to contain_sahara_config('database/max_overflow').with_value('20') } + end + + context 'with specific parameters' do + let :params do + { :database_connection => 'mysql://sahara:sahara@localhost/sahara', + :database_idle_timeout => '3601', + :database_min_pool_size => '2', + :database_max_retries => '11', + :database_retry_interval => '11', + :database_max_pool_size => '11', + :database_max_overflow => '21', + } + end + + it { is_expected.to contain_sahara_config('database/connection').with_value('mysql://sahara:sahara@localhost/sahara').with_secret(true) } + it { is_expected.to contain_sahara_config('database/idle_timeout').with_value('3601') } + it { is_expected.to contain_sahara_config('database/min_pool_size').with_value('2') } + it { is_expected.to contain_sahara_config('database/max_retries').with_value('11') } + it { is_expected.to contain_sahara_config('database/retry_interval').with_value('11') } + it { is_expected.to contain_sahara_config('database/max_pool_size').with_value('11') } + it { is_expected.to contain_sahara_config('database/max_overflow').with_value('21') } + end + + context 'with incorrect database_connection string' do + let :params do + { :database_connection => 'sqlite://sahara:sahara@localhost/sahara', } + end + + it_raises 'a Puppet::Error', /validate_re/ + end + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'sahara::db' + end + + context 'on Redhat platforms' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'sahara::db' + end + +end diff --git a/sahara/spec/classes/sahara_init_spec.rb b/sahara/spec/classes/sahara_init_spec.rb index e2b3176df..bff804793 100644 --- a/sahara/spec/classes/sahara_init_spec.rb +++ b/sahara/spec/classes/sahara_init_spec.rb @@ -13,6 +13,7 @@ shared_examples_for 'sahara' do it { is_expected.to contain_class('sahara::params') } + it { is_expected.to contain_class('sahara::db') } it { is_expected.to contain_class('sahara::policy') } it { is_expected.to contain_class('mysql::bindings::python') } it { is_expected.to contain_exec('sahara-dbmanage') } @@ -29,18 +30,20 @@ it { is_expected.to contain_sahara_config('keystone_authtoken/admin_user').with_value('admin') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_tenant_name').with_value('admin') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_password').with_value('secrete').with_secret(true) } + it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_ensure('absent') } end context 'with passing params' do let :params do { - :use_neutron => 'true', - :host => 'localhost', - :port => '8387', - :auth_uri => 'http://8.8.8.8:5000/v2.0/', - :identity_uri => 'http://8.8.8.8:35357/', - :admin_user => 'sahara', - :admin_tenant_name => 'sahara-tenant', - :admin_password => 'new_password', + :use_neutron => 'true', + :host => 'localhost', + :port => '8387', + :auth_uri => 'http://8.8.8.8:5000/v2.0/', + :identity_uri => 'http://8.8.8.8:35357/', + :admin_user => 'sahara', + :admin_tenant_name => 'sahara-tenant', + :admin_password => 'new_password', + :plugins => ['plugin1', 'plugin2'], } end @@ -52,6 +55,7 @@ it { is_expected.to contain_sahara_config('keystone_authtoken/admin_user').with_value('sahara') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_tenant_name').with_value('sahara-tenant') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_password').with_value('new_password').with_secret(true) } + it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('plugin1,plugin2') } end context 'with deprecated params' do diff --git a/stdlib/README.markdown b/stdlib/README.markdown index f95d37d8d..1cf7b326c 100644 --- a/stdlib/README.markdown +++ b/stdlib/README.markdown @@ -403,6 +403,29 @@ Converts an array into a hash. For example, `hash(['a',1,'b',2,'c',3])` returns Returns an array an intersection of two. For example, `intersection(["a","b","c"],["b","c","d"])` returns ["b","c"]. *Type*: rvalue. +#### `is_a` + +Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks. + + ~~~ + foo = 3 + $bar = [1,2,3] + $baz = 'A string!' + + if $foo.is_a(Integer) { + notify { 'foo!': } + } + if $bar.is_a(Array) { + notify { 'bar!': } + } + if $baz.is_a(String) { + notify { 'baz!': } + } + ~~~ + +See the documentation for "The Puppet Type System" for more information about types. +See the `assert_type()` function for flexible ways to assert the type of a value. + #### `is_array` Returns 'true' if the variable passed to this function is an array. *Type*: rvalue. @@ -521,10 +544,12 @@ Converts a number or a string representation of a number into a true boolean. Ze #### `parsejson` Converts a string of JSON into the correct Puppet structure. *Type*: rvalue. +The optional second argument will be returned if the data was not correct. #### `parseyaml` Converts a string of YAML into the correct Puppet structure. *Type*: rvalue. +The optional second argument will be returned if the data was not correct. #### `pick` @@ -1029,6 +1054,13 @@ test, and the second argument should be a stringified regular expression (withou validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') ~~~ + Note: Compilation will also abort, if the first argument is not a String. Always use + quotes to force stringification: + + ~~~ + validate_re("${::operatingsystemmajrelease}", '^[57]$') + ~~~ + *Type*: statement. #### `validate_slength` diff --git a/stdlib/lib/puppet/functions/is_a.rb b/stdlib/lib/puppet/functions/is_a.rb new file mode 100644 index 000000000..da98b0352 --- /dev/null +++ b/stdlib/lib/puppet/functions/is_a.rb @@ -0,0 +1,32 @@ +# Boolean check to determine whether a variable is of a given data type. This is equivalent to the `=~` type checks. +# +# @example how to check a data type +# # check a data type +# foo = 3 +# $bar = [1,2,3] +# $baz = 'A string!' +# +# if $foo.is_a(Integer) { +# notify { 'foo!': } +# } +# if $bar.is_a(Array) { +# notify { 'bar!': } +# } +# if $baz.is_a(String) { +# notify { 'baz!': } +# } +# +# See the documentation for "The Puppet Type System" for more information about types. +# See the `assert_type()` function for flexible ways to assert the type of a value. +# +Puppet::Functions.create_function(:is_a) do + dispatch :is_a do + param 'Any', :value + param 'Type', :type + end + + def is_a(value, type) + # See puppet's lib/puppet/pops/evaluator/evaluator_impl.rb eval_MatchExpression + Puppet::Pops::Types::TypeCalculator.instance?(type, value) + end +end diff --git a/stdlib/lib/puppet/parser/functions/intersection.rb b/stdlib/lib/puppet/parser/functions/intersection.rb index 48f02e9d3..bfbb4babb 100644 --- a/stdlib/lib/puppet/parser/functions/intersection.rb +++ b/stdlib/lib/puppet/parser/functions/intersection.rb @@ -4,13 +4,13 @@ module Puppet::Parser::Functions newfunction(:intersection, :type => :rvalue, :doc => <<-EOS -This function returns an array an intersection of two. +This function returns an array of the intersection of two. *Examples:* - intersection(["a","b","c"],["b","c","d"]) + intersection(["a","b","c"],["b","c","d"]) # returns ["b","c"] + intersection(["a","b","c"],[1,2,3,4]) # returns [] (true, when evaluated as a Boolean) -Would return: ["b","c"] EOS ) do |arguments| diff --git a/stdlib/lib/puppet/parser/functions/parsejson.rb b/stdlib/lib/puppet/parser/functions/parsejson.rb index a9a16a452..f822fc473 100644 --- a/stdlib/lib/puppet/parser/functions/parsejson.rb +++ b/stdlib/lib/puppet/parser/functions/parsejson.rb @@ -3,21 +3,22 @@ # module Puppet::Parser::Functions - newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS -This function accepts JSON as a string and converts into the correct Puppet -structure. - EOS + newfunction(:parsejson, :type => :rvalue, :arity => -2, :doc => <<-EOS +This function accepts JSON as a string and converts it into the correct +Puppet structure. + +The optional second argument can be used to pass a default value that will +be returned if the parsing of YAML string have failed. + EOS ) do |arguments| + raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless arguments.length >= 1 - if (arguments.size != 1) then - raise(Puppet::ParseError, "parsejson(): Wrong number of arguments "+ - "given #{arguments.size} for 1") + begin + PSON::load(arguments[0]) || arguments[1] + rescue Exception + arguments[1] end - json = arguments[0] - - # PSON is natively available in puppet - PSON.load(json) end end diff --git a/stdlib/lib/puppet/parser/functions/parseyaml.rb b/stdlib/lib/puppet/parser/functions/parseyaml.rb index 53d54faff..d38b3ef84 100644 --- a/stdlib/lib/puppet/parser/functions/parseyaml.rb +++ b/stdlib/lib/puppet/parser/functions/parseyaml.rb @@ -3,20 +3,22 @@ # module Puppet::Parser::Functions - newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS + newfunction(:parseyaml, :type => :rvalue, :arity => -2, :doc => <<-EOS This function accepts YAML as a string and converts it into the correct Puppet structure. - EOS - ) do |arguments| - - if (arguments.size != 1) then - raise(Puppet::ParseError, "parseyaml(): Wrong number of arguments "+ - "given #{arguments.size} for 1") - end +The optional second argument can be used to pass a default value that will +be returned if the parsing of YAML string have failed. + EOS + ) do |arguments| + raise ArgumentError, 'Wrong number of arguments. 1 or 2 arguments should be provided.' unless arguments.length >= 1 require 'yaml' - YAML::load(arguments[0]) + begin + YAML::load(arguments[0]) || arguments[1] + rescue Exception + arguments[1] + end end end diff --git a/stdlib/lib/puppet/parser/functions/validate_re.rb b/stdlib/lib/puppet/parser/functions/validate_re.rb index ca25a702c..efee7f8cb 100644 --- a/stdlib/lib/puppet/parser/functions/validate_re.rb +++ b/stdlib/lib/puppet/parser/functions/validate_re.rb @@ -23,16 +23,23 @@ module Puppet::Parser::Functions validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7') + Note: Compilation will also abort, if the first argument is not a String. Always use + quotes to force stringification: + + validate_re("${::operatingsystemmajrelease}", '^[57]$') + ENDHEREDOC if (args.length < 2) or (args.length > 3) then - raise Puppet::ParseError, ("validate_re(): wrong number of arguments (#{args.length}; must be 2 or 3)") + raise Puppet::ParseError, "validate_re(): wrong number of arguments (#{args.length}; must be 2 or 3)" end + raise Puppet::ParseError, "validate_re(): input needs to be a String, not a #{args[0].class}" unless args[0].is_a? String + msg = args[2] || "validate_re(): #{args[0].inspect} does not match #{args[1].inspect}" # We're using a flattened array here because we can't call String#any? in # Ruby 1.9 like we can in Ruby 1.8 - raise Puppet::ParseError, (msg) unless [args[1]].flatten.any? do |re_str| + raise Puppet::ParseError, msg unless [args[1]].flatten.any? do |re_str| args[0] =~ Regexp.compile(re_str) end diff --git a/stdlib/spec/acceptance/is_a_spec.rb b/stdlib/spec/acceptance/is_a_spec.rb new file mode 100644 index 000000000..533673cfe --- /dev/null +++ b/stdlib/spec/acceptance/is_a_spec.rb @@ -0,0 +1,28 @@ +#! /usr/bin/env ruby -S rspec +require 'spec_helper_acceptance' + +describe 'is_a function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do + it 'should match a string' do + pp = <<-EOS + if 'hello world'.is_a(String) { + notify { 'output correct': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: output correct/) + end + end + + it 'should not match a integer as string' do + pp = <<-EOS + if 5.is_a(String) { + notify { 'output wrong': } + } + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).not_to match(/Notice: output wrong/) + end + end +end diff --git a/stdlib/spec/acceptance/parsejson_spec.rb b/stdlib/spec/acceptance/parsejson_spec.rb index 509781027..d0feabd37 100755 --- a/stdlib/spec/acceptance/parsejson_spec.rb +++ b/stdlib/spec/acceptance/parsejson_spec.rb @@ -16,19 +16,28 @@ end end end + describe 'failure' do it 'raises error on incorrect json' do pp = <<-EOS $a = '{"hunter": "washere", "tests": "passing",}' - $ao = parsejson($a) + $ao = parsejson($a, {'tests' => 'using the default value'}) notice(inline_template('a is <%= @ao.inspect %>')) EOS - apply_manifest(pp, :expect_failures => true) do |r| - expect(r.stderr).to match(/expected next name/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/tests are "using the default value"/) end end - it 'raises error on incorrect number of arguments' + it 'raises error on incorrect number of arguments' do + pp = <<-EOS + $o = parsejson() + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/wrong number of arguments/i) + end + end end end diff --git a/stdlib/spec/acceptance/parseyaml_spec.rb b/stdlib/spec/acceptance/parseyaml_spec.rb index 5819837cf..7946de09d 100755 --- a/stdlib/spec/acceptance/parseyaml_spec.rb +++ b/stdlib/spec/acceptance/parseyaml_spec.rb @@ -16,20 +16,29 @@ end end end + describe 'failure' do - it 'raises error on incorrect yaml' do + it 'returns the default value on incorrect yaml' do pp = <<-EOS $a = "---\nhunter: washere\ntests: passing\n:" - $o = parseyaml($a) + $o = parseyaml($a, {'tests' => 'using the default value'}) $tests = $o['tests'] notice(inline_template('tests are <%= @tests.inspect %>')) EOS - apply_manifest(pp, :expect_failures => true) do |r| - expect(r.stderr).to match(/(syntax error|did not find expected key)/) + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/tests are "using the default value"/) end end - it 'raises error on incorrect number of arguments' + it 'raises error on incorrect number of arguments' do + pp = <<-EOS + $o = parseyaml() + EOS + + apply_manifest(pp, :expect_failures => true) do |r| + expect(r.stderr).to match(/wrong number of arguments/i) + end + end end end diff --git a/stdlib/spec/functions/is_a_spec.rb b/stdlib/spec/functions/is_a_spec.rb new file mode 100644 index 000000000..8dec13f5a --- /dev/null +++ b/stdlib/spec/functions/is_a_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +if ENV["FUTURE_PARSER"] == 'yes' + describe 'type_of' do + pending 'teach rspec-puppet to load future-only functions under 3.7.5' do + it { is_expected.not_to eq(nil) } + end + end +end + +if Puppet.version.to_f >= 4.0 + describe 'is_a' do + it { is_expected.not_to eq(nil) } + it { is_expected.to run.with_params().and_raise_error(ArgumentError) } + it { is_expected.to run.with_params('', '').and_raise_error(ArgumentError) } + + it 'succeeds when comparing a string and a string' do + is_expected.to run.with_params('hello world', String).and_return(true) + end + + it 'fails when comparing an integer and a string' do + is_expected.to run.with_params(5, String).and_return(false) + end + end +end diff --git a/stdlib/spec/functions/parsejson_spec.rb b/stdlib/spec/functions/parsejson_spec.rb index 436566e79..5bea8af7f 100755 --- a/stdlib/spec/functions/parsejson_spec.rb +++ b/stdlib/spec/functions/parsejson_spec.rb @@ -1,9 +1,64 @@ require 'spec_helper' describe 'parsejson' do - it { is_expected.not_to eq(nil) } - it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } - it { is_expected.to run.with_params('', '').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } - it { is_expected.to run.with_params('["one"').and_raise_error(PSON::ParserError) } - it { is_expected.to run.with_params('["one", "two", "three"]').and_return(['one', 'two', 'three']) } + it 'should exist' do + is_expected.not_to eq(nil) + end + + it 'should raise an error if called without any arguments' do + is_expected.to run.with_params(). + and_raise_error(/wrong number of arguments/i) + end + + context 'with correct JSON data' do + + it 'should be able to parse a JSON data with a Hash' do + is_expected.to run.with_params('{"a":"1","b":"2"}'). + and_return({'a'=>'1', 'b'=>'2'}) + end + + it 'should be able to parse a JSON data with an Array' do + is_expected.to run.with_params('["a","b","c"]'). + and_return(['a', 'b', 'c']) + end + + it 'should be able to parse empty JSON values' do + is_expected.to run.with_params('[]'). + and_return([]) + is_expected.to run.with_params('{}'). + and_return({}) + end + + it 'should be able to parse a JSON data with a mixed structure' do + is_expected.to run.with_params('{"a":"1","b":2,"c":{"d":[true,false]}}'). + and_return({'a' =>'1', 'b' => 2, 'c' => { 'd' => [true, false] } }) + end + + it 'should not return the default value if the data was parsed correctly' do + is_expected.to run.with_params('{"a":"1"}', 'default_value'). + and_return({'a' => '1'}) + end + + end + + context 'with incorrect YAML data' do + it 'should return "nil" if a default value should be returned but is not provided' do + is_expected.to run.with_params(''). + and_return(nil) + end + + it 'should support a structure for a default value' do + is_expected.to run.with_params('', {'a' => '1'}). + and_return({'a' => '1'}) + end + + ['', 1, 1.2, nil, true, false, [], {}, :yaml].each do |value| + it "should return the default value for an incorrect #{value.inspect} (#{value.class}) parameter" do + is_expected.to run.with_params(value, 'default_value'). + and_return('default_value') + end + end + + end + end diff --git a/stdlib/spec/functions/parseyaml_spec.rb b/stdlib/spec/functions/parseyaml_spec.rb index fb635f8ee..492a1c921 100755 --- a/stdlib/spec/functions/parseyaml_spec.rb +++ b/stdlib/spec/functions/parseyaml_spec.rb @@ -1,14 +1,72 @@ require 'spec_helper' describe 'parseyaml' do - it { is_expected.not_to eq(nil) } - it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } - it { is_expected.to run.with_params('', '').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) } - it { is_expected.to run.with_params('["one", "two", "three"]').and_return(['one', 'two', 'three']) } - context 'when running on modern rubies', :unless => RUBY_VERSION == '1.8.7' do - it { is_expected.to run.with_params('["one"').and_raise_error(Psych::SyntaxError) } + it 'should exist' do + is_expected.not_to eq(nil) end - context 'when running on ruby 1.8.7, which does not have Psych', :if => RUBY_VERSION == '1.8.7' do - it { is_expected.to run.with_params('["one"').and_raise_error(ArgumentError) } + + it 'should raise an error if called without any arguments' do + is_expected.to run.with_params(). + and_raise_error(/wrong number of arguments/i) + end + + context 'with correct YAML data' do + it 'should be able to parse a YAML data with a String' do + is_expected.to run.with_params('--- just a string'). + and_return('just a string') + is_expected.to run.with_params('just a string'). + and_return('just a string') + end + + it 'should be able to parse a YAML data with a Hash' do + is_expected.to run.with_params("---\na: '1'\nb: '2'\n"). + and_return({'a' => '1', 'b' => '2'}) + end + + it 'should be able to parse a YAML data with an Array' do + is_expected.to run.with_params("---\n- a\n- b\n- c\n"). + and_return(['a', 'b', 'c']) + end + + it 'should be able to parse a YAML data with a mixed structure' do + is_expected.to run.with_params("---\na: '1'\nb: 2\nc:\n d:\n - :a\n - true\n - false\n"). + and_return({'a' => '1', 'b' => 2, 'c' => {'d' => [:a, true, false]}}) + end + + it 'should not return the default value if the data was parsed correctly' do + is_expected.to run.with_params("---\na: '1'\n", 'default_value'). + and_return({'a' => '1'}) + end + end + + context 'with incorrect YAML data' do + it 'should return "nil" if a default value should be returned but is not provided' do + is_expected.to run.with_params(''). + and_return(nil) + end + + it 'should support a structure for a default value' do + is_expected.to run.with_params('', {'a' => '1'}). + and_return({'a' => '1'}) + end + + [1, 1.2, nil, true, false, [], {}, :yaml].each do |value| + it "should return the default value for an incorrect #{value.inspect} (#{value.class}) parameter" do + is_expected.to run.with_params(value, 'default_value'). + and_return('default_value') + end + end + + context 'when running on modern rubies', :unless => RUBY_VERSION == '1.8.7' do + ['---', '...', '*8', ''].each do |value| + it "should return the default value for an incorrect #{value.inspect} string parameter" do + is_expected.to run.with_params(value, 'default_value'). + and_return('default_value') + end + end + end + + end + end diff --git a/stdlib/spec/functions/type_of_spec.rb b/stdlib/spec/functions/type_of_spec.rb index f77099031..cc9ef781c 100644 --- a/stdlib/spec/functions/type_of_spec.rb +++ b/stdlib/spec/functions/type_of_spec.rb @@ -2,7 +2,9 @@ if ENV["FUTURE_PARSER"] == 'yes' describe 'type_of' do - pending 'teach rspec-puppet to load future-only functions under 3.7.5' + pending 'teach rspec-puppet to load future-only functions under 3.7.5' do + it { is_expected.not_to eq(nil) } + end end end diff --git a/stdlib/spec/functions/validate_re_spec.rb b/stdlib/spec/functions/validate_re_spec.rb index 42b104917..3f9014370 100755 --- a/stdlib/spec/functions/validate_re_spec.rb +++ b/stdlib/spec/functions/validate_re_spec.rb @@ -41,6 +41,21 @@ it { is_expected.to run.with_params('notone', '^one').and_raise_error(Puppet::ParseError, /does not match/) } it { is_expected.to run.with_params('notone', [ '^one', '^two' ]).and_raise_error(Puppet::ParseError, /does not match/) } it { is_expected.to run.with_params('notone', [ '^one', '^two' ], 'custom error').and_raise_error(Puppet::ParseError, /custom error/) } + + describe 'non-string inputs' do + [ + 1, # Fixnum + 3.14, # Float + nil, # NilClass + true, # TrueClass + false, # FalseClass + ["10"], # Array + :key, # Symbol + {:key=>"val"}, # Hash + ].each do |input| + it { is_expected.to run.with_params(input, '.*').and_raise_error(Puppet::ParseError, /needs to be a String/) } + end + end end end end diff --git a/swift/manifests/proxy.pp b/swift/manifests/proxy.pp index 93f809d73..b050e5f5f 100644 --- a/swift/manifests/proxy.pp +++ b/swift/manifests/proxy.pp @@ -200,6 +200,8 @@ before => Class[$required_classes], } + Concat['/etc/swift/proxy-server.conf'] -> Swift_proxy_config <||> + if $manage_service { if $enabled { $service_ensure = 'running' diff --git a/swift/manifests/storage/server.pp b/swift/manifests/storage/server.pp index 5b3a0b716..5f271aba9 100644 --- a/swift/manifests/storage/server.pp +++ b/swift/manifests/storage/server.pp @@ -204,4 +204,12 @@ before => $required_middlewares, require => Package['swift'], } + + case $type { + 'object': { Concat["/etc/swift/${config_file_path}"] -> Swift_object_config <||> } + 'container': { Concat["/etc/swift/${config_file_path}"] -> Swift_container_config <||> } + 'account': { Concat["/etc/swift/${config_file_path}"] -> Swift_account_config <||> } + default : { warning("swift storage server ${type} must specify ${type}-server") } + + } } diff --git a/swift/spec/acceptance/basic_swift_spec.rb b/swift/spec/acceptance/basic_swift_spec.rb index 5a9e63158..6110c6a58 100644 --- a/swift/spec/acceptance/basic_swift_spec.rb +++ b/swift/spec/acceptance/basic_swift_spec.rb @@ -22,15 +22,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/swift/spec/acceptance/swift_config_spec.rb b/swift/spec/acceptance/swift_config_spec.rb index dd672a3d5..41342bbf3 100644 --- a/swift/spec/acceptance/swift_config_spec.rb +++ b/swift/spec/acceptance/swift_config_spec.rb @@ -175,11 +175,14 @@ $swift_files.each do |swift_conf_file| describe file(swift_conf_file) do - it { should exist } - it { should contain('thisshouldexist=foo') } - it { should contain('thisshouldexist2=') } - - its(:content) { should_not match /thisshouldnotexist/ } + it { is_expected.to exist } + it { is_expected.to contain('thisshouldexist=foo') } + it { is_expected.to contain('thisshouldexist2=') } + + describe '#content' do + subject { super().content } + it { is_expected.to_not match /thisshouldnotexist/ } + end end end diff --git a/swift/spec/classes/swift_proxy_spec.rb b/swift/spec/classes/swift_proxy_spec.rb index 938657add..a45471db5 100644 --- a/swift/spec/classes/swift_proxy_spec.rb +++ b/swift/spec/classes/swift_proxy_spec.rb @@ -79,6 +79,7 @@ class { swift: swift_hash_suffix => string }" ] ) end + it { is_expected.to contain_concat__fragment('swift_proxy').with_before( [ 'Class[Swift::Proxy::Healthcheck]', @@ -87,6 +88,17 @@ class { swift: swift_hash_suffix => string }" ] )} + describe "when using swift_proxy_config resource" do + let :pre_condition do + " + class { memcached: max_memory => 1} + class { swift: swift_hash_suffix => string } + swift_proxy_config { 'foo/bar': value => 'foo' } + " + end + it { is_expected.to contain_concat("/etc/swift/proxy-server.conf").that_comes_before("Swift_proxy_config[foo/bar]") } + end + describe 'when more parameters are set' do let :params do { diff --git a/swift/spec/defines/swift_storage_server_spec.rb b/swift/spec/defines/swift_storage_server_spec.rb index 0a1393e7a..60558b03d 100644 --- a/swift/spec/defines/swift_storage_server_spec.rb +++ b/swift/spec/defines/swift_storage_server_spec.rb @@ -131,6 +131,17 @@ class { 'swift::storage': storage_local_net_ip => '10.0.0.1' }" it { is_expected.to contain_file(fragment_file).with_content(/^log_udp_port\s*=\s*514\s*$/) } end end + + describe "when using swift_#{t}_config resource" do + let :pre_condition do + " + class { 'swift': swift_hash_suffix => 'foo' } + class { 'swift::storage': storage_local_net_ip => '10.0.0.1' } + swift_#{t}_config { 'foo/bar': value => 'foo' } + " + end + it { is_expected.to contain_concat("/etc/swift/#{t}-server/#{title}.conf").that_comes_before("Swift_#{t}_config[foo/bar]") } + end end describe 'with all allowed defaults' do diff --git a/tripleo/.gitignore b/tripleo/.gitignore index 9897b6f7e..4dd84f06e 100644 --- a/tripleo/.gitignore +++ b/tripleo/.gitignore @@ -1,5 +1,10 @@ -*.swp -spec/fixtures/modules/* -pkg +pkg/ Gemfile.lock -.vagrant/* +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml diff --git a/tripleo/.sync.yml b/tripleo/.sync.yml new file mode 100644 index 000000000..66a03c649 --- /dev/null +++ b/tripleo/.sync.yml @@ -0,0 +1,3 @@ +--- +spec/spec_helper.rb: + unmanaged: true diff --git a/tripleo/Gemfile b/tripleo/Gemfile index 10b37ac52..6d4ce9a07 100644 --- a/tripleo/Gemfile +++ b/tripleo/Gemfile @@ -1,26 +1,30 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.1.0', :require => false - - gem 'metadata-json-lint' - gem 'puppet-lint-param-docs' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-absolute_template_path' - gem 'puppet-lint-trailing_newline-check' - - # Puppet 4.x related lint checks - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-variable_contains_upcase' - gem 'puppet-lint-numericvariable' + gem 'puppetlabs_spec_helper', :require => 'false' + gem 'rspec-puppet', '~> 2.2.0', :require => 'false' + gem 'metadata-json-lint', :require => 'false' + gem 'puppet-lint-param-docs', :require => 'false' + gem 'puppet-lint-absolute_classname-check', :require => 'false' + gem 'puppet-lint-absolute_template_path', :require => 'false' + gem 'puppet-lint-trailing_newline-check', :require => 'false' + gem 'puppet-lint-unquoted_string-check', :require => 'false' + gem 'puppet-lint-leading_zero-check', :require => 'false' + gem 'puppet-lint-variable_contains_upcase', :require => 'false' + gem 'puppet-lint-numericvariable', :require => 'false' + gem 'json', :require => 'false' + gem 'webmock', :require => 'false' +end - gem 'json' - gem 'webmock' - gem 'r10k' - gem 'librarian-puppet-simple', '~> 0.0.3' +group :system_tests do + gem 'beaker-rspec', :require => 'false' + gem 'beaker-puppet_install_helper', :require => 'false' +end +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/tripleo/Rakefile b/tripleo/Rakefile index 56dc07de3..bc08f437c 100644 --- a/tripleo/Rakefile +++ b/tripleo/Rakefile @@ -1,7 +1,21 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_parameter_defaults') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetSyntax.exclude_paths ||= [] +PuppetSyntax.exclude_paths << "spec/fixtures/**/*" +PuppetSyntax.exclude_paths << "pkg/**/*" +PuppetSyntax.exclude_paths << "vendor/**/*" + +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] + config.fail_on_warnings = true + config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' + config.disable_checks = ["80chars", "class_inherits_from_params_class", "class_parameter_defaults", "only_variable_string"] +end + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end diff --git a/tripleo/lib/puppet/parser/functions/write_package_names.rb b/tripleo/lib/puppet/parser/functions/write_package_names.rb deleted file mode 100644 index 8f99674e0..000000000 --- a/tripleo/lib/puppet/parser/functions/write_package_names.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'fileutils' - -module Puppet::Parser::Functions - newfunction(:write_package_names, :doc => "Write package names which are managed via this puppet run to a file.") do |arg| - if arg[0].class == String - begin - output_file = arg[0] - packages = catalog.resources.collect { |r| r.title if r.type == 'Package' }.compact - FileUtils.mkdir_p(File.dirname(output_file)) - File.open(output_file, 'w') do |f| - packages.each do |pkg_name| - f.write(pkg_name + "\n") - end - end - rescue JSON::ParserError - raise Puppet::ParseError, "Syntax error: #{arg[0]} is invalid" - end - else - raise Puppet::ParseError, "Syntax error: #{arg[0]} is not a String" - end - end -end diff --git a/tripleo/lib/puppet/provider/package_manifest/flat_file.rb b/tripleo/lib/puppet/provider/package_manifest/flat_file.rb new file mode 100644 index 000000000..96e033be8 --- /dev/null +++ b/tripleo/lib/puppet/provider/package_manifest/flat_file.rb @@ -0,0 +1,39 @@ + +require 'set' + + +Puppet::Type.type(:package_manifest).provide(:flat_file) do + + desc "Write package manifest to a flat file" + + def exists? + # exists? is always run before create, so we can create package list here + @packages = resource.catalog.resources.collect { |r| + r.name if r.type == :package + }.compact.sort + + exists = File.exist?(resource[:path]) + if exists + new_content = Set.new @packages + old_content = Set.new( + File.open(resource[:path], 'r').each_line.collect{ |pkg| pkg.strip() } + ) + exists = new_content == old_content + end + exists + end + + def create + FileUtils.mkdir_p(File.dirname(resource[:path])) + File.open(resource[:path], 'w') do |f| + @packages.each do |pkg_name| + f.puts(pkg_name) + end + end + end + + def destroy + File.delete(resource[:path]) + end + +end diff --git a/tripleo/lib/puppet/type/package_manifest.rb b/tripleo/lib/puppet/type/package_manifest.rb new file mode 100644 index 000000000..9ee3270f1 --- /dev/null +++ b/tripleo/lib/puppet/type/package_manifest.rb @@ -0,0 +1,8 @@ +Puppet::Type.newtype(:package_manifest) do + + ensurable + newparam(:path, :namevar => true) do + newvalues(/\S+\/\S+/) + end + +end diff --git a/tripleo/manifests/loadbalancer.pp b/tripleo/manifests/loadbalancer.pp index 1a3c5f61f..2bfc83b71 100644 --- a/tripleo/manifests/loadbalancer.pp +++ b/tripleo/manifests/loadbalancer.pp @@ -35,6 +35,10 @@ # The value to use as maxconn in the haproxy default config section. # Defaults to 4096 # +# [*haproxy_log_address*] +# The IPv4, IPv6 or filesystem socket path of the syslog server. +# Defaults to '/dev/log' +# # [*controller_host*] # (Deprecated)Host or group of hosts to load-balance the services # Can be a string or an array. @@ -246,6 +250,7 @@ $haproxy_service_manage = true, $haproxy_global_maxconn = 20480, $haproxy_default_maxconn = 4096, + $haproxy_log_address = '/dev/log', $controller_host = undef, $controller_hosts = undef, $controller_hosts_names = undef, @@ -630,7 +635,7 @@ class { '::haproxy': service_manage => $haproxy_service_manage, global_options => { - 'log' => '/dev/log local0', + 'log' => "${haproxy_log_address} local0", 'pidfile' => '/var/run/haproxy.pid', 'user' => 'haproxy', 'group' => 'haproxy', @@ -807,6 +812,9 @@ if $nova_novncproxy { haproxy::listen { 'nova_novncproxy': bind => $nova_novnc_bind_opts, + options => { + 'balance' => 'source', + }, collect_exported => false, } haproxy::balancermember { 'nova_novncproxy': @@ -896,6 +904,7 @@ options => { 'cookie' => 'SERVERID insert indirect nocache', }, + mode => 'http', collect_exported => false, } haproxy::balancermember { 'horizon': diff --git a/tripleo/spec/acceptance/nodesets/centos-70-x64.yml b/tripleo/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 000000000..5f097e9fe --- /dev/null +++ b/tripleo/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/tripleo/spec/acceptance/nodesets/default.yml b/tripleo/spec/acceptance/nodesets/default.yml new file mode 100644 index 000000000..3bb3e6264 --- /dev/null +++ b/tripleo/spec/acceptance/nodesets/default.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: git diff --git a/tripleo/spec/acceptance/nodesets/nodepool-centos7.yml b/tripleo/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 000000000..c55287420 --- /dev/null +++ b/tripleo/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/tripleo/spec/acceptance/nodesets/nodepool-trusty.yml b/tripleo/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 000000000..7f503cadd --- /dev/null +++ b/tripleo/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/tripleo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/tripleo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..3bb3e6264 --- /dev/null +++ b/tripleo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: git diff --git a/tripleo/spec/spec_helper.rb b/tripleo/spec/spec_helper.rb index 0171d5dd0..700be6a27 100644 --- a/tripleo/spec/spec_helper.rb +++ b/tripleo/spec/spec_helper.rb @@ -1,5 +1,6 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' +require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' @@ -14,3 +15,5 @@ :uniqueid => '123' } end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/tripleo/spec/spec_helper_acceptance.rb b/tripleo/spec/spec_helper_acceptance.rb new file mode 100644 index 000000000..429e807c4 --- /dev/null +++ b/tripleo/spec/spec_helper_acceptance.rb @@ -0,0 +1,56 @@ +require 'beaker-rspec' +require 'beaker/puppet_install_helper' + +run_puppet_install_helper + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1] + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + hosts.each do |host| + + # install git + install_package host, 'git' + + zuul_ref = ENV['ZUUL_REF'] + zuul_branch = ENV['ZUUL_BRANCH'] + zuul_url = ENV['ZUUL_URL'] + + repo = 'openstack/puppet-openstack-integration' + + # Start out with clean moduledir, don't trust r10k to purge it + on host, "rm -rf /etc/puppet/modules/*" + # Install dependent modules via git or zuul + r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] } + if r.exit_code == 0 + zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner ' + zuul_clone_cmd += '--cache-dir /opt/git ' + zuul_clone_cmd += "--zuul-ref #{zuul_ref} " + zuul_clone_cmd += "--zuul-branch #{zuul_branch} " + zuul_clone_cmd += "--zuul-url #{zuul_url} " + zuul_clone_cmd += "git://git.openstack.org #{repo}" + on host, zuul_clone_cmd + else + on host, "git clone https://git.openstack.org/#{repo} #{repo}" + end + + on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh" + + # Install the module being tested + on host, "rm -fr /etc/puppet/modules/#{modname}" + puppet_module_install(:source => proj_root, :module_name => modname) + + on host, "rm -fr #{repo}" + + # List modules installed to help with debugging + on host, puppet('module','list'), { :acceptable_exit_codes => 0 } + end + end +end diff --git a/tripleo/spec/unit/type/package_manifest_spec.rb b/tripleo/spec/unit/type/package_manifest_spec.rb new file mode 100644 index 000000000..096564c30 --- /dev/null +++ b/tripleo/spec/unit/type/package_manifest_spec.rb @@ -0,0 +1,37 @@ + +require 'puppet' +require 'puppet/type/package_manifest' + +describe 'Puppet::Type.type(:package_manifest)' do + before :each do + @manifest = Puppet::Type.type(:package_manifest).new( + :path => '/tmp/test_package_manifest.txt', :ensure => 'present' + ) + end + + it 'should require a path' do + expect { + Puppet::Type.type(:package_manifest).new({}) + }.to raise_error Puppet::Error + end + + it 'should not require a value when ensure is absent' do + Puppet::Type.type(:package_manifest).new( + :path => '/tmp/test_package_manifest.txt', :ensure => :absent + ) + end + + it 'should accept valid ensure values' do + @manifest[:ensure] = :present + expect(@manifest[:ensure]).to eq(:present) + @manifest[:ensure] = :absent + expect(@manifest[:ensure]).to eq(:absent) + end + + it 'should not accept invalid ensure values' do + expect { + @manifest[:ensure] = :latest + }.to raise_error(Puppet::Error, /Invalid value/) + end + +end diff --git a/trove/.gitignore b/trove/.gitignore index da4238187..4dd84f06e 100644 --- a/trove/.gitignore +++ b/trove/.gitignore @@ -1,7 +1,10 @@ -*.swp -spec/fixtures/modules/* -spec/fixtures/manifests/site.pp +pkg/ Gemfile.lock -.vendor -.bundle/ vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml diff --git a/trove/Gemfile b/trove/Gemfile index 9ea211333..6d4ce9a07 100644 --- a/trove/Gemfile +++ b/trove/Gemfile @@ -1,25 +1,30 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.1.0', :require => false - - gem 'metadata-json-lint' - gem 'puppet-lint-param-docs' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-absolute_template_path' - gem 'puppet-lint-trailing_newline-check' + gem 'puppetlabs_spec_helper', :require => 'false' + gem 'rspec-puppet', '~> 2.2.0', :require => 'false' + gem 'metadata-json-lint', :require => 'false' + gem 'puppet-lint-param-docs', :require => 'false' + gem 'puppet-lint-absolute_classname-check', :require => 'false' + gem 'puppet-lint-absolute_template_path', :require => 'false' + gem 'puppet-lint-trailing_newline-check', :require => 'false' + gem 'puppet-lint-unquoted_string-check', :require => 'false' + gem 'puppet-lint-leading_zero-check', :require => 'false' + gem 'puppet-lint-variable_contains_upcase', :require => 'false' + gem 'puppet-lint-numericvariable', :require => 'false' + gem 'json', :require => 'false' + gem 'webmock', :require => 'false' +end - # Puppet 4.x related lint checks - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-variable_contains_upcase' - gem 'puppet-lint-numericvariable' +group :system_tests do + gem 'beaker-rspec', :require => 'false' + gem 'beaker-puppet_install_helper', :require => 'false' +end - gem 'beaker-rspec', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'json' - gem 'webmock' +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/trove/Rakefile b/trove/Rakefile index 84c9a7046..bc08f437c 100644 --- a/trove/Rakefile +++ b/trove/Rakefile @@ -1,9 +1,21 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetSyntax.exclude_paths ||= [] +PuppetSyntax.exclude_paths << "spec/fixtures/**/*" +PuppetSyntax.exclude_paths << "pkg/**/*" +PuppetSyntax.exclude_paths << "vendor/**/*" -task(:default).clear -task :default => [:spec, :lint] +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] + config.fail_on_warnings = true + config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' + config.disable_checks = ["80chars", "class_inherits_from_params_class", "class_parameter_defaults", "only_variable_string"] +end + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end diff --git a/trove/spec/acceptance/basic_trove_spec.rb b/trove/spec/acceptance/basic_trove_spec.rb index 0d128d0a3..393a0969c 100644 --- a/trove/spec/acceptance/basic_trove_spec.rb +++ b/trove/spec/acceptance/basic_trove_spec.rb @@ -23,15 +23,19 @@ class { '::openstack_extras::repo::debian::ubuntu': class { '::openstack_extras::repo::redhat::redhat': manage_rdo => false, repo_hash => { - # we need kilo repo to be installed for dependencies - 'rdo-kilo' => { - 'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/el7/', - 'descr' => 'RDO kilo', + 'openstack-common-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-common-testing/x86_64/os/', + 'descr' => 'openstack-common-testing', 'gpgcheck' => 'no', }, - 'rdo-liberty' => { - 'baseurl' => 'http://trunk.rdoproject.org/centos7/current/', - 'descr' => 'RDO trunk', + 'openstack-liberty-testing' => { + 'baseurl' => 'http://cbs.centos.org/repos/cloud7-openstack-liberty-testing/x86_64/os/', + 'descr' => 'openstack-liberty-testing', + 'gpgcheck' => 'no', + }, + 'openstack-liberty-trunk' => { + 'baseurl' => 'http://trunk.rdoproject.org/centos7-liberty/current/', + 'descr' => 'openstack-liberty-trunk', 'gpgcheck' => 'no', }, }, diff --git a/trove/spec/acceptance/nodesets/centos-70-x64.yml b/trove/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 000000000..5f097e9fe --- /dev/null +++ b/trove/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/trove/spec/acceptance/nodesets/default.yml b/trove/spec/acceptance/nodesets/default.yml index a2c1ecc63..486b6a34e 100644 --- a/trove/spec/acceptance/nodesets/default.yml +++ b/trove/spec/acceptance/nodesets/default.yml @@ -1,9 +1,10 @@ HOSTS: - ubuntu-14.04-amd64: + ubuntu-server-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 - hypervisor : none - ip: 127.0.0.1 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant CONFIG: type: foss diff --git a/trove/spec/acceptance/nodesets/nodepool-centos7.yml b/trove/spec/acceptance/nodesets/nodepool-centos7.yml index 575ae6732..c55287420 100644 --- a/trove/spec/acceptance/nodesets/nodepool-centos7.yml +++ b/trove/spec/acceptance/nodesets/nodepool-centos7.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: el-7-x86_64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/trove/spec/acceptance/nodesets/nodepool-trusty.yml b/trove/spec/acceptance/nodesets/nodepool-trusty.yml index a95d9f38d..9fc624e24 100644 --- a/trove/spec/acceptance/nodesets/nodepool-trusty.yml +++ b/trove/spec/acceptance/nodesets/nodepool-trusty.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: ubuntu-14.04-amd64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 000000000..8001929b2 --- /dev/null +++ b/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/trove/spec/classes/trove_init_spec.rb b/trove/spec/classes/trove_init_spec.rb index c61e2abc1..39b7357c4 100644 --- a/trove/spec/classes/trove_init_spec.rb +++ b/trove/spec/classes/trove_init_spec.rb @@ -58,7 +58,7 @@ end it 'installs common package' do - should contain_package('trove').with( + is_expected.to contain_package('trove').with( :name => 'openstack-trove', :ensure => 'present', :tag => ['openstack', 'trove-package'], diff --git a/trove/spec/spec_helper.rb b/trove/spec/spec_helper.rb index 53d4dd02d..3df4cede1 100644 --- a/trove/spec/spec_helper.rb +++ b/trove/spec/spec_helper.rb @@ -1,7 +1,10 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' +require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/vcsrepo/README.markdown b/vcsrepo/README.markdown index badb1ce6c..e87889117 100644 --- a/vcsrepo/README.markdown +++ b/vcsrepo/README.markdown @@ -1,608 +1,608 @@ -#vcsrepo - -####Table of Contents - -1. [Overview](#overview) -2. [Module Description - What the module does and why it is useful](#module-description) -3. [Setup - The basics of getting started with vcsrepo](#setup) - * [Setup requirements](#setup-requirements) - * [Beginning with vcsrepo](#beginning-with-vcsrepo) -4. [Usage - Configuration options and additional functionality](#usage) - * [Git](#git) - * [Bazaar](#bazaar) - * [CVS](#cvs) - * [Mercurial](#mercurial) - * [Perforce](#perforce) - * [Subversion](#subversion) -5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) - * [Type: vcsrepo](#type-vcsrepo) - * [Providers](#providers) - * [Features](#features) - * [Parameters](#parameters) -5. [Limitations - OS compatibility, etc.](#limitations) -6. [Development - Guide for contributing to the module](#development) - -##Overview - -The vcsrepo module lets you use Puppet to easily deploy content from your version control system (VCS). - -##Module Description - -The vcsrepo module provides a single type with providers to support the following version control systems: - -* [Git](#git) -* [Bazaar](#bazaar) -* [CVS](#cvs) -* [Mercurial](#mercurial) -* [Perforce](#perforce) -* [Subversion](#subversion) - -**Note:** `git` is the only vcs provider officially [supported by Puppet Labs](https://forge.puppetlabs.com/supported). - -##Setup - -###Setup Requirements - -The `vcsrepo` module does not install any VCS software for you. You must install a VCS before you can use this module. - -Like Puppet in general, the `vcsrepo` module does not automatically create parent directories for the files it manages. Make sure to set up any needed directory structures before you get started. - -###Beginning with vcsrepo - -To create and manage a blank repository, define the type `vcsrepo` with a path to your repository and supply the `provider` parameter based on the [VCS you're using](#usage). - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, -} -~~~ - -##Usage - -**Note:** `git` is the only vcsrepo provider officially [supported by Puppet Labs](https://forge.puppetlabs.com/supported). - -###Git - -####Create a blank repository - -To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, -} -~~~ - -If you're managing a central or official repository, you might want to make it a bare repository. To do this, set `ensure` to 'bare': - -~~~ -vcsrepo { '/path/to/repo': - ensure => bare, - provider => git, -} -~~~ - -####Clone/pull a repository - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - source => 'git://example.com/repo.git', -} -~~~ - -By default, `vcsrepo` will use the HEAD of the source repository's master branch. To use another branch or a specific commit, set `revision` to either a branch name or a commit SHA or tag. - -Branch name: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - source => 'git://example.com/repo.git', - revision => 'development', -} -~~~ - -SHA: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - source => 'git://example.com/repo.git', - revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31', -} -~~~ - -Tag: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - source => 'git://example.com/repo.git', - revision => '1.1.2rc1', -} -~~~ - -To check out a branch as a specific user, supply the `user` parameter: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - source => 'git://example.com/repo.git', - revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31', - user => 'someUser', -} -~~~ - -To keep the repository at the latest revision, set `ensure` to 'latest'. - -**WARNING:** this overwrites any local changes to the repository: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => git, - source => 'git://example.com/repo.git', - revision => 'master', -} -~~~ - -To clone the repository but skip initializing submodules, set `submodules` to 'false': - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => git, - source => 'git://example.com/repo.git', - submodules => false, -} -~~~ - -####Use multiple remotes with a repository -In place of a single string, you can set `source` to a hash of one or more name => URL pairs: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => git, - remote => 'origin' - source => { - 'origin' => 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git', - 'other_remote' => 'https://github.com/other_user/puppetlabs-vcsrepo.git' - }, -} -~~~ - +#vcsrepo + +####Table of Contents + +1. [Overview](#overview) +2. [Module Description - What the module does and why it is useful](#module-description) +3. [Setup - The basics of getting started with vcsrepo](#setup) + * [Setup requirements](#setup-requirements) + * [Beginning with vcsrepo](#beginning-with-vcsrepo) +4. [Usage - Configuration options and additional functionality](#usage) + * [Git](#git) + * [Bazaar](#bazaar) + * [CVS](#cvs) + * [Mercurial](#mercurial) + * [Perforce](#perforce) + * [Subversion](#subversion) +5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) + * [Type: vcsrepo](#type-vcsrepo) + * [Providers](#providers) + * [Features](#features) + * [Parameters](#parameters) +5. [Limitations - OS compatibility, etc.](#limitations) +6. [Development - Guide for contributing to the module](#development) + +##Overview + +The vcsrepo module lets you use Puppet to easily deploy content from your version control system (VCS). + +##Module Description + +The vcsrepo module provides a single type with providers to support the following version control systems: + +* [Git](#git) +* [Bazaar](#bazaar) +* [CVS](#cvs) +* [Mercurial](#mercurial) +* [Perforce](#perforce) +* [Subversion](#subversion) + +**Note:** `git` is the only vcs provider officially [supported by Puppet Labs](https://forge.puppetlabs.com/supported). + +##Setup + +###Setup Requirements + +The `vcsrepo` module does not install any VCS software for you. You must install a VCS before you can use this module. + +Like Puppet in general, the `vcsrepo` module does not automatically create parent directories for the files it manages. Make sure to set up any needed directory structures before you get started. + +###Beginning with vcsrepo + +To create and manage a blank repository, define the type `vcsrepo` with a path to your repository and supply the `provider` parameter based on the [VCS you're using](#usage). + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, +} +~~~ + +##Usage + +**Note:** `git` is the only vcsrepo provider officially [supported by Puppet Labs](https://forge.puppetlabs.com/supported). + +###Git + +####Create a blank repository + +To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, +} +~~~ + +If you're managing a central or official repository, you might want to make it a bare repository. To do this, set `ensure` to 'bare': + +~~~ +vcsrepo { '/path/to/repo': + ensure => bare, + provider => git, +} +~~~ + +####Clone/pull a repository + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + source => 'git://example.com/repo.git', +} +~~~ + +By default, `vcsrepo` will use the HEAD of the source repository's master branch. To use another branch or a specific commit, set `revision` to either a branch name or a commit SHA or tag. + +Branch name: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + source => 'git://example.com/repo.git', + revision => 'development', +} +~~~ + +SHA: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + source => 'git://example.com/repo.git', + revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31', +} +~~~ + +Tag: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + source => 'git://example.com/repo.git', + revision => '1.1.2rc1', +} +~~~ + +To check out a branch as a specific user, supply the `user` parameter: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + source => 'git://example.com/repo.git', + revision => '0c466b8a5a45f6cd7de82c08df2fb4ce1e920a31', + user => 'someUser', +} +~~~ + +To keep the repository at the latest revision, set `ensure` to 'latest'. + +**WARNING:** this overwrites any local changes to the repository: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => git, + source => 'git://example.com/repo.git', + revision => 'master', +} +~~~ + +To clone the repository but skip initializing submodules, set `submodules` to 'false': + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => git, + source => 'git://example.com/repo.git', + submodules => false, +} +~~~ + +####Use multiple remotes with a repository +In place of a single string, you can set `source` to a hash of one or more name => URL pairs: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => git, + remote => 'origin' + source => { + 'origin' => 'https://github.com/puppetlabs/puppetlabs-vcsrepo.git', + 'other_remote' => 'https://github.com/other_user/puppetlabs-vcsrepo.git' + }, +} +~~~ + **Note:** if you set `source` to a hash, one of the names you specify must match the value of the `remote` parameter. That remote serves as the upstream of your managed repository. - -####Connect via SSH - -To connect to your source repository via SSH (e.g., 'username@server:…'), we recommend managing your SSH keys with Puppet and using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure they are present before the `vcsrepo` resource is applied. - -To use SSH keys associated with a user, specify the username in the `user` parameter: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => git, - source => 'git://username@example.com/repo.git', - user => 'toto', #uses toto's $HOME/.ssh setup - require => File['/home/toto/.ssh/id_rsa'], -} -~~~ - -###Bazaar - -####Create a blank repository - -To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => bzr, -} -~~~ - -####Branch from an existing repository - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => bzr, - source => '/some/path', -} -~~~ - -To branch from a specific revision, set `revision` to a valid [Bazaar revision spec](http://wiki.bazaar.canonical.com/BzrRevisionSpec): - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => bzr, - source => '/some/path', - revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x', -} -~~~ - -####Connect via SSH - -To connect to your source repository via SSH (e.g., `'bzr+ssh://...'` or `'sftp://...,'`), we recommend using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => bzr, - source => 'bzr+ssh://bzr.example.com/some/path', - user => 'toto', #uses toto's $HOME/.ssh setup - require => File['/home/toto/.ssh/id_rsa'], -} -~~~ - -###CVS - -####Create a blank repository - -To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => cvs, -} -~~~ - -####Checkout/update from a repository - -~~~ -vcsrepo { '/path/to/workspace': - ensure => present, - provider => cvs, - source => ':pserver:anonymous@example.com:/sources/myproj', -} -~~~ - -To get a specific module on the current mainline, supply the `module` parameter: - -~~~ -vcsrepo {'/vagrant/lockss-daemon-source': - ensure => present, - provider => cvs, - source => ':pserver:anonymous@lockss.cvs.sourceforge.net:/cvsroot/lockss', - module => 'lockss-daemon', -} -~~~ - -To set the GZIP compression levels for your repository history, use the `compression` parameter: - -~~~ -vcsrepo { '/path/to/workspace': - ensure => present, - provider => cvs, - compression => 3, - source => ':pserver:anonymous@example.com:/sources/myproj', -} -~~~ - -To get a specific revision, set `revision` to the revision number. - -~~~ -vcsrepo { '/path/to/workspace': - ensure => present, - provider => cvs, - compression => 3, - source => ':pserver:anonymous@example.com:/sources/myproj', - revision => '1.2', -} -~~~ - -You can also set `revision` to a tag: - -~~~ -vcsrepo { '/path/to/workspace': - ensure => present, - provider => cvs, - compression => 3, - source => ':pserver:anonymous@example.com:/sources/myproj', - revision => 'SOMETAG', -} -~~~ - -####Connect via SSH - -To connect to your source repository via SSH, we recommend using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => cvs, - source => ':pserver:anonymous@example.com:/sources/myproj', - user => 'toto', #uses toto's $HOME/.ssh setup - require => File['/home/toto/.ssh/id_rsa'], -} -~~~ - -###Mercurial - -####Create a blank repository - -To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, -} -~~~ - -####Clone/pull & update a repository - -To get the default branch tip: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, - source => 'http://hg.example.com/myrepo', -} -~~~ - -For a specific changeset, use `revision`: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, - source => 'http://hg.example.com/myrepo', - revision => '21ea4598c962', -} -~~~ - -You can also set `revision` to a tag: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, - source => 'http://hg.example.com/myrepo', - revision => '1.1.2', -} -~~~ - -To check out as a specific user: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, - source => 'http://hg.example.com/myrepo', - user => 'user', -} -~~~ - -To specify an SSH identity key: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => hg, - source => 'ssh://hg@hg.example.com/myrepo', - identity => '/home/user/.ssh/id_dsa1, -} -~~~ - -To specify a username and password for HTTP Basic authentication: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => hg, - source => 'http://hg.example.com/myrepo', - basic_auth_username => 'hgusername', - basic_auth_password => 'hgpassword', -} -~~~ - -####Connect via SSH - -To connect to your source repository via SSH (e.g., `'ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => hg, - source => 'ssh://hg.example.com//path/to/myrepo', - user => 'toto', #uses toto's $HOME/.ssh setup - require => File['/home/toto/.ssh/id_rsa'], -} -~~~ - -###Perforce + +####Connect via SSH + +To connect to your source repository via SSH (e.g., 'username@server:…'), we recommend managing your SSH keys with Puppet and using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure they are present before the `vcsrepo` resource is applied. + +To use SSH keys associated with a user, specify the username in the `user` parameter: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => git, + source => 'git://username@example.com/repo.git', + user => 'toto', #uses toto's $HOME/.ssh setup + require => File['/home/toto/.ssh/id_rsa'], +} +~~~ + +###Bazaar + +####Create a blank repository + +To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => bzr, +} +~~~ + +####Branch from an existing repository + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => bzr, + source => '/some/path', +} +~~~ + +To branch from a specific revision, set `revision` to a valid [Bazaar revision spec](http://wiki.bazaar.canonical.com/BzrRevisionSpec): + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => bzr, + source => '/some/path', + revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x', +} +~~~ + +####Connect via SSH + +To connect to your source repository via SSH (e.g., `'bzr+ssh://...'` or `'sftp://...,'`), we recommend using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => bzr, + source => 'bzr+ssh://bzr.example.com/some/path', + user => 'toto', #uses toto's $HOME/.ssh setup + require => File['/home/toto/.ssh/id_rsa'], +} +~~~ + +###CVS + +####Create a blank repository + +To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => cvs, +} +~~~ + +####Checkout/update from a repository + +~~~ +vcsrepo { '/path/to/workspace': + ensure => present, + provider => cvs, + source => ':pserver:anonymous@example.com:/sources/myproj', +} +~~~ + +To get a specific module on the current mainline, supply the `module` parameter: + +~~~ +vcsrepo {'/vagrant/lockss-daemon-source': + ensure => present, + provider => cvs, + source => ':pserver:anonymous@lockss.cvs.sourceforge.net:/cvsroot/lockss', + module => 'lockss-daemon', +} +~~~ + +To set the GZIP compression levels for your repository history, use the `compression` parameter: + +~~~ +vcsrepo { '/path/to/workspace': + ensure => present, + provider => cvs, + compression => 3, + source => ':pserver:anonymous@example.com:/sources/myproj', +} +~~~ + +To get a specific revision, set `revision` to the revision number. + +~~~ +vcsrepo { '/path/to/workspace': + ensure => present, + provider => cvs, + compression => 3, + source => ':pserver:anonymous@example.com:/sources/myproj', + revision => '1.2', +} +~~~ + +You can also set `revision` to a tag: + +~~~ +vcsrepo { '/path/to/workspace': + ensure => present, + provider => cvs, + compression => 3, + source => ':pserver:anonymous@example.com:/sources/myproj', + revision => 'SOMETAG', +} +~~~ + +####Connect via SSH + +To connect to your source repository via SSH, we recommend using the [`require`](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) metaparameter to make sure your SSH keys are present before the `vcsrepo` resource is applied: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => cvs, + source => ':pserver:anonymous@example.com:/sources/myproj', + user => 'toto', #uses toto's $HOME/.ssh setup + require => File['/home/toto/.ssh/id_rsa'], +} +~~~ + +###Mercurial + +####Create a blank repository + +To create a blank repository, suitable for use as a central repository, define `vcsrepo` without `source` or `revision`: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, +} +~~~ + +####Clone/pull & update a repository + +To get the default branch tip: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, + source => 'http://hg.example.com/myrepo', +} +~~~ + +For a specific changeset, use `revision`: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, + source => 'http://hg.example.com/myrepo', + revision => '21ea4598c962', +} +~~~ + +You can also set `revision` to a tag: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, + source => 'http://hg.example.com/myrepo', + revision => '1.1.2', +} +~~~ + +To check out as a specific user: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, + source => 'http://hg.example.com/myrepo', + user => 'user', +} +~~~ + +To specify an SSH identity key: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => hg, + source => 'ssh://hg@hg.example.com/myrepo', + identity => '/home/user/.ssh/id_dsa1, +} +~~~ + +To specify a username and password for HTTP Basic authentication: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => hg, + source => 'http://hg.example.com/myrepo', + basic_auth_username => 'hgusername', + basic_auth_password => 'hgpassword', +} +~~~ + +####Connect via SSH + +To connect to your source repository via SSH (e.g., `'ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => hg, + source => 'ssh://hg.example.com//path/to/myrepo', + user => 'toto', #uses toto's $HOME/.ssh setup + require => File['/home/toto/.ssh/id_rsa'], +} +~~~ + +###Perforce ####Create an empty workspace To set up the connection to your Perforce service, set `p4config` to the location of a valid Perforce [config file](http://www.perforce.com/perforce/doc.current/manuals/p4guide/chapter.configuration.html#configuration.settings.configfiles) stored on the node: -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => p4, - p4config => '/root/.p4config' -} -~~~ +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => p4, + p4config => '/root/.p4config' +} +~~~ **Note:** If you don't include the `P4CLIENT` setting in your config file, the provider generates a workspace name based on the digest of `path` and the node's hostname (e.g., `puppet-91bc00640c4e5a17787286acbe2c021c`): -####Create/update and sync a Perforce workspace - -To sync a depot path to head, set `ensure` to 'latest': - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => p4, - source => '//depot/branch/...' -} -~~~ - -To sync to a specific changelist, specify its revision number with the `revision` parameter: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => p4, - source => '//depot/branch/...', - revision => '2341' -} -~~~ - -You can also set `revision` to a label: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => p4, - source => '//depot/branch/...', - revision => 'my_label' -} -~~~ - -###Subversion - -####Create a blank repository - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => svn, -} -~~~ - -####Check out from an existing repository - -Provide a `source` pointing to the branch or tag you want to check out: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => svn, - source => 'svn://svnrepo/hello/branches/foo', -} -~~~ - -You can also designate a specific revision: - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => svn, - source => 'svn://svnrepo/hello/branches/foo', - revision => '1234', -} -~~~ - -####Use a specific Subversion configuration directory - -Use the `configuration` parameter to designate the directory that contains your Subversion configuration files (typically, '/path/to/.subversion'): - -~~~ -vcsrepo { '/path/to/repo': - ensure => present, - provider => svn, - source => 'svn://svnrepo/hello/branches/foo', - configuration => '/path/to/.subversion', -} -~~~ - -####Connect via SSH - -To connect to your source repository via SSH (e.g., `'svn+ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied: - -~~~ -vcsrepo { '/path/to/repo': - ensure => latest, - provider => svn, - source => 'svn+ssh://svnrepo/hello/branches/foo', - user => 'toto', #uses toto's $HOME/.ssh setup - require => File['/home/toto/.ssh/id_rsa'], -} -~~~ - -##Reference - -###Type: vcsrepo - -The vcsrepo module adds only one type with several providers. Each provider abstracts a different VCS, and each provider includes a set of features according to its needs. - -####Providers - -**Note:** Not all features are available with all providers. - -#####`git` - Supports the Git VCS. - +####Create/update and sync a Perforce workspace + +To sync a depot path to head, set `ensure` to 'latest': + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => p4, + source => '//depot/branch/...' +} +~~~ + +To sync to a specific changelist, specify its revision number with the `revision` parameter: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => p4, + source => '//depot/branch/...', + revision => '2341' +} +~~~ + +You can also set `revision` to a label: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => p4, + source => '//depot/branch/...', + revision => 'my_label' +} +~~~ + +###Subversion + +####Create a blank repository + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => svn, +} +~~~ + +####Check out from an existing repository + +Provide a `source` pointing to the branch or tag you want to check out: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => svn, + source => 'svn://svnrepo/hello/branches/foo', +} +~~~ + +You can also designate a specific revision: + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => svn, + source => 'svn://svnrepo/hello/branches/foo', + revision => '1234', +} +~~~ + +####Use a specific Subversion configuration directory + +Use the `configuration` parameter to designate the directory that contains your Subversion configuration files (typically, '/path/to/.subversion'): + +~~~ +vcsrepo { '/path/to/repo': + ensure => present, + provider => svn, + source => 'svn://svnrepo/hello/branches/foo', + configuration => '/path/to/.subversion', +} +~~~ + +####Connect via SSH + +To connect to your source repository via SSH (e.g., `'svn+ssh://...'`), we recommend using the [`require` metaparameter](http://docs.puppetlabs.com/references/stable/metaparameter.html#require) to make sure your SSH keys are present before the `vcsrepo` resource is applied: + +~~~ +vcsrepo { '/path/to/repo': + ensure => latest, + provider => svn, + source => 'svn+ssh://svnrepo/hello/branches/foo', + user => 'toto', #uses toto's $HOME/.ssh setup + require => File['/home/toto/.ssh/id_rsa'], +} +~~~ + +##Reference + +###Type: vcsrepo + +The vcsrepo module adds only one type with several providers. Each provider abstracts a different VCS, and each provider includes a set of features according to its needs. + +####Providers + +**Note:** Not all features are available with all providers. + +#####`git` - Supports the Git VCS. + Features: `bare_repositories`, `depth`, `multiple_remotes`, `reference_tracking`, `ssh_identity`, `submodules`, `user` - -Parameters: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user` - -#####`bzr` - Supports the Bazaar VCS. - -Features: `reference_tracking` - + +Parameters: `depth`, `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `remote`, `revision`, `source`, `user` + +#####`bzr` - Supports the Bazaar VCS. + +Features: `reference_tracking` + Parameters: `ensure`, `excludes`, `force`, `group`, `owner`, `path`, `provider`, `revision`, `source` - -#####`cvs` - Supports the CVS VCS. - -Features: `cvs_rsh`, `gzip_compression`, `modules`, `reference_tracking`, `user` + +#####`cvs` - Supports the CVS VCS. + +Features: `cvs_rsh`, `gzip_compression`, `modules`, `reference_tracking`, `user` Parameters: `compression`, `cvs_rsh`, `ensure`, `excludes`, `force`, `group`, `module`, `owner`, `path`, `provider` - -#####`hg` - Supports the Mercurial VCS. - + +#####`hg` - Supports the Mercurial VCS. + Features: `reference_tracking`, `ssh_identity`, `user` - + Parameters: `ensure`, `excludes`, `force`, `group`, `identity`, `owner`, `path`, `provider`, `revision`, `source`, `user` - -#####`p4` - Supports the Perforce VCS. - + +#####`p4` - Supports the Perforce VCS. + Features: `p4config`, `reference_tracking` - + Parameters: `ensure`, `excludes`, `force`, `group`, `owner`, `p4config`, `path`, `provider`, `revision`, `source` - -#####`svn` - Supports the Subversion VCS. - -Features: `basic_auth`, `configuration`, `conflict`, `filesystem_types`, `reference_tracking` - -Parameters: `basic_auth_password`, `basic_auth_username`, `configuration`, `conflict`, `ensure`, `excludes`, `force`, `fstype`, `group`, `owner`, `path`, `provider`, `revision`, `source` - -####Features - -**Note:** Not all features are available with all providers. - -* `bare_repositories` - Differentiates between bare repositories and those with working copies. (Available with `git`.) + +#####`svn` - Supports the Subversion VCS. + +Features: `basic_auth`, `configuration`, `conflict`, `depth`, `filesystem_types`, `reference_tracking` + +Parameters: `basic_auth_password`, `basic_auth_username`, `configuration`, `conflict`, `ensure`, `excludes`, `force`, `fstype`, `group`, `owner`, `path`, `provider`, `revision`, `source`, `trust_server_cert` + +####Features + +**Note:** Not all features are available with all providers. + +* `bare_repositories` - Differentiates between bare repositories and those with working copies. (Available with `git`.) * `basic_auth` - Supports HTTP Basic authentication. (Available with `svn`.) -* `conflict` - Lets you decide how to resolve any conflicts between the source repository and your working copy. (Available with `svn`.) -* `configuration` - Lets you specify the location of your configuration files. (Available with `svn`.) -* `cvs_rsh` - Understands the `CVS_RSH` environment variable. (Available with `cvs`.) -* `depth` - Supports shallow clones. (Available with `git`.) -* `filesystem_types` - Supports multiple types of filesystem. (Available with `svn`.) -* `gzip_compression` - Supports explicit GZip compression levels. (Available with `cvs`.) -* `modules` - Lets you choose a specific repository module. (Available with `cvs`.) -* `multiple_remotes` - Tracks multiple remote repositories. (Available with `git`.) -* `reference_tracking` - Lets you track revision references that can change over time (e.g., some VCS tags and branch names). (Available with all providers) -* `ssh_identity` - Lets you specify an SSH identity file. (Available with `git` and `hg`.) -* `user` - Can run as a different user. (Available with `git`, `hg` and `cvs`.) -* `p4config` - Supports setting the `P4CONFIG` environment. (Available with `p4`.) -* `submodules` - Supports repository submodules which can be optionally initialized. (Available with `git`.) - -####Parameters - +* `conflict` - Lets you decide how to resolve any conflicts between the source repository and your working copy. (Available with `svn`.) +* `configuration` - Lets you specify the location of your configuration files. (Available with `svn`.) +* `cvs_rsh` - Understands the `CVS_RSH` environment variable. (Available with `cvs`.) +* `depth` - Supports shallow clones in `git` or sets scope limit in `svn`. (Available with `git` and `svn`.) +* `filesystem_types` - Supports multiple types of filesystem. (Available with `svn`.) +* `gzip_compression` - Supports explicit GZip compression levels. (Available with `cvs`.) +* `modules` - Lets you choose a specific repository module. (Available with `cvs`.) +* `multiple_remotes` - Tracks multiple remote repositories. (Available with `git`.) +* `reference_tracking` - Lets you track revision references that can change over time (e.g., some VCS tags and branch names). (Available with all providers) +* `ssh_identity` - Lets you specify an SSH identity file. (Available with `git` and `hg`.) +* `user` - Can run as a different user. (Available with `git`, `hg` and `cvs`.) +* `p4config` - Supports setting the `P4CONFIG` environment. (Available with `p4`.) +* `submodules` - Supports repository submodules which can be optionally initialized. (Available with `git`.) + +####Parameters + All parameters are optional, except where specified otherwise. ##### `basic_auth_password` @@ -631,7 +631,9 @@ Provides a value for the `CVS_RSH` environment variable. (Requires the `cvs_rsh` ##### `depth` -Sets the number of commits to include when creating a shallow clone. (Requires the `depth` feature.) Valid options: an integer. Default: none. +In `git` sets the number of commits to include when creating a shallow clone. (Requires the `depth` feature.) Valid options: an integer. Default: none. + +In `svn` instructs Subversion to limit the scope of an operation to a particular tree depth. (Requires the `depth` feature.) Valid options: 'empty', 'files', 'immediates', 'infinity'. Default: none. ##### `ensure` @@ -711,32 +713,36 @@ Default: none. Specifies whether to initialize and update each submodule in the repository. (Requires the `submodules` feature.) Valid options: 'true' and 'false'. Default: 'true'. +##### `trust_server_cert` + +Instructs Subversion to accept SSL server certificates issued by unknown certificate authorities. Valid options: 'true' and 'false'. Default: 'false'. + ##### `user` -Specifies the user to run as for repository operations. (Requires the `user` feature.) Valid options: a string containing a username or UID. Default: none. - -##Limitations - -Git is the only VCS provider officially [supported](https://forge.puppetlabs.com/supported) by Puppet Labs. - -This module has been tested with Puppet 2.7 and higher. - -The module has been tested on: - +Specifies the user to run as for repository operations. (Requires the `user` feature.) Valid options: a string containing a username or UID. Default: none. + +##Limitations + +Git is the only VCS provider officially [supported](https://forge.puppetlabs.com/supported) by Puppet Labs. + +This module has been tested with Puppet 2.7 and higher. + +The module has been tested on: + * CentOS 5/6/7 * Debian 6/7 -* Oracle 5/6/7 -* Red Hat Enterprise Linux 5/6/7 +* Oracle 5/6/7 +* Red Hat Enterprise Linux 5/6/7 * Scientific Linux 5/6/7 * SLES 10/11/12 -* Ubuntu 10.04/12.04/14.04 - -Testing on other platforms has been light and cannot be guaranteed. - -##Development - -Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. - -We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. - +* Ubuntu 10.04/12.04/14.04 + +Testing on other platforms has been light and cannot be guaranteed. + +##Development + +Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve. + +We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. + You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing) diff --git a/vcsrepo/lib/puppet/provider/vcsrepo/svn.rb b/vcsrepo/lib/puppet/provider/vcsrepo/svn.rb index 905d5adbd..ba77464a6 100644 --- a/vcsrepo/lib/puppet/provider/vcsrepo/svn.rb +++ b/vcsrepo/lib/puppet/provider/vcsrepo/svn.rb @@ -7,7 +7,7 @@ :svnadmin => 'svnadmin', :svnlook => 'svnlook' - has_features :filesystem_types, :reference_tracking, :basic_auth, :configuration, :conflict + has_features :filesystem_types, :reference_tracking, :basic_auth, :configuration, :conflict, :depth def create if !@resource.value(:source) @@ -15,7 +15,8 @@ def create else checkout_repository(@resource.value(:source), @resource.value(:path), - @resource.value(:revision)) + @resource.value(:revision), + @resource.value(:depth)) end update_owner end @@ -62,6 +63,10 @@ def buildargs args.push('--config-dir', @resource.value(:configuration)) end + if @resource.value(:trust_server_cert) + args.push('--trust-server-cert') + end + args end @@ -105,11 +110,14 @@ def revision=(desired) private - def checkout_repository(source, path, revision) + def checkout_repository(source, path, revision, depth) args = buildargs.push('checkout') if revision args.push('-r', revision) end + if depth + args.push('--depth', depth) + end args.push(source, path) svn(*args) end diff --git a/vcsrepo/lib/puppet/type/vcsrepo.rb b/vcsrepo/lib/puppet/type/vcsrepo.rb index e5dfbb5f5..da1dcde0d 100644 --- a/vcsrepo/lib/puppet/type/vcsrepo.rb +++ b/vcsrepo/lib/puppet/type/vcsrepo.rb @@ -38,7 +38,7 @@ "The provider understands the CVS_RSH environment variable" feature :depth, - "The provider can do shallow clones" + "The provider can do shallow clones or set scope limit" feature :branch, "The name of the branch" @@ -227,8 +227,14 @@ def retrieve newparam :conflict do desc "The action to take if conflicts exist between repository and working copy" end + + newparam :trust_server_cert do + desc "Trust server certificate" + newvalues(:true, :false) + defaultto false + end autorequire(:package) do - ['git', 'git-core'] + ['git', 'git-core', 'mercurial'] end end diff --git a/vcsrepo/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/vcsrepo/spec/unit/puppet/provider/vcsrepo/svn_spec.rb index 77f0e031c..25951bd88 100644 --- a/vcsrepo/spec/unit/puppet/provider/vcsrepo/svn_spec.rb +++ b/vcsrepo/spec/unit/puppet/provider/vcsrepo/svn_spec.rb @@ -52,6 +52,28 @@ provider.create end end + + context "with depth" do + it "should execute 'svn checkout' with a depth" do + resource[:source] = 'exists' + resource[:depth] = 'infinity' + provider.expects(:svn).with('--non-interactive', 'checkout', '--depth', 'infinity', + resource.value(:source), + resource.value(:path)) + provider.create + end + end + + context "with trust_server_cert" do + it "should execute 'svn checkout' with a trust-server-cert" do + resource[:source] = 'exists' + resource[:trust_server_cert] = true + provider.expects(:svn).with('--non-interactive', '--trust-server-cert', 'checkout', + resource.value(:source), + resource.value(:path)) + provider.create + end + end end describe 'destroying' do diff --git a/vswitch/spec/acceptance/basic_vswitch_spec.rb b/vswitch/spec/acceptance/basic_vswitch_spec.rb index 69750a7e5..7badc8147 100644 --- a/vswitch/spec/acceptance/basic_vswitch_spec.rb +++ b/vswitch/spec/acceptance/basic_vswitch_spec.rb @@ -43,7 +43,10 @@ class { '::openstack_extras::repo::redhat::redhat': end describe command('ovs-vsctl show') do - its(:stdout) { should match /br-beaker/ } + describe '#stdout' do + subject { super().stdout } + it { is_expected.to match /br-beaker/ } + end end end end