chef-dk 3.3.23 → 3.4.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/Gemfile.lock +91 -82
  4. data/lib/chef-dk/cli.rb +13 -13
  5. data/lib/chef-dk/command/base.rb +8 -8
  6. data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
  7. data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
  8. data/lib/chef-dk/command/delete_policy.rb +9 -9
  9. data/lib/chef-dk/command/delete_policy_group.rb +9 -9
  10. data/lib/chef-dk/command/diff.rb +35 -35
  11. data/lib/chef-dk/command/export.rb +11 -11
  12. data/lib/chef-dk/command/generate.rb +3 -3
  13. data/lib/chef-dk/command/generator_commands.rb +24 -24
  14. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
  15. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
  16. data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
  17. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
  18. data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
  19. data/lib/chef-dk/command/generator_commands/template.rb +3 -3
  20. data/lib/chef-dk/command/install.rb +11 -11
  21. data/lib/chef-dk/command/provision.rb +32 -32
  22. data/lib/chef-dk/command/push.rb +9 -9
  23. data/lib/chef-dk/command/push_archive.rb +9 -9
  24. data/lib/chef-dk/command/shell_init.rb +21 -21
  25. data/lib/chef-dk/command/show_policy.rb +11 -11
  26. data/lib/chef-dk/command/undelete.rb +17 -17
  27. data/lib/chef-dk/command/update.rb +12 -12
  28. data/lib/chef-dk/command/verify.rb +63 -63
  29. data/lib/chef-dk/component_test.rb +3 -3
  30. data/lib/chef-dk/exceptions.rb +5 -5
  31. data/lib/chef-dk/generator.rb +61 -61
  32. data/lib/chef-dk/helpers.rb +1 -1
  33. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
  34. data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
  35. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
  36. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
  37. data/lib/chef-dk/policyfile/uploader.rb +4 -4
  38. data/lib/chef-dk/policyfile_compiler.rb +1 -1
  39. data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
  40. data/lib/chef-dk/policyfile_services/install.rb +3 -3
  41. data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
  42. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
  43. data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
  44. data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
  45. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
  46. data/lib/chef-dk/version.rb +1 -1
  47. data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
  48. data/omnibus_overrides.rb +1 -1
  49. data/spec/spec_helper.rb +3 -3
  50. data/spec/unit/cli_spec.rb +9 -9
  51. data/spec/unit/command/base_spec.rb +25 -25
  52. data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
  53. data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
  54. data/spec/unit/command/delete_policy_group_spec.rb +6 -6
  55. data/spec/unit/command/delete_policy_spec.rb +6 -6
  56. data/spec/unit/command/export_spec.rb +10 -10
  57. data/spec/unit/command/generate_spec.rb +5 -5
  58. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
  59. data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
  60. data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
  61. data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
  62. data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
  63. data/spec/unit/command/install_spec.rb +15 -15
  64. data/spec/unit/command/provision_spec.rb +25 -25
  65. data/spec/unit/command/push_spec.rb +12 -12
  66. data/spec/unit/command/shell_init_spec.rb +59 -59
  67. data/spec/unit/command/show_policy_spec.rb +6 -6
  68. data/spec/unit/command/undelete_spec.rb +6 -6
  69. data/spec/unit/command/update_spec.rb +30 -30
  70. data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
  71. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
  72. data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
  73. data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
  74. data/spec/unit/policyfile/differ_spec.rb +361 -361
  75. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
  76. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
  77. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
  78. data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
  79. data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
  80. data/spec/unit/policyfile/uploader_spec.rb +27 -27
  81. data/spec/unit/policyfile_demands_spec.rb +84 -84
  82. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  83. data/spec/unit/policyfile_includes_spec.rb +1 -1
  84. data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
  85. data/spec/unit/policyfile_lock_build_spec.rb +58 -58
  86. data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
  87. data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
  88. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
  89. data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
  90. data/spec/unit/policyfile_services/install_spec.rb +4 -4
  91. data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
  92. data/spec/unit/policyfile_services/push_spec.rb +38 -38
  93. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
  94. data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
  95. data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
  96. data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
  97. data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
  98. data/spec/unit/policyfile_services/update_spec.rb +7 -7
  99. data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
  100. metadata +2 -2
