fhcap-cli 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/Dockerfile +37 -0
  4. data/entrypoint.sh +11 -0
  5. data/fhcap-cli.gemspec +9 -4
  6. data/lib/cookbooks/provision/libraries/provision.rb +16 -2
  7. data/lib/cookbooks/provision/recipes/ssh.rb +25 -0
  8. data/lib/cookbooks/provision/recipes/ssh_cluster_create.rb +4 -0
  9. data/lib/cookbooks/provision/recipes/ssh_cluster_destroy.rb +4 -0
  10. data/lib/extensions/thor/actions.rb +33 -0
  11. data/lib/fhcap.rb +2 -2
  12. data/lib/fhcap/dns.rb +3 -3
  13. data/lib/fhcap/kitchen.rb +65 -16
  14. data/lib/fhcap/knife_helper.rb +1 -2
  15. data/lib/fhcap/providers_helper.rb +1 -0
  16. data/lib/fhcap/repos_helper.rb +1 -1
  17. data/lib/fhcap/tasks/chef/cookbook/update_config.rb +0 -1
  18. data/lib/fhcap/tasks/dns/aws/create_record.rb +81 -0
  19. data/lib/fhcap/tasks/dns/aws/delete_record.rb +57 -0
  20. data/lib/fhcap/tasks/dns/aws/list_records.rb +34 -0
  21. data/lib/fhcap/tasks/dns/{route53_helper.rb → aws/route53_helper.rb} +1 -1
  22. data/lib/fhcap/tasks/dns/create_record.rb +5 -67
  23. data/lib/fhcap/tasks/dns/delete_record.rb +5 -43
  24. data/lib/fhcap/tasks/dns/list_records.rb +25 -0
  25. data/lib/fhcap/thor_base.rb +5 -0
  26. data/lib/fhcap/version.rb +1 -1
  27. data/spec/fhcap/tasks/dns/{create_record_spec.rb → aws/create_record_spec.rb} +4 -4
  28. data/spec/fhcap/tasks/dns/{delete_record_spec.rb → aws/delete_record_spec.rb} +4 -4
  29. data/templates/chef/environment_mbaas.json.erb +32 -2
  30. data/templates/chef/environment_single.json.erb +8 -0
  31. data/templates/cluster/aws/farm-5node.json.erb +245 -0
  32. data/templates/cluster/farm-5node.json.erb +8 -0
  33. data/templates/cluster/openstack/farm-5node.json.erb +20 -0
  34. data/templates/kitchen/Dockerfile-rhel +23 -0
  35. data/templates/kitchen/Vagrantfile-osx.rb +10 -0
  36. data/templates/kitchen/docker_id_rsa +27 -0
  37. data/templates/kitchen/docker_id_rsa.pub +1 -0
  38. data/templates/kitchen/kitchen.aws.yml.erb +37 -14
  39. data/templates/kitchen/kitchen.docker.yml.erb +34 -1
  40. data/templates/kitchen/kitchen.vagrant.yml.erb +39 -3
  41. metadata +86 -14
  42. data/lib/fhcap/tasks/dns/list.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1685de7948d976df40d6c15e0870a51f12393fc2
4
- data.tar.gz: 4a812cdd3b1e2865105e0ee69ffc55e74f82881b
3
+ metadata.gz: 1b016a16a0016627aec93bbdfc076803d288ee32
4
+ data.tar.gz: d33df34b6a28e16b580c6399f1a748295a0e9a8a
5
5
  SHA512:
6
- metadata.gz: f4ce224936b910162e7fcf0b2bd10f0f0d415a4fd35c523cebabdbfe860ccc74b9fc0d31c19290e088064e59926224be8cd0063df2c0658c5cdfafc6ee95fe0b
7
- data.tar.gz: 7e0917eceb7b16367d7c71683f949c8bfd6c4e2398a5e8d7608b5e866507b5f12cf10c173442321eb40fc4e837c0e481159462a7bc29687253024309bf7bccc0
6
+ metadata.gz: 2926b8a7452e6faac59e8559e91189f37950a34138abeb258623898ec934d6beb91fbb23f4b12dfb72fa779244f636b321fcd7e2204a0331e7a050fd7d49074b
7
+ data.tar.gz: d1b00a5098e14a1fdea3284a0a3d47f72a2254699763a63dc8692c826eca3b4f75eda6e85eb447546a63477f5a6980101968f7660390aa637d076b45b90797a7
@@ -1,6 +1,19 @@
1
1
 
