From 43a7f7b161cab0a2f48b966bf1069523809cd6b8 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin Date: Thu, 11 Feb 2016 23:47:56 +0300 Subject: [PATCH] Fixes and overrides Change-Id: Id9e930655495e0ed42bf08f1089d90ab22453798 --- doc/usage.rst | 12 ++++++++++++ hiera/neut_vlan.cinder-block-device.compute.yaml | 3 ++- hiera/override/roles-cinder.yaml | 12 ++++++++++++ hiera/override/roles-compute.yaml | 1 + lib/noop/manager/library.rb | 13 +++++++++++++ lib/noop/manager/report.rb | 13 +++++++++++++ lib/noop/task/hiera.rb | 2 +- lib/noop/task/overrides.rb | 8 +++++++- spec/spec_helper.rb | 2 ++ 9 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 hiera/override/roles-cinder.yaml diff --git a/doc/usage.rst b/doc/usage.rst index bef68be..a3b1008 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -126,6 +126,18 @@ possible run combinations you can use the **RUN:** annotation.:: It can be specified many times an all entered combinations will be added to the list. +There is also a way to use the reverse logic. You can specify the Hiera +and facts yaml files that you want to exclude from the list instead of +providing the list of included files.:: + + # SKIP_HIERA: neut_vlan.compute.ssl neut_vlan.compute.nossl + # SKIP_FACTS: centos6 + +These yaml files will be excluded from the list of possible yaml files. If +you have used both include and exclude options, the exclude option will have +the priority over the include option. If there are no included Hiera files +the list of Hiera files will be generated from the node roles. + The final annotation **DISABLE_SPEC** allows you to temporarily disable the spec from being seen the framework. It can use useful if you want to turn off a spec with run problems and fix them later without breaking the tests.:: diff --git a/hiera/neut_vlan.cinder-block-device.compute.yaml b/hiera/neut_vlan.cinder-block-device.compute.yaml index a0b08f7..1364900 100644 --- a/hiera/neut_vlan.cinder-block-device.compute.yaml +++ b/hiera/neut_vlan.cinder-block-device.compute.yaml @@ -743,7 +743,8 @@ public_ssl: hostname: public.fuel.local horizon: true services: true - cert_data: '' + cert_data: + content: 'somedataaboutyourkeypair' cert_source: self_signed metadata: group: security diff --git a/hiera/override/roles-cinder.yaml b/hiera/override/roles-cinder.yaml new file mode 100644 index 0000000..067fba3 --- /dev/null +++ b/hiera/override/roles-cinder.yaml @@ -0,0 +1,12 @@ +--- + storage: + volume_backend_names: + volumes_ceph: false + volumes_lvm: 'LVM-backend' + volumes_block_device: false + storage_hash: + volume_backend_names: + volumes_ceph: false + volumes_lvm: 'LVM-backend' + volumes_block_device: false + diff --git a/hiera/override/roles-compute.yaml b/hiera/override/roles-compute.yaml index bc19a37..8c0bdb9 100644 --- a/hiera/override/roles-compute.yaml +++ b/hiera/override/roles-compute.yaml @@ -1,4 +1,5 @@ --- +host_uuid: '00000000-0000-0000-0000-000000000000' configuration: nova_config: DEFAULT/debug: diff --git a/lib/noop/manager/library.rb b/lib/noop/manager/library.rb index 591ed90..cde1a92 100644 --- a/lib/noop/manager/library.rb +++ b/lib/noop/manager/library.rb @@ -176,9 +176,19 @@ module Noop if line =~ /^\s*#\s*(?:yamls|hiera):\s*(.*)/ task_spec_metadata[:hiera] = get_list_of_yamls $1 end + if line =~ /^\s*#\s*facts:\s*(.*)/ task_spec_metadata[:facts] = get_list_of_yamls $1 end + + if line =~ /^\s*#\s*(?:skip_yamls|skip_hiera):\s(.*)/ + task_spec_metadata[:skip_hiera] = get_list_of_yamls $1 + end + + if line =~ /^\s*#\s*skip_facts:\s(.*)/ + task_spec_metadata[:skip_facts] = get_list_of_yamls $1 + end + if line =~ /disable_spec/ task_spec_metadata[:disable] = true end @@ -216,8 +226,11 @@ module Noop metadata = spec_run_metadata.fetch file_name_spec, {} metadata[:facts] = [Noop::Config.default_facts_file_name] unless metadata[:facts] metadata[:hiera] = assign_spec_to_hiera.fetch file_name_spec, [] unless metadata[:hiera] + runs = [] metadata[:facts].product metadata[:hiera] do |facts, hiera| + next if metadata[:skip_hiera].is_a? Array and metadata[:skip_hiera].include? hiera + next if metadata[:skip_facts].is_a? Array and metadata[:skip_facts].include? hiera run_record = { :hiera => hiera, :facts => facts, diff --git a/lib/noop/manager/report.rb b/lib/noop/manager/report.rb index 7f5cfe9..f67a62f 100644 --- a/lib/noop/manager/report.rb +++ b/lib/noop/manager/report.rb @@ -130,10 +130,23 @@ module Noop end.max end + def output_task_totals + tasks = 0 + failed = 0 + pending = 0 + task_list.each do |task| + pending += 1 if task.pending? + failed += 1 if task.failed? + tasks += 1 + end + output "Tasks: #{tasks} Failed: #{failed} Pending: #{pending}" + end + def task_report task_list.each do |task| output_task_status task end + output_task_totals end def show_filters diff --git a/lib/noop/task/hiera.rb b/lib/noop/task/hiera.rb index bd84b64..d2bcaf4 100644 --- a/lib/noop/task/hiera.rb +++ b/lib/noop/task/hiera.rb @@ -119,7 +119,7 @@ module Noop end # @return [Object] - def hiera_structure(key, default = nil, separator = '/', resolution_type = :priority) + def hiera_structure(key, default = nil, separator = '/', resolution_type = :hash) path_lookup = lambda do |data, path, default_value| break default_value unless data break data unless path.is_a? Array and path.any? diff --git a/lib/noop/task/overrides.rb b/lib/noop/task/overrides.rb index 1bf4c0d..c1b5baa 100644 --- a/lib/noop/task/overrides.rb +++ b/lib/noop/task/overrides.rb @@ -24,7 +24,13 @@ module Noop end class << Hiera::Config - attr_accessor :config + def config + @config + end + + def config=(value) + @config = value + end def load(source) @config ||= {} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 74dd788..5e41275 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,3 +28,5 @@ RSpec.configure do |c| end end + +Noop.setup_overrides