@@ -27,21 +27,21 @@ module ChefDK
27
27
 
28
28
  include Configurable
29
29
 
30
- banner(<<-E)
31
- Usage: chef install [ POLICY_FILE ] [options]
30
+ banner(<<~E)
31
+ Usage: chef install [ POLICY_FILE ] [options]
32
32
 
33
- `chef install` evaluates a `Policyfile.rb` to find a compatible set of
34
- cookbooks for the policy's run_list and caches them locally. It emits a
35
- Policyfile.lock.json describing the locked cookbook set. You can use the
36
- lockfile to install the locked cookbooks on another machine. You can also push
37
- the lockfile to a "policy group" on a Chef Server and apply that exact set of
38
- cookbooks to nodes in your infrastructure.
33
+ `chef install` evaluates a `Policyfile.rb` to find a compatible set of
34
+ cookbooks for the policy's run_list and caches them locally. It emits a
35
+ Policyfile.lock.json describing the locked cookbook set. You can use the
36
+ lockfile to install the locked cookbooks on another machine. You can also push
37
+ the lockfile to a "policy group" on a Chef Server and apply that exact set of
38
+ cookbooks to nodes in your infrastructure.
39
39
 
40
- See our detailed README for more information:
40
+ See our detailed README for more information:
41
41
 
42
- https://docs.chef.io/policyfile.html
42
+ https://docs.chef.io/policyfile.html
43
43
 
44
- Options:
44
+ Options:
45
45
 
46
46
  E
47
47
 
@@ -71,19 +71,19 @@ module ChefDK
71
71
  end
72
72
 
73
73
  def chef_config
74
- config = <<-CONFIG
75
- # SSL Settings:
76
- ssl_verify_mode #{Chef::Config.ssl_verify_mode.inspect}
74
+ config = <<~CONFIG
75
+ # SSL Settings:
76
+ ssl_verify_mode #{Chef::Config.ssl_verify_mode.inspect}
77
77
 
78
78
  CONFIG
79
79
  if enable_policyfile
80
- policyfile_config = <<-CONFIG
81
- # Policyfile Settings:
82
- use_policyfile true
83
- policy_document_native_api true
80
+ policyfile_config = <<~CONFIG
81
+ # Policyfile Settings:
82
+ use_policyfile true
83
+ policy_document_native_api true
84
84
 
85
- policy_group "#{policy_group}"
86
- policy_name "#{policy_name}"
85
+ policy_group "#{policy_group}"
86
+ policy_name "#{policy_name}"
87
87
 
88
88
  CONFIG
89
89
  config << policyfile_config
@@ -100,39 +100,39 @@ CONFIG
100
100
 
101
101
  class Provision < Base
102
102
 
103
- banner(<<-E)
104
- Usage: chef provision POLICY_GROUP --policy-name POLICY_NAME [options]
105
- chef provision POLICY_GROUP --sync [POLICYFILE_PATH] [options]
106
- chef provision --no-policy [options]
103
+ banner(<<~E)
104
+ Usage: chef provision POLICY_GROUP --policy-name POLICY_NAME [options]
105
+ chef provision POLICY_GROUP --sync [POLICYFILE_PATH] [options]
106
+ chef provision --no-policy [options]
107
107
 
108
- `chef provision` invokes an embedded chef-client run to provision machines
109
- using Chef Provisioning. If not otherwise specified, `chef provision` will
110
- expect to find a cookbook named 'provision' in the current working directory.
111
- It runs a recipe in this cookbook which should use Chef Provisioning to create
112
- one or more machines (or other infrastructure).
108
+ `chef provision` invokes an embedded chef-client run to provision machines
109
+ using Chef Provisioning. If not otherwise specified, `chef provision` will
110
+ expect to find a cookbook named 'provision' in the current working directory.
111
+ It runs a recipe in this cookbook which should use Chef Provisioning to create
112
+ one or more machines (or other infrastructure).
113
113
 
114
- `chef provision` provides three forms of operation:
114
+ `chef provision` provides three forms of operation:
115
115
 
116
- ### chef provision POLICY_GROUP --policy-name POLICY_NAME
116
+ ### chef provision POLICY_GROUP --policy-name POLICY_NAME
117
117
 