2
2
  ## Unreleased
3
3
 
4
+ ## 0.4.10
5
+
6
+ * Disable the dynovm bind9 cache in all single node environments by default.
7
+ * [RHMAP-11771] - Fix kitchen generate using a role (fhcap kitchen generate -r fhcap -d vagrant).
8
+ * Add ability to override test suite directory via an env var (TEST_SUITE_DIR=/tmp fhcap kitchen generate).
9
+ * Use purge option on knife download command and stop manually deleting local files.
10
+ * Pin nokogiri gem to version 1.6.8.1 (Can be removed when we require a ruby version >= 2.1.0)
11
+ * [RHMAP-11675] - Add low level chef provisioning ssh provider. Note: This does not include generate support for the 'ssh' provider type.
12
+ * [RHMAP-11546] - Update kitchen config templates to include additional platforms (centos-6.5 and macosx-10.10 ).
13
+ * Ensure all thor errors result in a non zero exit status. Optionally allow run commands to exit on failure and update kitchen commands to exit on failure with non zero status.
14
+ * [RHMAP-11003] - Update kitchen config templates to include all supported platforms (rhel-7.2, centos-7 and ubuntu-12.04 ).
15
+ * [RHMAP-11001] - Updated test kitchen generation task to use the contents of the cookbook under tests kitchen.yml when generating the platforms section of the kitchen config.
16
+
4
17
  ## 0.4.9
5
18
 
6
19
  * [RHMAP-9021] - Add support for longer AWS Instance and ELB Ids (Patched with upstream changes made in chef-provisioning-aws gem)
@@ -0,0 +1,37 @@
1
+ FROM ruby:2.3
2
+
3
+ # Consumed by atomic cli: http://www.projectatomic.io/docs/usr-bin-atomic/
4
+ # E.g. atomic run tools/fhcap cluster list # where the image name is tools/fhcap
5
+ LABEL RUN="docker run -ti --rm -e LOCAL_USER_ID=\$SUDO_UID -v "\$HOME"/fhcapd:/home/fh/fhcap -v "\$HOME"/fhcap/repos:/home/fh/fhcap/repos -v "\$HOME"/src/fheng:/home/fh/fhcap/src -v "\$HOME"/.ssh:/home/fh/.ssh IMAGE"
6
+
7
+ WORKDIR /usr/src/app
8
+
9
+ RUN curl -sSL https://get.docker.com/ | sh
10
+
11
+ RUN apt-get update && apt-get -y --no-install-recommends install \
12
+ ca-certificates \
13
+ curl
14
+
15
+ RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4
16
+ RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture)" \
17
+ && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture).asc" \
18
+ && gpg --verify /usr/local/bin/gosu.asc \
19
+ && rm /usr/local/bin/gosu.asc \
20
+ && chmod +x /usr/local/bin/gosu
21
+
22
+ COPY Gemfile* fhcap-cli.gemspec /usr/src/app/
23
+ COPY bin/fhcap /usr/src/app/bin/
24
+ COPY lib/fhcap/version.rb /usr/src/app/lib/fhcap/
25
+
26
+ RUN gem install bundler && \
27
+ bundle install
28
+
29
+ COPY . /usr/src/app
30
+
31
+ RUN chmod 777 /usr/src/app/Gemfile.lock
32
+
33
+ VOLUME /home/fh/fhcap /home/fh/fhcap/repos /home/fh/fhcap/src /home/fh/.ssh
34
+
35
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
36
+
37
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ # Add local user (fh)
4
+ # Either use the LOCAL_USER_ID if passed in at runtime or
5
+ # fallback
6
+
7
+ USER_ID=${LOCAL_USER_ID:-9001}
8
+
9
+ useradd --shell /bin/bash -u $USER_ID -o -c "" fh
10
+
11
+ exec /usr/local/bin/gosu fh fhcap "$@"
@@ -16,10 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.required_rubygems_version = '>= 2.6.3'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0")
19
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.bindir = "bin"
20
+ spec.executables = %w{fhcap}
20
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
22
  spec.require_paths = ["lib"]
22
23
 
24
+ spec.add_dependency 'nokogiri', '= 1.6.8.1'
23
25
  spec.add_dependency 'thor', '= 0.19.1'
24
26
  spec.add_dependency 'sshkey', '= 1.6.1'
25
27
  spec.add_dependency 'public_suffix', '= 1.5.2'
@@ -33,16 +35,19 @@ Gem::Specification.new do |spec|
33
35
  spec.add_dependency 'java_properties', '= 0.0.4'
34
36
  spec.add_dependency 'archive-tar-minitar', '= 0.5.2'
35
37
  spec.add_dependency 'aws-sdk', '= 2.1.35'
38
+ spec.add_dependency 'ffi-yajl', '= 2.2.3'
39
+ spec.add_dependency 'rack', '= 1.6.4'
36
40
  spec.add_dependency 'chef', '= 12.4.3'
37
41
  spec.add_dependency 'chef-provisioning', '= 1.4.1'
38
42
  spec.add_dependency 'chef-provisioning-aws', '= 1.4.1'
39
43
  spec.add_dependency 'chef-provisioning-vagrant', '= 0.10.0'
40
44
  spec.add_dependency 'chef-provisioning-fog', '= 0.15.0'
45
+ spec.add_dependency 'chef-provisioning-ssh', '= 0.0.9'
41
46
  spec.add_dependency 'test-kitchen', '= 1.4.2'
42
47
  spec.add_dependency 'kitchen-sync', '= 2.1.1'
43
- spec.add_dependency 'kitchen-vagrant', '= 0.14.0'
44
- spec.add_dependency 'kitchen-ec2', '= 0.8.0'
45
- spec.add_dependency 'kitchen-docker', '= 2.1.0'
48
+ spec.add_dependency 'kitchen-vagrant', '= 0.16.0'
49
+ spec.add_dependency 'kitchen-ec2', '= 1.2.0'
50
+ spec.add_dependency 'kitchen-docker', '= 2.6.0'
46
51
  spec.add_dependency 'kitchen-openstack','= 1.8.1'
47
52
 
48
53
  spec.add_development_dependency "rake", "~> 10.0"
@@ -88,7 +88,21 @@ def openstack_bootstrap_options(org_name, environment, instance_options)
88
88
  end
89
89
 
90
90
  def openstack_converge_options(org_name, environment, instance_options)
91
- {:chef_version => '11.10.4', :ohai_hints => { :openstack => {} }}
91
+ {:chef_version => '11.10.4', :ohai_hints => {:openstack => {}}}
92
+ end
93
+
94
+ #SSH
95
+
96
+ def ssh_machine_options(org_name, environment, instance_name, instance_options)
97
+ {}
98
+ end
99
+
100
+ def ssh_bootstrap_options(org_name, environment, instance_options)
101
+ {}
102
+ end
103
+
104
+ def ssh_converge_options(org_name, environment, instance_options)
105
+ {:chef_version => '11.10.4'}
92
106
  end
93
107
 
94
108
  def key_pair_name_for(name)
@@ -146,7 +160,7 @@ def with_cluster_config(node, &block)
146
160
  block.call cluster_config
147
161
  end
148
162
 
149
- def with_cluster_instances(node, &block)
163
+ def with_cluster_instances(node, &block)
150
164
  env_regexp = node[:'env-regexp'] || '.'
151
165
  node_regexp = node[:'node-regexp'] || '.'
152
166
  with_cluster_config(node) do |cluster_config|