118
- In the first form of the command, `chef provision` creates machines that will
119
- operate in policyfile mode. The chef configuration passed to the cookbook will
120
- set the policy group and policy name as given.
118
+ In the first form of the command, `chef provision` creates machines that will
119
+ operate in policyfile mode. The chef configuration passed to the cookbook will
120
+ set the policy group and policy name as given.
121
121
 
122
- ### chef provision POLICY_GROUP --sync [POLICYFILE_PATH] [options]
122
+ ### chef provision POLICY_GROUP --sync [POLICYFILE_PATH] [options]
123
123
 
124
- In the second form of the command, `chef provision` create machines that will
125
- operate in policyfile mode and syncronizes a local policyfile to the server
126
- before converging the machine(s) defined in the provision cookbook.
124
+ In the second form of the command, `chef provision` create machines that will
125
+ operate in policyfile mode and syncronizes a local policyfile to the server
126
+ before converging the machine(s) defined in the provision cookbook.
127
127
 
128
- ### chef provision --no-policy [options]
128
+ ### chef provision --no-policy [options]
129
129
 
130
- In the third form of the command, `chef provision` expects to create machines
131
- that will not operate in policyfile mode.
130
+ In the third form of the command, `chef provision` expects to create machines
131
+ that will not operate in policyfile mode.
132
132
 
133
- Chef Provisioning is documented at https://docs.chef.io/provisioning.html
133
+ Chef Provisioning is documented at https://docs.chef.io/provisioning.html
134
134
 
135
- Options:
135
+ Options:
136
136
 
137
137
  E
138
138
  include Configurable
@@ -27,19 +27,19 @@ module ChefDK
27
27
 
28
28
  include Configurable
29
29
 
30
- banner(<<-E)
31
- Usage: chef push POLICY_GROUP [ POLICY_FILE ] [options]
30
+ banner(<<~E)
31
+ Usage: chef push POLICY_GROUP [ POLICY_FILE ] [options]
32
32
 
33
- `chef push` Uploads an existing Policyfile.lock.json to a Chef Server, along
34
- with all the cookbooks contained in the policy lock. The policy lock is applied
35
- to a specific POLICY_GROUP, which is a set of nodes that share the same
36
- run_list and cookbooks.
33
+ `chef push` Uploads an existing Policyfile.lock.json to a Chef Server, along
34
+ with all the cookbooks contained in the policy lock. The policy lock is applied
35
+ to a specific POLICY_GROUP, which is a set of nodes that share the same
36
+ run_list and cookbooks.
37
37
 
38
- See our detailed README for more information:
38
+ See our detailed README for more information:
39
39
 
40
- https://docs.chef.io/policyfile.html
40
+ https://docs.chef.io/policyfile.html
41
41
 
42
- Options:
42
+ Options:
43
43
 
44
44
  E
45
45
 
@@ -27,19 +27,19 @@ module ChefDK
27
27
 
28
28
  include Configurable
29
29
 
30
- banner(<<-E)
31
- Usage: chef push-archive POLICY_GROUP ARCHIVE_FILE [options]
30
+ banner(<<~E)
31
+ Usage: chef push-archive POLICY_GROUP ARCHIVE_FILE [options]
32
32
 
33
- `chef push-archive` publishes a policy archive to a Chef Server. Policy
34
- archives can be created with `chef export -a`. The policy will be applied to
35
- the given POLICY_GROUP, which is a set of nodes that share the same
36
- run_list and cookbooks.
33
+ `chef push-archive` publishes a policy archive to a Chef Server. Policy
34
+ archives can be created with `chef export -a`. The policy will be applied to
35
+ the given POLICY_GROUP, which is a set of nodes that share the same
36
+ run_list and cookbooks.
37
37
 
38
- For more information about Policyfiles, see our detailed README:
38
+ For more information about Policyfiles, see our detailed README:
39
39
 
40
- https://docs.chef.io/policyfile.html
40
+ https://docs.chef.io/policyfile.html
41
41
 
42
- Options:
42
+ Options:
43
43
  E
44
44
 
45
45
  option :config_file,
@@ -43,37 +43,37 @@ module ChefDK
43
43
 