@@ -0,0 +1,25 @@
1
+ require 'chef/provisioning/ssh_driver'
2
+
3
+ cluster_config = cluster_config_for(node)
4
+ org_name = cluster_config[:id]
5
+
6
+ repo_dir_name = File.basename(node[:local_repo_path])
7
+ tmp_repo_dir = File.join('/tmp', repo_dir_name)
8
+
9
+ link tmp_repo_dir do
10
+ to node[:local_repo_path]
11
+ end
12
+
13
+ node.override[:local_repo_path] = tmp_repo_dir
14
+
15
+ repo_ssh_nodes_dir = File.join(node[:local_repo_path], node[:local_repo_clusters_dir], 'ssh_nodes')
16
+ local_key_pairs_dir = File.join(node[:local_repo_path], node[:local_repo_clusters_dir], 'key_pairs')
17
+ key_pair_name = key_pair_name_for(org_name)
18
+
19
+ node.default[:machine_options][:transport_options]['ssh_options']['keys'] = [File.join(local_key_pairs_dir, "#{key_pair_name}.pem")]
20
+
21
+ directory repo_ssh_nodes_dir do
22
+ recursive true
23
+ end
24
+
25
+ with_driver "ssh:#{repo_ssh_nodes_dir}"
@@ -0,0 +1,4 @@
1
+ include_recipe 'provision::common'
2
+ include_recipe "provision::ssh"
3
+
4
+ include_recipe "provision::cluster_create_instances"
@@ -0,0 +1,4 @@
1
+ include_recipe 'provision::common'
2
+ include_recipe "provision::ssh"
3
+
4
+ include_recipe "provision::cluster_destroy_instances"
@@ -0,0 +1,33 @@
1
+ class Thor
2
+ module Actions
3
+ def run(command, config = {})
4
+ return unless behavior == :invoke
5
+
6
+ destination = relative_to_original_destination_root(destination_root, false)
7
+ desc = "#{command} from #{destination.inspect}"
8
+
9
+ if config[:with]
10
+ desc = "#{File.basename(config[:with].to_s)} #{desc}"
11
+ command = "#{config[:with]} #{command}"
12
+ end
13
+
14
+ say_status :run, desc, config.fetch(:verbose, true)
15
+
16
+ unless options[:pretend]
17
+ if config[:capture]
18
+ result = `#{command}`
19
+ status = $?.exitstatus
20
+ else
21
+ result = system("#{command}")
22
+ status = result ? 0 : 1
23
+ end
24
+
25
+ if config[:exit_on_failure]
26
+ status == 0 or exit status
27
+ end
28
+
29
+ result
30
+ end
31
+ end
32
+ end
33
+ end
@@ -3,7 +3,7 @@ require "pathname"
3
3
 
4
4
  module Fhcap
5
5
  GEM_DIR = File.expand_path '..', File.dirname(__FILE__)
6
- TEMPLATE_NAMES = %w{single core-3node mbaas-3node core-mbaas-6node core-small-9node nginx-test single-blank farm-3node farm-single ose-single}.sort
6
+ TEMPLATE_NAMES = %w{single core-3node mbaas-3node core-mbaas-6node core-small-9node nginx-test single-blank farm-3node farm-5node farm-single ose-single}.sort
7
7
 
8
8
  class << self
9
9
  def source_root
@@ -11,4 +11,4 @@ module Fhcap
11
11
  end
12
12
  end
13
13
 
14
- end
14
+ end
@@ -51,10 +51,10 @@ module Fhcap
51
51
  desc "list", "List DNS Records"
52
52
 
53
53
  def list
54
- require "fhcap/tasks/dns/list"
55
- Tasks::Dns::List.new(task_options(options.dup)).run
54
+ require "fhcap/tasks/dns/list_records"
55
+ Tasks::Dns::ListRecords.new(task_options(options.dup)).run
56
56
  end
57
57
 
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -3,6 +3,7 @@ require 'fhcap/thor_base'
3
3
 
4
4
  require 'pathname'
5
5
  require 'yaml'
6
+ require 'deep_merge'
6
7
 
7
8
  module Fhcap
8
9
  module CLI
@@ -29,7 +30,7 @@ module Fhcap
29
30
 
30
31
  def generate
31
32
  require 'chef'
32
- cookbooks = get_cookbooks(options, nil, repo_cookbook_paths('-cookbooks'))
33
+ cookbooks = get_cookbooks(options, [], repo_cookbook_paths('-cookbooks'))
33
34
  roles = options[:roles] || []
34
35
  driver = options[:driver]
35
36
  provisioner = options[:provisioner]
@@ -53,6 +54,15 @@ module Fhcap
53
54
  cookbook_kitchen_yaml = File.join(meta.root_dir, ".kitchen.yml")
54
55
  if File.exists? cookbook_kitchen_yaml
55
56
  cookbook_kitchen_config = YAML.load_file(cookbook_kitchen_yaml)
57
+
58
+ if cookbook_kitchen_config['platforms']
59
+ cookbook_kitchen_config['platforms'].map! do |platform|
60
+ default_values = kitchen_config['platforms'].detect {|f| f["name"] == platform['name']} || {}
61
+ default_values.merge(platform)
62
+ end
63
+ kitchen_config['platforms'] = cookbook_kitchen_config['platforms']
64
+ end
65
+
56
66
  cookbook_kitchen_config['suites'].each do |suite|
57
67
  suite['name'] = "#{suite['name']}_#{cookbook}"
58
68
  suite['run_list'].unshift 'recipe[feedhenry_utils::kitchen_docker]' if driver == 'docker'
@@ -87,22 +97,46 @@ module Fhcap
87
97
  if File.exists? role_file
88
98
  ::Chef::Config[:role_path] = File.join(repo_dir(:fhcap), 'roles')
89
99
  role = ::Chef::Role.from_disk r
90
- run_list = role.run_list.expand('development')
100
+ run_list = role.run_list.expand('development', 'disk')
91
101
 
92
102
  role_cookbooks = run_list.recipes.collect do |recipe|
93
103
  recipe.split('::').first
94
104
  end.compact.uniq
95
105
 
96
- suite = {}
97
- suite['name'] = "default_#{r}"
98
- suite['run_list'] = ["role[#{r}]"]
99
- kitchen_config['suites'] << suite
106
+ suite_attributes = {}
107
+ suite_run_list = []
108
+ suite_run_list << 'recipe[feedhenry_utils::kitchen_docker]' if driver == 'docker'
109
+ suite_run_list << 'recipe[apt::default]'
110
+ suite_run_list << 'recipe[chef-solo-search]' if provisioner == 'chef_solo'
111
+ suite_run_list << 'role[test-kitchen_server]'
112
+ suite_run_list << "role[#{r}]"
100
113
 
101
114
  role_cookbooks.each do |c|
102
115
  get_cookbook_deps(c, cookbook_dependencies, {cwd: test_suite_dir})
116
+ meta = cookbook_loader.cookbooks_by_name[c]
117
+ if meta
118
+ cookbook_kitchen_yaml = File.join(meta.root_dir, ".kitchen.yml")
119
+ if File.exists? cookbook_kitchen_yaml
120
+ cookbook_kitchen_config = YAML.load_file(cookbook_kitchen_yaml)
121
+ default_values = cookbook_kitchen_config['suites'].detect {|f| f["name"] == 'default'} || {}
122
+ default_attributes = default_values['attributes'] || {}
123
+ suite_attributes.deep_merge!(default_attributes)
124
+ end
125
+ end
103
126
  end
104
127
 
105
- link_cookbook_tests(role_cookbooks, options, r)
128
+ # The env overrides in some of the wrapper cookbooks cause issues when using roles, for now we will just remove them entirely.
129
+ if suite_attributes['feedhenry_common']
130
+ suite_attributes['feedhenry_common'].delete('env')
131
+ end
132
+
133
+ suite = {}
134
+ suite['name'] = "default_#{r}"
135
+ suite['run_list'] = suite_run_list
136
+ suite['attributes'] = suite_attributes
137
+ kitchen_config['suites'] << suite
138
+
139
+ link_cookbook_tests(role_cookbooks, options, r, 'default')
106
140
 
107
141
  else
108
142
  say "Unknown Role #{role_file}"
@@ -117,6 +151,15 @@ module Fhcap
117
151
 
118
152
  #3. Configure tests
119
153
  link_cookbook_tests(cookbooks, options)
154
+
155
+ #4. Add custom driver config
156
+ if driver == 'docker'
157
+ template(File.join("templates", "kitchen", "Dockerfile-rhel"), File.join(test_suite_dir, "Dockerfile-rhel"), {}, :force => true)
158
+ template(File.join("templates", "kitchen", "docker_id_rsa"), File.join(test_suite_dir, "docker_id_rsa"), {}, :force => true)
159
+ template(File.join("templates", "kitchen", "docker_id_rsa.pub"), File.join(test_suite_dir, "docker_id_rsa.pub"), {}, :force => true)
160
+ elsif driver == 'vagrant'
161
+ template(File.join("templates", "kitchen", "Vagrantfile-osx.rb"), File.join(test_suite_dir, "Vagrantfile-osx.rb"), {}, :force => true)
162
+ end
120
163
  end
121
164
 
122
165
  desc "clean", "Clean"
@@ -137,10 +180,11 @@ module Fhcap
137
180
  kitchen_options = options[:'kitchen-options'] || {}
138
181
  Fhcap::CLI::Kitchen.new.invoke(:generate, [], options) if options[:cookbooks] || options[:modified] || options[:roles]
139
182
  if is_kitchen_generated?
140
- Dir.chdir test_suite_dir do
183
+ tsd = test_suite_dir
184
+ Dir.chdir tsd do
141
185
  cmd_options = options.dup
142
186
  cmd_options['instance'] = instance