44
44
  SUPPORTED_SHELLS = %w{ bash fish zsh sh powershell posh}.map(&:freeze).freeze
45
45
 
46
- banner(<<-HELP)
47
- Usage: chef shell-init
46
+ banner(<<~HELP)
47
+ Usage: chef shell-init
48
48
 
49
- `chef shell-init` modifies your shell environment to make ChefDK your default
50
- ruby.
49
+ `chef shell-init` modifies your shell environment to make ChefDK your default
50
+ ruby.
51
51
 
52
- To enable for just the current shell session:
52
+ To enable for just the current shell session:
53
53
 
54
- In sh, bash, and zsh:
55
- eval "$(chef shell-init SHELL_NAME)"
56
- In fish:
57
- eval (chef shell-init fish)
58
- In Powershell:
59
- chef shell-init powershell | Invoke-Expression
54
+ In sh, bash, and zsh:
55
+ eval "$(chef shell-init SHELL_NAME)"
56
+ In fish:
57
+ eval (chef shell-init fish)
58
+ In Powershell:
59
+ chef shell-init powershell | Invoke-Expression
60
60
 
61
- To permanently enable:
61
+ To permanently enable:
62
62
 
63
- In sh, bash, and zsh:
64
- echo 'eval "$(chef shell-init SHELL_NAME)"' >> ~/.YOUR_SHELL_RC_FILE
65
- In fish:
66
- echo 'eval (chef shell-init SHELL_NAME)' >> ~/.config/fish/config.fish
67
- In Powershell
68
- "chef shell-init powershell | Invoke-Expression" >> $PROFILE
63
+ In sh, bash, and zsh:
64
+ echo 'eval "$(chef shell-init SHELL_NAME)"' >> ~/.YOUR_SHELL_RC_FILE
65
+ In fish:
66
+ echo 'eval (chef shell-init SHELL_NAME)' >> ~/.config/fish/config.fish
67
+ In Powershell
68
+ "chef shell-init powershell | Invoke-Expression" >> $PROFILE
69
69
 
70
- OPTIONS:
70
+ OPTIONS:
71
71
 
72
72
  HELP
73
73
 
74
74
  option :omnibus_dir,
75
- :long => "--omnibus-dir OMNIBUS_DIR",
76
- :description => "Alternate path to omnibus install (used for testing)"
75
+ long: "--omnibus-dir OMNIBUS_DIR",
76
+ description: "Alternate path to omnibus install (used for testing)"
77
77
 
78
78
  def initialize
79
79
  super
@@ -26,22 +26,22 @@ module ChefDK
26
26
 
27
27
  class ShowPolicy < Base
28
28
 
29
- banner(<<-BANNER)
30
- Usage: chef show-policy [POLICY_NAME [POLICY_GROUP]] [options]
29
+ banner(<<~BANNER)
30
+ Usage: chef show-policy [POLICY_NAME [POLICY_GROUP]] [options]
31
31
 
32
- `chef show-policy` Displays the revisions of policyfiles on the server. By
33
- default, only active policy revisions are shown. Use the `--orphans` options to
34
- show policy revisions that are not assigned to any policy group.
32
+ `chef show-policy` Displays the revisions of policyfiles on the server. By
33
+ default, only active policy revisions are shown. Use the `--orphans` options to
34
+ show policy revisions that are not assigned to any policy group.
35
35
 
36
- When both POLICY_NAME and POLICY_GROUP are given, the command shows the content
37
- of a the active policyfile lock for the given POLICY_GROUP. See also the `diff`
38
- command.
36
+ When both POLICY_NAME and POLICY_GROUP are given, the command shows the content
37
+ of a the active policyfile lock for the given POLICY_GROUP. See also the `diff`
38
+ command.
39
39
 
40
- See our detailed README for more information:
40
+ See our detailed README for more information:
41
41
 
42
- https://docs.chef.io/policyfile.html
42
+ https://docs.chef.io/policyfile.html
43
43
 
44
- Options:
44
+ Options:
45
45
 
46
46
  BANNER
47
47
 
@@ -25,30 +25,30 @@ module ChefDK
25
25
 
26
26
  class Undelete < Base
27
27
 