143
- cmd_options['kitchen-yaml'] = test_suite_kitchen_yml
187
+ cmd_options['kitchen-yaml'] = test_suite_kitchen_yml(tsd)
144
188
  cmd_options['kitchen-options'] = kitchen_options_for(
145
189
  default_kitchen_options.merge(
146
190
  {:'log-level' => options[:'log-level']}
@@ -173,11 +217,11 @@ module Fhcap
173
217
  end
174
218
 
175
219
  def test_suite_dir
176
- File.join(config.default_dir, 'tmp', 'kitchen')
220
+ ENV['TEST_SUITE_DIR'] ? File.expand_path(ENV['TEST_SUITE_DIR']) : File.join(config.default_dir, 'tmp', 'kitchen')
177
221
  end
178
222
 
179
- def test_suite_kitchen_yml
180
- File.join(test_suite_dir, 'kitchen.yml')
223
+ def test_suite_kitchen_yml(tsd=test_suite_dir)
224
+ File.join(tsd, 'kitchen.yml')
181
225
  end
182
226
 
183
227
  def is_kitchen_generated?
@@ -194,7 +238,7 @@ module Fhcap
194
238
  end
195
239
  end
196
240
 
197
- def link_cookbook_tests(cookbooks, options, role=nil)
241
+ def link_cookbook_tests(cookbooks, options, role=nil, suite='.', type='.')
198
242
  tests_parent_dir = File.join(test_suite_dir, 'test', 'integration')
199
243
  test_helpers_dir = File.join(repo_dir(:fhcap), 'test', 'helpers')
200
244
 
@@ -205,10 +249,15 @@ module Fhcap
205
249
  cookbook_test_suite_dir = File.join(cookbook_dir, '/test/integration')
206
250
 
207
251
  if Dir.exists? cookbook_test_suite_dir
208
- Dir.entries(cookbook_test_suite_dir).select { |f| !File.directory? f }.each() do |test_suite|
252
+ #feedhenry_common/test/integration
253
+
254
+ Dir.entries(cookbook_test_suite_dir).select { |f| !File.directory? f }.select { |f| f =~ /#{suite}/ }.each() do |test_suite|
255
+ #default
209
256
 
210
257
  cookbook_test_dir = File.join(cookbook_test_suite_dir, test_suite)
211
- Dir.entries(cookbook_test_dir).select { |f| !File.directory? f }.each() do |test_type|
258
+ Dir.entries(cookbook_test_dir).select { |f| !File.directory? f }.select { |f| f =~ /#{type}/ }.each() do |test_type|
259
+ #serverspec
260
+
212
261
  tests_dir = File.join(tests_parent_dir, "#{test_suite}_#{role || cookbook}")
213
262
 
214
263
  test_type_dir = "#{tests_dir}/#{test_type}"
@@ -250,7 +299,7 @@ module Fhcap
250
299
  end
251
300
 
252
301
  def run_cmd(cmd, options)
253
- run(cmd)
302
+ run(cmd, exit_on_failure: true)
254
303
  end
255
304
 
256
305
  end
@@ -80,8 +80,6 @@ module Fhcap
80
80
  block.call
81
81
  ensure
82
82
  thor.say "[Chef Zero Server] - Syncing nodes to #{local_repo}"
83
- FileUtils.rm_rf(File.join(local_repo, 'nodes'))
84
- FileUtils.rm_rf Dir.glob(File.join(local_repo, 'data_bags/aws_*'))
85
83
  knife_download(local_repo, 'local', ['/nodes'])
86
84
  knife_download(local_repo, 'local', ['/data_bags/aws_*'])
87
85
  end
@@ -116,6 +114,7 @@ module Fhcap
116
114
  knife_command.config[:chef_repo_path] = repo
117
115
  knife_command.configure_chef
118
116
  knife_command.config[:recurse] = true
117
+ knife_command.config[:purge] = true
119
118
  knife_command.run
120
119
  end
121
120
  end
@@ -20,6 +20,7 @@ module Fhcap
20
20
 
21
21
  def provider_config(id)
22
22
  provider_type, provider_id = id.split(':')
23
+ return {} if provider_type == 'ssh'
23
24
  providers_config[provider_type.to_sym][provider_id.to_sym]
24
25
  end
25
26
 
@@ -175,7 +175,7 @@ module Fhcap
175
175
 
176
176
  def modified?(path, since='origin/master')
177
177
  stat = Dir.chdir(path) do
178
- `git diff #{since} -- #{path}`
178
+ `git diff #{since}...HEAD -- #{path}`
179
179
  end
180
180
  !stat.empty?
181
181
  end