28
- banner(<<-BANNER)
29
- Usage: chef undelete [--list | --id ID] [options]
28
+ banner(<<~BANNER)
29
+ Usage: chef undelete [--list | --id ID] [options]
30
30
 
31
- `chef undelete` helps you recover quickly if you've deleted a policy or policy
32
- group in error. When run with no arguements, it lists the available undo
33
- operations. To undo the last delete operation, use `chef undelete --last`.
31
+ `chef undelete` helps you recover quickly if you've deleted a policy or policy
32
+ group in error. When run with no arguements, it lists the available undo
33
+ operations. To undo the last delete operation, use `chef undelete --last`.
34
34
 
35
- CAVEATS:
36
- `chef undelete` doesn't detect conflicts. If a deleted item has been recreated,
37
- running `chef undelete` will overwrite it.
35
+ CAVEATS:
36
+ `chef undelete` doesn't detect conflicts. If a deleted item has been recreated,
37
+ running `chef undelete` will overwrite it.
38
38
 
39
- Undo information does not include cookbooks that might be referenced by
40
- policies. If you have cleaned the policy cookbooks after the delete operation
41
- you want to reverse, `chef undelete` may not be able to fully restore the
42
- previous state.
39
+ Undo information does not include cookbooks that might be referenced by
40
+ policies. If you have cleaned the policy cookbooks after the delete operation
41
+ you want to reverse, `chef undelete` may not be able to fully restore the
42
+ previous state.
43
43
 
44
- The delete commands also do not store access control data, so you may have to
45
- manually reapply any ACL customizations you have made.
44
+ The delete commands also do not store access control data, so you may have to
45
+ manually reapply any ACL customizations you have made.
46
46
 
47
- See our detailed README for more information:
47
+ See our detailed README for more information:
48
48
 
49
- https://docs.chef.io/policyfile.html
49
+ https://docs.chef.io/policyfile.html
50
50
 
51
- Options:
51
+ Options:
52
52
 
53
53
  BANNER
54
54
 
@@ -28,23 +28,23 @@ module ChefDK
28
28
 
29
29
  include Configurable
30
30
 
31
- banner(<<-BANNER)
32
- Usage: chef update [ POLICY_FILE ] [options] [cookbook_1] [...]
31
+ banner(<<~BANNER)
32
+ Usage: chef update [ POLICY_FILE ] [options] [cookbook_1] [...]
33
33
 
34
- `chef update` reads your `Policyfile.rb`, applies any changes, re-solves the
35
- dependencies and emits an updated `Policyfile.lock.json`. The new locked policy
36
- will reflect any changes to the `run_list` and pull in any cookbook updates
37
- that are compatible with the version constraints stated in your `Policyfile.rb`.
34
+ `chef update` reads your `Policyfile.rb`, applies any changes, re-solves the
35
+ dependencies and emits an updated `Policyfile.lock.json`. The new locked policy
36
+ will reflect any changes to the `run_list` and pull in any cookbook updates
37
+ that are compatible with the version constraints stated in your `Policyfile.rb`.
38
38
 
39
- Individual dependent cookbooks (and their dependencies) may be updated by
40
- passing their names after the POLICY_FILE. The POLICY_FILE parameter is
41
- mandatory if you want to update individual cookbooks.
39
+ Individual dependent cookbooks (and their dependencies) may be updated by
40
+ passing their names after the POLICY_FILE. The POLICY_FILE parameter is
41
+ mandatory if you want to update individual cookbooks.
42
42
 
43
- See our detailed README for more information:
43
+ See our detailed README for more information:
44
44
 
45
- https://docs.chef.io/policyfile.html
45
+ https://docs.chef.io/policyfile.html
46
46
 
47
- Options:
47
+ Options:
48
48
 
49
49
  BANNER
50
50
 
@@ -28,25 +28,25 @@ module ChefDK
28
28
  banner "Usage: chef verify [component, ...] [options]"
29
29
 
30
30
  option :omnibus_dir,
31
- :long => "--omnibus-dir OMNIBUS_DIR",
32
- :description => "Alternate path to omnibus install (used for testing)"
31
+ long: "--omnibus-dir OMNIBUS_DIR",
32
+ description: "Alternate path to omnibus install (used for testing)"
33
33
 
34
34
  option :unit,
35
- :long => "--unit",
36
- :description => "Run bundled app unit tests (only smoke tests run by default)"
35
+ long: "--unit",
36
+ description: "Run bundled app unit tests (only smoke tests run by default)"
37
37
 
38
38
  option :integration,
39
- :long => "--integration",
40
- :description => "Run integration tests. Possibly dangerous, for development systems only"
39
+ long: "--integration",
40
+ description: "Run integration tests. Possibly dangerous, for development systems only"
41
41
 
42
42
  option :verbose,
43
- :long => "--verbose",
44
- :description => "Display all test output, not just failing tests"
43
+ long: "--verbose",
44
+ description: "Display all test output, not just failing tests"
45
45
 
46
46
  class << self
47
47
  def add_component(name, _delete_me = nil)
48
48
  component = ComponentTest.new(name)
49
- yield component if block_given? #delete this conditional
49
+ yield component if block_given? # delete this conditional
50
50
  component_map[name] = component
51
51
  end
52
52
 
@@ -124,25 +124,25 @@ module ChefDK
124
124
  c.smoke_test do
125
125
  tmpdir do |cwd|
126
126
  File.open(File.join(cwd, ".kitchen.yml"), "w+") do |f|
127
- f.print(<<-KITCHEN_YML)
128
- ---
129
- driver:
130
- name: dummy
131
- network:
132
- - ["forwarded_port", {guest: 80, host: 8080}]
133
-
134
- provisioner:
135
- name: policyfile_zero
136
- require_chef_omnibus: 12.3.0
137
-
138
- platforms:
139
- - name: ubuntu-14.04
140
-
141
- suites:
142
- - name: default
143
- run_list:
144
- - recipe[aar::default]
145
- attributes:
127
+ f.print(<<~KITCHEN_YML)
128
+ ---
129
+ driver:
130
+ name: dummy
131
+ network:
132
+ - ["forwarded_port", {guest: 80, host: 8080}]
133
+
134
+ provisioner:
135
+ name: policyfile_zero
136
+ require_chef_omnibus: 12.3.0
137
+
138
+ platforms:
139
+ - name: ubuntu-14.04
140
+
141
+ suites:
142
+ - name: default
143
+ run_list:
144
+ - recipe[aar::default]
145
+ attributes:
146
146
 
147
147
  KITCHEN_YML
148
148
  end
@@ -186,10 +186,10 @@ KITCHEN_YML
186
186
 
187
187
  add_component "chef-apply" do |c|
188
188
  c.gem_base_dir = "chef-apply"
189
- c.unit_test do
190
- bundle_install_mutex.synchronize { sh("#{embedded_bin("bundle")} install") }
191
- sh("#{embedded_bin("bundle")} exec rspec")
192
- end
189
+ # c.unit_test do
190
+ # bundle_install_mutex.synchronize { sh("#{embedded_bin("bundle")} install") }
191
+ # sh("#{embedded_bin("bundle")} exec rspec")
192
+ # end
193
193
  c.smoke_test { sh("#{bin("chef-run")} -v") }
194
194
  end
195
195
 
@@ -206,13 +206,13 @@ KITCHEN_YML
206
206
 
207
207
  # construct a hash of { driver_name => [version1, version2, ...]}
208
208
  driver_versions = {}
209
- Gem::Specification.all.map { |gs| [gs.name, gs.version] }.
210
- select { |n| n[0] =~ /^chef-provisioning-/ }.
211
- each { |gem, version| (driver_versions[gem] ||= []) << version }
209
+ Gem::Specification.all.map { |gs| [gs.name, gs.version] }
210
+ .select { |n| n[0] =~ /^chef-provisioning-/ }
211
+ .each { |gem, version| (driver_versions[gem] ||= []) << version }
212
212
 
213
- drivers = Gem::Specification.all.map { |gs| gs.name }.
214
- select { |n| n =~ /^chef-provisioning-/ }.
215
- uniq
213
+ drivers = Gem::Specification.all.map { |gs| gs.name }
214
+ .select { |n| n =~ /^chef-provisioning-/ }
215
+ .uniq
216
216
 
217
217
  versions = Gem::Specification.find_all_by_name("chef-provisioning").map { |s| s.version }
218
218
  $VERBOSE = verbose
@@ -222,9 +222,9 @@ KITCHEN_YML
222
222
  # ------------
223
223
  # fail the verify if we have more than one version of chef-provisioning or any of its drivers.
224
224
  def format_gem_failure(name, versions)
225
- <<-EOS
226
- #{name} has multiple versions installed:
227
- #{versions.sort.map { |gv| " #{gv}" }.join("\n")}
225
+ <<~EOS
226
+ #{name} has multiple versions installed:
227
+ #{versions.sort.map { |gv| " #{gv}" }.join("\n")}
228
228
  EOS
229
229
  end
230
230
 
@@ -236,10 +236,10 @@ KITCHEN_YML
236
236
  end
237
237
 
238
238
  if failures.size > 0
239
- failures << <<-EOS
239
+ failures << <<~EOS
240
240
 
241
- Some applications may need or prefer different versions of the chef-provisioning gem or its drivers, so
242
- this multiple-version check can fail if a user has installed new versions of those libraries.
241
+ Some applications may need or prefer different versions of the chef-provisioning gem or its drivers, so
242
+ this multiple-version check can fail if a user has installed new versions of those libraries.
243
243
  EOS
244
244
  end
245
245
 
@@ -300,20 +300,20 @@ EOS
300
300
  tmpdir do |cwd|
301
301
  FileUtils.mkdir(File.join(cwd, "spec"))
302
302
  with_file(File.join(cwd, "spec", "spec_helper.rb")) do |f|
303
- f.write <<-EOF
304
- require 'chefspec'
305
- require 'chefspec/berkshelf'
306
- require 'chefspec/cacher'
303
+ f.write <<~EOF
304
+ require 'chefspec'
305
+ require 'chefspec/berkshelf'
306
+ require 'chefspec/cacher'
307
307
 
308
- RSpec.configure do |config|
309
- config.expect_with(:rspec) { |c| c.syntax = :expect }
310
- end
308
+ RSpec.configure do |config|
309
+ config.expect_with(:rspec) { |c| c.syntax = :expect }
310
+ end
311
311
  EOF
312
312
  end
313
313
  FileUtils.touch(File.join(cwd, "Berksfile"))
314
314
  with_file(File.join(cwd, "spec", "foo_spec.rb")) do |f|
315
- f.write <<-EOF
316
- require 'spec_helper'
315
+ f.write <<~EOF
316
+ require 'spec_helper'
317
317
  EOF
318
318
  end
319
319
  sh(embedded_bin("rspec"), cwd: cwd)
@@ -418,9 +418,9 @@ require 'spec_helper'
418
418
 
419
419
  # Commenting out the unit and integration tests for now until we figure
420
420
  # out the bundler error
421
- #c.unit_test { sh("#{embedded_bin("bundle")} exec rake test:isolated") }
421
+ # c.unit_test { sh("#{embedded_bin("bundle")} exec rake test:isolated") }
422
422
  # This runs Test Kitchen (using kitchen-inspec) with some inspec tests
423
- #c.integration_test { sh("#{embedded_bin("bundle")} exec rake test:vm") }
423
+ # c.integration_test { sh("#{embedded_bin("bundle")} exec rake test:vm") }
424
424
 
425
425
  # It would be nice to use a chef generator to create these specs, but
426
426
  # we dont have that yet. So we do it manually.
@@ -513,11 +513,11 @@ require 'spec_helper'
513
513
  c.smoke_test do
514
514
  tmpdir do |cwd|
515
515
  with_file(File.join(cwd, "foo.rb")) do |f|
516
- f.write <<-EOF
517
- require 'chef/sugar'
518
- log 'something' do
519
- not_if { _64_bit? }
520
- end
516
+ f.write <<~EOF
517
+ require 'chef/sugar'
518
+ log 'something' do
519
+ not_if { _64_bit? }
520
+ end
521
521
  EOF
522
522
  end
523
523
  sh("chef-apply foo.rb", cwd: cwd)
@@ -594,9 +594,9 @@ end
594
594
  end
595
595
 
596
596
  {
597
- :component => component,
598
- :results => results,
599
- :component_status => component_status,
597
+ component: component,
598
+ results: results,
599
+ component_status: component_status,
600
600
  }
601
601
  end
602
602