inspec 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (368) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/CHANGELOG.md +23 -2
  4. data/Gemfile +1 -1
  5. data/Rakefile +15 -1
  6. data/docs/resources.rst +1 -1
  7. data/examples/profile/controls/gordon.rb +1 -1
  8. data/examples/resource/controls/tiny.rb +3 -0
  9. data/examples/resource/inspec.yml +10 -0
  10. data/examples/resource/libraries/tiny.rb +3 -0
  11. data/lib/inspec/dsl.rb +17 -17
  12. data/lib/inspec/metadata.rb +3 -8
  13. data/lib/inspec/plugins/resource.rb +1 -1
  14. data/lib/inspec/profile.rb +3 -2
  15. data/lib/inspec/profile_context.rb +2 -2
  16. data/lib/inspec/rule.rb +7 -7
  17. data/lib/inspec/shell.rb +5 -8
  18. data/lib/inspec/targets/dir.rb +1 -1
  19. data/lib/inspec/targets/tar.rb +3 -6
  20. data/lib/inspec/targets/url.rb +15 -9
  21. data/lib/inspec/targets/url.rb.orig +87 -0
  22. data/lib/inspec/version.rb +1 -1
  23. data/lib/matchers/matchers.rb +1 -1
  24. data/lib/resources/audit_policy.rb +1 -1
  25. data/lib/resources/command.rb +3 -3
  26. data/lib/resources/etc_group.rb +1 -1
  27. data/lib/resources/file.rb +4 -3
  28. data/lib/resources/group.rb +14 -18
  29. data/lib/resources/iptables.rb +1 -1
  30. data/lib/resources/json.rb +4 -6
  31. data/lib/resources/kernel_parameter.rb +1 -1
  32. data/lib/resources/os.rb +1 -1
  33. data/lib/resources/package.rb +20 -2
  34. data/lib/resources/passwd.rb +1 -1
  35. data/lib/resources/port.rb +112 -42
  36. data/lib/resources/postgres_conf.rb +1 -1
  37. data/lib/resources/postgres_session.rb +2 -2
  38. data/lib/resources/registry_key.rb +2 -1
  39. data/lib/resources/security_policy.rb +2 -2
  40. data/lib/resources/service.rb +50 -1
  41. data/lib/resources/user.rb +45 -0
  42. data/lib/resources/yum.rb +2 -2
  43. data/lib/utils/convert.rb +1 -1
  44. data/lib/utils/find_files.rb +3 -3
  45. data/lib/utils/parser.rb +2 -2
  46. data/tasks/maintainers.rb +6 -6
  47. data/test/helper.rb +4 -2
  48. data/test/integration/cookbooks/os_prepare/recipes/file.rb +9 -2
  49. data/test/integration/cookbooks/os_prepare/recipes/json_yaml_csv_ini.rb +8 -2
  50. data/test/integration/test/integration/default/etc_group_spec.rb +22 -0
  51. data/test/integration/test/integration/default/file_spec.rb +10 -1
  52. data/test/integration/test/integration/default/group_spec.rb +17 -0
  53. data/test/integration/test/integration/default/package_spec.rb +10 -4
  54. data/test/integration/test/integration/default/port_spec.rb +6 -0
  55. data/test/integration/test/integration/default/service_spec.rb +3 -0
  56. data/test/integration/test/integration/default/user_spec.rb +26 -16
  57. data/test/unit/metadata_test.rb +24 -0
  58. data/test/unit/mock/cmd/lsof-nP-i-FpctPn +63 -0
  59. data/test/unit/mock/cmd/netstat-tulpen +1 -0
  60. data/test/unit/mock/cmd/systemctl-show-all-sshd +1 -1
  61. data/test/unit/mock/profiles/complete-meta/metadata.rb +1 -1
  62. data/test/unit/mock/profiles/custom-resource/libraries/resource.rb +3 -0
  63. data/test/unit/mock/profiles/custom-resource/metadata.rb +7 -0
  64. data/{examples/kitchen-ansible/.kitchen/logs/default-centos-71.log → test/unit/mock/profiles/custom-resource/test/.gitkeep} +0 -0
  65. data/test/unit/profile_test.rb +6 -2
  66. data/test/unit/resources/port_test.rb +8 -0
  67. data/test/unit/targets.rb +132 -0
  68. metadata +19 -551
  69. data/bin/os +0 -23
  70. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +0 -0
  71. data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +0 -432
  72. data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +0 -10
  73. data/examples/kitchen-ansible/Gemfile.lock +0 -154
  74. data/examples/kitchen-chef/.kitchen/default-centos-71.yml +0 -6
  75. data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +0 -6
  76. data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +0 -6
  77. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  78. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  79. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
  80. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  81. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
  82. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  83. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +0 -9
  84. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  85. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  86. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
  87. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  88. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
  89. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  90. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +0 -9
  91. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  92. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  93. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  94. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  95. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  96. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  97. data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +0 -9
  98. data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +0 -4
  99. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +0 -4
  100. data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +0 -4
  101. data/examples/kitchen-chef/.kitchen/logs/kitchen.log +0 -8
  102. data/examples/kitchen-chef/Berksfile.lock +0 -11
  103. data/examples/kitchen-chef/Gemfile.lock +0 -223
  104. data/examples/kitchen-puppet/.bundle/config +0 -2
  105. data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +0 -0
  106. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +0 -0
  107. data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +0 -306
  108. data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +0 -10
  109. data/examples/kitchen-puppet/.librarian/puppet/config +0 -2
  110. data/examples/kitchen-puppet/Gemfile.lock +0 -174
  111. data/examples/kitchen-puppet/Puppetfile.lock +0 -2
  112. data/examples/profile/libraries/.DS_Store +0 -0
  113. data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +0 -5
  114. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +0 -5
  115. data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +0 -5
  116. data/examples/test-kitchen/.kitchen/logs/kitchen.log +0 -5
  117. data/examples/test-kitchen/Berksfile.lock +0 -11
  118. data/examples/test-kitchen/Gemfile.lock +0 -233
  119. data/lib/.DS_Store +0 -0
  120. data/lib/resources/certificate.rb +0 -0
  121. data/lib/resources/private_key.rb +0 -0
  122. data/test/chefdk/.gitignore +0 -16
  123. data/test/chefdk/.kitchen.yml +0 -27
  124. data/test/chefdk/Policyfile.rb +0 -16
  125. data/test/chefdk/README.md +0 -4
  126. data/test/chefdk/chefignore +0 -100
  127. data/test/chefdk/metadata.rb +0 -7
  128. data/test/chefdk/recipes/default.rb +0 -5
  129. data/test/chefdk/spec/spec_helper.rb +0 -2
  130. data/test/chefdk/spec/unit/recipes/default_spec.rb +0 -20
  131. data/test/chefdk/test/integration/default/serverspec/default_spec.rb +0 -9
  132. data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +0 -8
  133. data/test/integration/.DS_Store +0 -0
  134. data/test/integration/.kitchen.local.yml +0 -68
  135. data/test/integration/.kitchen/default-aws-linux.yml +0 -4
  136. data/test/integration/.kitchen/default-centos-511.yml +0 -6
  137. data/test/integration/.kitchen/default-centos-67.yml +0 -6
  138. data/test/integration/.kitchen/default-centos-7.yml +0 -4
  139. data/test/integration/.kitchen/default-centos-71.yml +0 -6
  140. data/test/integration/.kitchen/default-debian-6010.yml +0 -6
  141. data/test/integration/.kitchen/default-debian-78.yml +0 -6
  142. data/test/integration/.kitchen/default-debian-8.yml +0 -4
  143. data/test/integration/.kitchen/default-debian-81.yml +0 -6
  144. data/test/integration/.kitchen/default-fedora-21.yml +0 -6
  145. data/test/integration/.kitchen/default-fedora-22.yml +0 -4
  146. data/test/integration/.kitchen/default-freebsd-102.yml +0 -6
  147. data/test/integration/.kitchen/default-freebsd-93.yml +0 -6
  148. data/test/integration/.kitchen/default-opensuse-132-x86-64.yml +0 -6
  149. data/test/integration/.kitchen/default-redhat-65.yml +0 -4
  150. data/test/integration/.kitchen/default-redhat-71.yml +0 -4
  151. data/test/integration/.kitchen/default-suse-11sp3.yml +0 -4
  152. data/test/integration/.kitchen/default-suse-12.yml +0 -4
  153. data/test/integration/.kitchen/default-ubuntu-1004.yml +0 -6
  154. data/test/integration/.kitchen/default-ubuntu-1204.yml +0 -4
  155. data/test/integration/.kitchen/default-ubuntu-1404.yml +0 -4
  156. data/test/integration/.kitchen/default-ubuntu-1510.yml +0 -4
  157. data/test/integration/.kitchen/default-windows-2012.yml +0 -5
  158. data/test/integration/.kitchen/default-windows-2012r2.yml +0 -6
  159. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  160. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  161. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/id +0 -1
  162. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  163. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/private_key +0 -27
  164. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  165. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-511/Vagrantfile +0 -9
  166. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +0 -9
  167. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  168. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  169. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/id +0 -1
  170. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  171. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/private_key +0 -27
  172. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  173. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67/Vagrantfile +0 -9
  174. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  175. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  176. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/id +0 -1
  177. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  178. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/private_key +0 -27
  179. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  180. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-71/Vagrantfile +0 -9
  181. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  182. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  183. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/id +0 -1
  184. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  185. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/private_key +0 -27
  186. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  187. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-6010/Vagrantfile +0 -9
  188. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  189. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  190. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/id +0 -1
  191. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  192. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/private_key +0 -27
  193. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  194. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-78/Vagrantfile +0 -9
  195. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  196. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  197. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/id +0 -1
  198. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  199. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/private_key +0 -27
  200. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  201. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-debian-81/Vagrantfile +0 -9
  202. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  203. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  204. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/id +0 -1
  205. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  206. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/private_key +0 -27
  207. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  208. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-21/Vagrantfile +0 -9
  209. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  210. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  211. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +0 -1
  212. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  213. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +0 -27
  214. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  215. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +0 -9
  216. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  217. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  218. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/id +0 -1
  219. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  220. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/private_key +0 -27
  221. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  222. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-102/Vagrantfile +0 -9
  223. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  224. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  225. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/id +0 -1
  226. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  227. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/private_key +0 -27
  228. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  229. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-freebsd-93/Vagrantfile +0 -9
  230. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  231. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  232. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/id +0 -1
  233. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  234. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/private_key +0 -27
  235. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  236. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-opensuse-132-x86-64/Vagrantfile +0 -9
  237. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  238. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  239. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/id +0 -1
  240. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  241. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/private_key +0 -27
  242. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  243. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1004/Vagrantfile +0 -9
  244. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  245. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  246. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +0 -1
  247. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  248. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +0 -27
  249. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  250. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +0 -9
  251. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  252. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  253. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  254. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  255. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  256. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  257. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +0 -9
  258. data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +0 -9
  259. data/test/integration/.kitchen/logs/default-aws-linux.log +0 -0
  260. data/test/integration/.kitchen/logs/default-centos-511-i386.log +0 -0
  261. data/test/integration/.kitchen/logs/default-centos-511.log +0 -0
  262. data/test/integration/.kitchen/logs/default-centos-67-i386.log +0 -0
  263. data/test/integration/.kitchen/logs/default-centos-67.log +0 -0
  264. data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
  265. data/test/integration/.kitchen/logs/default-centos-71.log +0 -0
  266. data/test/integration/.kitchen/logs/default-debian-6010-i386.log +0 -0
  267. data/test/integration/.kitchen/logs/default-debian-6010.log +0 -0
  268. data/test/integration/.kitchen/logs/default-debian-78-i386.log +0 -0
  269. data/test/integration/.kitchen/logs/default-debian-78.log +0 -0
  270. data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
  271. data/test/integration/.kitchen/logs/default-debian-81-i386.log +0 -0
  272. data/test/integration/.kitchen/logs/default-debian-81.log +0 -0
  273. data/test/integration/.kitchen/logs/default-fedora-21-i386.log +0 -0
  274. data/test/integration/.kitchen/logs/default-fedora-21.log +0 -0
  275. data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
  276. data/test/integration/.kitchen/logs/default-freebsd-102.log +0 -0
  277. data/test/integration/.kitchen/logs/default-freebsd-93.log +0 -0
  278. data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +0 -0
  279. data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +0 -0
  280. data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +0 -0
  281. data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
  282. data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
  283. data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
  284. data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
  285. data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +0 -0
  286. data/test/integration/.kitchen/logs/default-ubuntu-1004.log +0 -0
  287. data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +0 -0
  288. data/test/integration/.kitchen/logs/default-ubuntu-1204.log +0 -23
  289. data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +0 -0
  290. data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
  291. data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
  292. data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
  293. data/test/integration/.kitchen/logs/default-windows-2012r2.log +0 -0
  294. data/test/integration/.kitchen/logs/kitchen.log +0 -3
  295. data/test/integration/.kitchen/logs/new-centos-511-i386.log +0 -0
  296. data/test/integration/.kitchen/logs/new-centos-511.log +0 -0
  297. data/test/integration/.kitchen/logs/new-centos-67-i386.log +0 -0
  298. data/test/integration/.kitchen/logs/new-centos-67.log +0 -0
  299. data/test/integration/.kitchen/logs/new-centos-71.log +0 -0
  300. data/test/integration/.kitchen/logs/new-debian-6010-i386.log +0 -0
  301. data/test/integration/.kitchen/logs/new-debian-6010.log +0 -0
  302. data/test/integration/.kitchen/logs/new-debian-78-i386.log +0 -0
  303. data/test/integration/.kitchen/logs/new-debian-78.log +0 -0
  304. data/test/integration/.kitchen/logs/new-debian-81-i386.log +0 -0
  305. data/test/integration/.kitchen/logs/new-debian-81.log +0 -0
  306. data/test/integration/.kitchen/logs/new-fedora-21-i386.log +0 -0
  307. data/test/integration/.kitchen/logs/new-fedora-21.log +0 -0
  308. data/test/integration/.kitchen/logs/new-fedora-22.log +0 -0
  309. data/test/integration/.kitchen/logs/new-freebsd-102.log +0 -0
  310. data/test/integration/.kitchen/logs/new-freebsd-93.log +0 -0
  311. data/test/integration/.kitchen/logs/new-opensuse-132-i386.log +0 -0
  312. data/test/integration/.kitchen/logs/new-opensuse-132-x86-64.log +0 -0
  313. data/test/integration/.kitchen/logs/new-ubuntu-1004-i386.log +0 -0
  314. data/test/integration/.kitchen/logs/new-ubuntu-1004.log +0 -0
  315. data/test/integration/.kitchen/logs/new-ubuntu-1204-i386.log +0 -0
  316. data/test/integration/.kitchen/logs/new-ubuntu-1204.log +0 -0
  317. data/test/integration/.kitchen/logs/new-ubuntu-1404-i386.log +0 -0
  318. data/test/integration/.kitchen/logs/new-ubuntu-1404.log +0 -3
  319. data/test/integration/.kitchen/logs/test-centos-511-i386.log +0 -0
  320. data/test/integration/.kitchen/logs/test-centos-511.log +0 -0
  321. data/test/integration/.kitchen/logs/test-centos-67-i386.log +0 -0
  322. data/test/integration/.kitchen/logs/test-centos-67.log +0 -0
  323. data/test/integration/.kitchen/logs/test-centos-71.log +0 -0
  324. data/test/integration/.kitchen/logs/test-debian-6010-i386.log +0 -0
  325. data/test/integration/.kitchen/logs/test-debian-6010.log +0 -0
  326. data/test/integration/.kitchen/logs/test-debian-78-i386.log +0 -0
  327. data/test/integration/.kitchen/logs/test-debian-78.log +0 -0
  328. data/test/integration/.kitchen/logs/test-debian-81-i386.log +0 -0
  329. data/test/integration/.kitchen/logs/test-debian-81.log +0 -0
  330. data/test/integration/.kitchen/logs/test-fedora-21-i386.log +0 -0
  331. data/test/integration/.kitchen/logs/test-fedora-21.log +0 -0
  332. data/test/integration/.kitchen/logs/test-fedora-22.log +0 -0
  333. data/test/integration/.kitchen/logs/test-freebsd-102.log +0 -0
  334. data/test/integration/.kitchen/logs/test-freebsd-93.log +0 -0
  335. data/test/integration/.kitchen/logs/test-opensuse-132-i386.log +0 -0
  336. data/test/integration/.kitchen/logs/test-opensuse-132-x86-64.log +0 -0
  337. data/test/integration/.kitchen/logs/test-ubuntu-1004-i386.log +0 -0
  338. data/test/integration/.kitchen/logs/test-ubuntu-1004.log +0 -0
  339. data/test/integration/.kitchen/logs/test-ubuntu-1204-i386.log +0 -0
  340. data/test/integration/.kitchen/logs/test-ubuntu-1204.log +0 -0
  341. data/test/integration/.kitchen/logs/test-ubuntu-1404-i386.log +0 -0
  342. data/test/integration/.kitchen/logs/test-ubuntu-1404.log +0 -0
  343. data/test/integration/.kitchen/new-ubuntu-1404.yml +0 -1
  344. data/test/integration/Berksfile.lock +0 -11
  345. data/test/integration/TODO.md +0 -15
  346. data/test/integration/test/.DS_Store +0 -0
  347. data/test/integration/test/integration/.DS_Store +0 -0
  348. data/test/integration/test/integration/default/.DS_Store +0 -0
  349. data/test/integration/test/integration/default/certificate_spec.rb +0 -7
  350. data/test/integration/test/integration/default/etc_group.rb +0 -13
  351. data/test/serverspec/.kitchen.yml +0 -18
  352. data/test/serverspec/.kitchen/default-ubuntu-1404.yml +0 -6
  353. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +0 -1
  354. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +0 -1
  355. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +0 -1
  356. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +0 -1
  357. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +0 -27
  358. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +0 -1
  359. data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +0 -9
  360. data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +0 -2
  361. data/test/serverspec/.kitchen/logs/kitchen.log +0 -3
  362. data/test/serverspec/Berksfile +0 -3
  363. data/test/serverspec/Berksfile.lock +0 -5
  364. data/test/serverspec/TODO.md +0 -2
  365. data/test/serverspec/test/integration/default/serverspec/os_spec.rb +0 -25
  366. data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +0 -48
  367. data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +0 -37
  368. data/test/unit/mock/cmd/lsof-np-itcp +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05af717dedcf5fea001060356a73c799927a3ac5
4
- data.tar.gz: 5fb4a23de7019a3f89d806737758e61ae8dace4c
3
+ metadata.gz: ec38b70d89c495843d834ff8825ed447419a29fd
4
+ data.tar.gz: 2d3ef5b473cef4c2c2beb2dfd299e8a964b599bb
5
5
  SHA512:
6
- metadata.gz: f0da77acc1e683f4cef31cb497eecba9052e854555357f030e631e9749ad030bfdca6adf26ef5f1501b1d3789aae1377b6a416833ffc9c7c6baa2e074aae6ecf
7
- data.tar.gz: 4523247eeb675b640da571394253bd47f7f396a1a500140a280b394fa44472ea7a1b60ef0abfd7a1cb66490bbf15596e1cc104bacbc56b5e433dcd2689251825
6
+ metadata.gz: 26e4ecc01b3091ef0918a2733d73c455b708de5a34dbc3bb869bb9563bfe4f3360becb2bc80c7c7b331eb57db22223af0d5430f012dd829da1add361643d9266
7
+ data.tar.gz: 045c295e95f3377e15796011d42fdc3c5b9d82b32073d1476b981cfc0c14d255ac236742e4cf5124e5e134d99f0a87a1bffb453338400337095846e9e4b867e0
@@ -45,13 +45,17 @@ Style/PredicateName:
45
45
  Enabled: false
46
46
  Style/ClassAndModuleChildren:
47
47
  Enabled: false
48
+ Style/ConditionalAssignment:
49
+ Enabled: false
48
50
  Style/BracesAroundHashParameters:
49
51
  Enabled: false
50
52
  Style/AndOr:
51
53
  Enabled: false
52
54
  Style/Not:
53
55
  Enabled: false
54
- Style/TrailingComma:
56
+ Style/TrailingCommaInLiteral:
57
+ EnforcedStyleForMultiline: comma
58
+ Style/TrailingCommaInArguments:
55
59
  EnforcedStyleForMultiline: comma
56
60
  Style/NegatedIf:
57
61
  Enabled: false
@@ -1,7 +1,27 @@
1
1
  # Change Log
2
2
 
3
- ## [0.9.8](https://github.com/chef/inspec/tree/0.9.8) (2016-01-11)
4
- [Full Changelog](https://github.com/chef/inspec/compare/v0.9.7...0.9.8)
3
+ ## [0.9.9](https://github.com/chef/inspec/tree/0.9.9) (2016-01-15)
4
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.9.8...0.9.9)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Resource registry\_key { should\_not exist } unavailable [\#322](https://github.com/chef/inspec/issues/322)
9
+ - bugfix: only skip regkey if required [\#364](https://github.com/chef/inspec/pull/364) ([chris-rock](https://github.com/chris-rock))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - add tests for loading metadata yaml internals [\#368](https://github.com/chef/inspec/pull/368) ([arlimus](https://github.com/arlimus))
14
+ - make metadata.rb legacy mode consistent for supports [\#367](https://github.com/chef/inspec/pull/367) ([arlimus](https://github.com/arlimus))
15
+ - lint with rubocop 0.36 [\#366](https://github.com/chef/inspec/pull/366) ([arlimus](https://github.com/arlimus))
16
+ - Fix ssh\_config example [\#365](https://github.com/chef/inspec/pull/365) ([tas50](https://github.com/tas50))
17
+ - Correctly detect UDP ports on linux [\#363](https://github.com/chef/inspec/pull/363) ([mivok](https://github.com/mivok))
18
+ - Update the title of the gordon-1.0 control [\#359](https://github.com/chef/inspec/pull/359) ([chris-rock](https://github.com/chris-rock))
19
+ - Inspec::Targets::UrlHelper: fix github handling, add tests [\#357](https://github.com/chef/inspec/pull/357) ([srenatus](https://github.com/srenatus))
20
+ - Fix systemd service enabled check [\#356](https://github.com/chef/inspec/pull/356) ([jmccann](https://github.com/jmccann))
21
+ - Adding AIX classes, tests, and targetted ssh testing [\#333](https://github.com/chef/inspec/pull/333) ([foobarbam](https://github.com/foobarbam))
22
+
23
+ ## [v0.9.8](https://github.com/chef/inspec/tree/v0.9.8) (2016-01-11)
24
+ [Full Changelog](https://github.com/chef/inspec/compare/v0.9.7...v0.9.8)
5
25
 
6
26
  **Implemented enhancements:**
7
27
 
@@ -29,6 +49,7 @@
29
49
  **Merged pull requests:**
30
50
 
31
51
  - fix reading profiles bug [\#352](https://github.com/chef/inspec/pull/352) ([srenatus](https://github.com/srenatus))
52
+ - 0.9.8 [\#350](https://github.com/chef/inspec/pull/350) ([chris-rock](https://github.com/chris-rock))
32
53
  - clarify how to bump version in rake [\#348](https://github.com/chef/inspec/pull/348) ([arlimus](https://github.com/arlimus))
33
54
  - Add `supports` to metadata to specify supported systems [\#344](https://github.com/chef/inspec/pull/344) ([arlimus](https://github.com/arlimus))
34
55
  - Update list of examples [\#340](https://github.com/chef/inspec/pull/340) ([chris-rock](https://github.com/chris-rock))
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :test do
6
6
  gem 'bundler', '~> 1.5'
7
7
  gem 'minitest', '~> 5.5'
8
8
  gem 'rake', '~> 10'
9
- gem 'rubocop', '~> 0.32'
9
+ gem 'rubocop', '~> 0.36.0'
10
10
  gem 'simplecov', '~> 0.10'
11
11
  gem 'concurrent-ruby', '~> 0.9'
12
12
  end
data/Rakefile CHANGED
@@ -46,6 +46,20 @@ namespace :test do
46
46
  path = File.join(File.dirname(__FILE__), 'test', 'integration')
47
47
  sh('sh', '-c', "cd #{path} && bundle exec kitchen test -c #{concurrency} -t .")
48
48
  end
49
+
50
+ task :ssh, [:target] do |_t, args|
51
+ tests_path = File.join(File.dirname(__FILE__), 'test', 'integration', 'test', 'integration', 'default')
52
+ key_files = ENV['key_files'] || File.join(ENV['HOME'], '.ssh', 'id_rsa')
53
+
54
+ sh_cmd = "bin/inspec exec #{tests_path}/"
55
+ sh_cmd += ENV['test'] ? "#{ENV['test']}_spec.rb" : '*'
56
+ sh_cmd += " --sudo" unless args[:target].split('@')[0] == 'root'
57
+ sh_cmd += " -t ssh://#{args[:target]}"
58
+ sh_cmd += " --key_files=#{key_files}"
59
+ sh_cmd += " --format=#{ENV['format']}" if ENV['format']
60
+
61
+ sh('sh', '-c', sh_cmd)
62
+ end
49
63
  end
50
64
 
51
65
  # Print the current version of this gem or update it.
@@ -60,7 +74,7 @@ def inspec_version(target = nil)
60
74
 
61
75
  unless target.nil?
62
76
  raw = File.read(path)
63
- nu = raw.sub(/VERSION.*/, "VERSION = '#{target}'")
77
+ nu = raw.sub(/VERSION.*/, "VERSION = '#{target}'.freeze")
64
78
  File.write(path, nu)
65
79
  load(path)
66
80
  end
@@ -3888,7 +3888,7 @@ The following examples show how to use this InSpec audit resource.
3888
3888
 
3889
3889
  describe ssh_config do
3890
3890
  its('cipher') { should contain '3des' }
3891
- its('port') { should '22' }
3891
+ its('port') { should eq '22' }
3892
3892
  its('hostname') { should include('example.com') }
3893
3893
  end
3894
3894
 
@@ -12,7 +12,7 @@ title 'Gordon Config Checks'
12
12
  # ```
13
13
  control 'gordon-1.0' do
14
14
  impact 0.7
15
- title 'Create separate /tmp partition'
15
+ title 'Verify the version number of Gordon'
16
16
  desc 'An optional description...'
17
17
  describe gordon_config do
18
18
  its('version') { should eq('1.0') }
@@ -0,0 +1,3 @@
1
+ describe tiny do
2
+ require 'pry'; binding.pry
3
+ end
@@ -0,0 +1,10 @@
1
+ name: resource
2
+ title: InSpec Example Resources
3
+ maintainer: Chef Software, Inc.
4
+ copyright: Chef Software, Inc.
5
+ copyright_email: support@chef.io
6
+ license: Apache 2 license
7
+ summary: Demonstrates the use of InSpec custom resources
8
+ version: 1.0.0
9
+ supports:
10
+ - linux
@@ -0,0 +1,3 @@
1
+ class Tiny < Inspec.resource(1)
2
+ name 'tiny'
3
+ end
@@ -13,8 +13,21 @@ module Inspec::DSL
13
13
  ::Inspec::DSL.load_spec_files_for_profile self, id, true, &block
14
14
  end
15
15
 
16
- alias_method :require_rules, :require_controls
17
- alias_method :include_rules, :include_controls
16
+ alias require_rules require_controls
17
+ alias include_rules include_controls
18
+
19
+ def self.rule_from_check(m, a, b)
20
+ if a.is_a?(Array) && !a.empty? &&
21
+ a[0].respond_to?(:resource_skipped) &&
22
+ !a[0].resource_skipped.nil?
23
+ ::Inspec::Rule.__send__(m, *a) do
24
+ it a[0].resource_skipped
25
+ end
26
+ else
27
+ # execute the method
28
+ ::Inspec::Rule.__send__(m, *a, &b)
29
+ end
30
+ end
18
31
 
19
32
  # Register a given rule with RSpec and
20
33
  # let it run. This happens after everything
@@ -24,24 +37,11 @@ module Inspec::DSL
24
37
  fid = InspecBaseRule.full_id(r, profile_id)
25
38
  checks.each do |m, a, b|
26
39
  # check if the resource is skippable and skipped
27
- if a.is_a?(Array) && !a.empty? &&
28
- a[0].respond_to?(:resource_skipped) &&
29
- !a[0].resource_skipped.nil?
30
- cres = ::Inspec::Rule.__send__(m, *a) do
31
- it a[0].resource_skipped
32
- end
33
- else
34
- # execute the method
35
- cres = ::Inspec::Rule.__send__(m, *a, &b)
36
- end
37
- if m == 'describe'
38
- set_rspec_ids(cres, fid)
39
- end
40
+ cres = rule_from_check(m, a, b)
41
+ set_rspec_ids(cres, fid) if m == 'describe'
40
42
  end
41
43
  end
42
44
 
43
- private
44
-
45
45
  # merge two rules completely; all defined
46
46
  # fields from src will be overwritten in dst
47
47
  def self.merge_rules(dst, src)
@@ -35,14 +35,9 @@ module Inspec
35
35
  end
36
36
 
37
37
  def supports(sth, version = nil)
38
- params[:supports] ||= []
39
- params[:supports].push(
40
- # do not use hash syntax for `-` to work properly with ruby 1.9.3 parser
41
- {
42
- :'os-name' => sth, # rubocop:disable Style/HashSyntax, Lint/UnneededDisable
43
- version: version,
44
- },
45
- )
38
+ # Ignore supports with metadata.rb. This file is legacy and the way it
39
+ # it handles `supports` deprecated. A deprecation warning will be printed
40
+ # already.
46
41
  end
47
42
 
48
43
  def is_supported(os, entry)
@@ -22,7 +22,7 @@ module Inspec
22
22
  end
23
23
 
24
24
  def self.__register(name, obj)
25
- # rubocop:disable Lint/NestedMethodDefinition
25
+ # rubocop:disable Lint/NestedMethodDefinition, Lint/DuplicateMethods
26
26
  cl = Class.new(obj) do
27
27
  # add some common methods
28
28
  include Inspec::Plugins::ResourceCommon
@@ -17,6 +17,7 @@ module Inspec
17
17
 
18
18
  attr_reader :params
19
19
  attr_reader :path
20
+ attr_reader :metadata
20
21
 
21
22
  def initialize(options = nil)
22
23
  @options = options || {}
@@ -104,7 +105,7 @@ module Inspec
104
105
  # check if the profile is using the old test directory instead of the
105
106
  # new controls directory
106
107
  if Pathname.new(path).join('test').exist? && !Pathname.new(path).join('controls').exist?
107
- warn.call('Profile uses deprecated `test` directory, rename it to `controls`')
108
+ warn.call('Profile uses deprecated `test` directory, rename it to `controls`.')
108
109
  end
109
110
 
110
111
  count = rules_count
@@ -147,7 +148,7 @@ module Inspec
147
148
 
148
149
  profile_name = @params[:name]
149
150
 
150
- opts[:zip] ? ext='zip' : ext='tar.gz'
151
+ ext = opts[:zip] ? 'zip' : 'tar.gz'
151
152
  slug = profile_name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '_')
152
153
  archive = Pathname.new(File.dirname(__FILE__)).join('../..', "#{slug}.#{ext}")
153
154
 
@@ -133,9 +133,9 @@ module Inspec
133
133
 
134
134
  alias_method :skip_rule, :skip_control
135
135
 
136
- def only_if(&block)
136
+ def only_if
137
137
  return unless block_given?
138
- @skip_profile = !block.call
138
+ @skip_profile = !yield
139
139
  end
140
140
  end
141
141
  # rubocop:enable all
@@ -138,11 +138,11 @@ module Inspec
138
138
  rule.instance_variable_set(:@profile_id, profile_id)
139
139
  pid = profile_id
140
140
  end
141
- if pid.nil? or pid.empty?
142
- return rid
143
- else
144
- return "#{pid}/#{rid}"
145
- end
141
+
142
+ # if we don't have a profile id, just return the rule's ID
143
+ return rid if pid.nil? or pid.empty?
144
+ # otherwise combine them
145
+ "#{pid}/#{rid}"
146
146
  end
147
147
 
148
148
  private
@@ -155,8 +155,8 @@ module Inspec
155
155
  def unindent(text)
156
156
  return '' if text.nil?
157
157
  text.strip.split("\n").map(&:strip)
158
- .map { |x| x.empty? ? "\n" : x }
159
- .join(' ')
158
+ .map { |x| x.empty? ? "\n" : x }
159
+ .join(' ')
160
160
  end
161
161
 
162
162
  # get the rule's source code
@@ -89,10 +89,8 @@ You are currently running on:
89
89
  EOF
90
90
  elsif resource == 'resources'
91
91
  resources
92
- else
93
-
94
- if !Inspec::Resource.registry[resource].nil?
95
- puts <<EOF
92
+ elsif !Inspec::Resource.registry[resource].nil?
93
+ puts <<EOF
96
94
  #{mark 'Name:'} #{resource}
97
95
 
98
96
  #{mark 'Description:'}
@@ -107,10 +105,9 @@ EOF
107
105
  https://github.com/chef/inspec/blob/master/docs/resources.rst##{resource}
108
106
 
109
107
  EOF
110
- else
111
- puts 'Only the following resources are available:'
112
- resources
113
- end
108
+ else
109
+ puts 'Only the following resources are available:'
110
+ resources
114
111
  end
115
112
  end
116
113
 
@@ -28,7 +28,7 @@ module Inspec::Targets
28
28
 
29
29
  def get_filenames(paths)
30
30
  paths.find_all do |path|
31
- (path.start_with?('controls') || path.start_with?('test')) && path.end_with?('.rb')
31
+ path.start_with?('controls', 'test') && path.end_with?('.rb')
32
32
  end
33
33
  end
34
34
 
@@ -9,16 +9,13 @@ require 'inspec/targets/archive'
9
9
  module Inspec::Targets
10
10
  class TarHelper < ArchiveHelper
11
11
  def handles?(target)
12
- File.file?(target) and (
13
- target.end_with?('.tar.gz') ||
14
- target.end_with?('.tgz')
15
- )
12
+ File.file?(target) && target.end_with?('.tar.gz', '.tgz')
16
13
  end
17
14
 
18
15
  def structure(input)
19
16
  files = []
20
17
  rootdir = ''
21
- Gem::Package::TarReader.new(Zlib::GzipReader.open input) do |tar|
18
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(input)) do |tar|
22
19
  files = tar.map(&:full_name)
23
20
  end
24
21
 
@@ -35,7 +32,7 @@ module Inspec::Targets
35
32
 
36
33
  def content(input, files, rootdir = nil, opts = {})
37
34
  content = []
38
- Gem::Package::TarReader.new(Zlib::GzipReader.open input) do |tar|
35
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(input)) do |tar|
39
36
  tar.each do |entry|
40
37
  if entry.directory?
41
38
  # nothing to do
@@ -17,11 +17,12 @@ module Inspec::Targets
17
17
 
18
18
  def resolve(target, opts = {})
19
19
  # abort if the target does not start with http or https
20
- return nil unless target.start_with? 'https://' or target.start_with? 'http://'
20
+ return nil unless target.start_with?('https://', 'http://')
21
21
 
22
- # support for github https url
23
- if target.start_with? 'https://github.com' and target.end_with? '.git'
24
- url = target.sub(/.git$/, '') + '/archive/master.tar.gz'
22
+ # support for github url
23
+ m = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?$}.match(target)
24
+ if m
25
+ url = "https://github.com/#{m[:user]}/#{m[:repo]}/archive/master.tar.gz"
25
26
  else
26
27
  url = target
27
28
  end
@@ -29,10 +30,10 @@ module Inspec::Targets
29
30
  resolve_zip(url, opts)
30
31
  end
31
32
 
32
- def resolve_zip(url, opts)
33
- archive = Tempfile.new(['inspec-dl-', '.tar.gz'])
33
+ # download url into archive using opts,
34
+ # returns File object and content-type from HTTP headers
35
+ def download_archive(url, archive, opts)
34
36
  archive.binmode
35
-
36
37
  remote = open(
37
38
  url,
38
39
  http_basic_authentication: [opts['user'] || '', opts['password'] || ''],
@@ -43,7 +44,12 @@ module Inspec::Targets
43
44
  archive.rewind
44
45
  archive.close
45
46
 
46
- content_type = remote.meta['content-type']
47
+ [archive, remote.meta['content-type']]
48
+ end
49
+
50
+ def resolve_zip(url, opts)
51
+ archive, content_type = download_archive(url, Tempfile.new(['inspec-dl-', '.tar.gz']), opts)
52
+
47
53
  # replace extension with zip if we detected a zip content type
48
54
  if ['application/x-zip-compressed', 'application/zip'].include?(content_type)
49
55
  # rename file for proper detection in DirHelper
@@ -53,8 +59,8 @@ module Inspec::Targets
53
59
 
54
60
  content = ZipHelper.new.resolve(new_path)
55
61
  File.unlink(new_path)
56
- # use tar helper as default
57
62
  elsif ['application/x-gzip', 'application/gzip'].include?(content_type)
63
+ # use tar helper as default (otherwise returns nil)
58
64
  content = TarHelper.new.resolve(archive.path)
59
65
  archive.unlink
60
66
  end
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+ # author: Dominik Richter
3
+ # author: Christoph Hartmann
4
+
5
+ require 'uri'
6
+ require 'tempfile'
7
+ require 'open-uri'
8
+ require 'inspec/targets/zip'
9
+
10
+ module Inspec::Targets
11
+ class UrlHelper
12
+ def handles?(target)
13
+ uri = URI.parse(target)
14
+ return false if uri.nil? or uri.scheme.nil?
15
+ %{ http https }.include? uri.scheme
16
+ end
17
+
18
+ def resolve(target, opts = {})
19
+ # abort if the target does not start with http or https
20
+ return nil unless target.start_with?('https://', 'http://')
21
+
22
+ <<<<<<< a4b7ba89cb8a1c4442908d7a5ca821b2b1617c87
23
+ # support for github url
24
+ m = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?$}.match(target)
25
+ if m
26
+ url = "https://github.com/#{m[:user]}/#{m[:repo]}/archive/master.tar.gz"
27
+ else
28
+ url = target
29
+ end
30
+ =======
31
+ # support for github https url
32
+ url =
33
+ if target.start_with? 'https://github.com' and target.end_with? '.git'
34
+ target.sub(/.git$/, '') + '/archive/master.tar.gz'
35
+ else
36
+ target
37
+ end
38
+ >>>>>>> lint
39
+
40
+ resolve_zip(url, opts)
41
+ end
42
+
43
+ # download url into archive using opts,
44
+ # returns File object and content-type from HTTP headers
45
+ def download_archive(url, archive, opts)
46
+ archive.binmode
47
+ remote = open(
48
+ url,
49
+ http_basic_authentication: [opts['user'] || '', opts['password'] || ''],
50
+ )
51
+
52
+ # download content
53
+ archive.write(remote.read)
54
+ archive.rewind
55
+ archive.close
56
+
57
+ [archive, remote.meta['content-type']]
58
+ end
59
+
60
+ def resolve_zip(url, opts)
61
+ archive, content_type = download_archive(url, Tempfile.new(['inspec-dl-', '.tar.gz']), opts)
62
+
63
+ # replace extension with zip if we detected a zip content type
64
+ if ['application/x-zip-compressed', 'application/zip'].include?(content_type)
65
+ # rename file for proper detection in DirHelper
66
+ pn = Pathname.new(archive.path)
67
+ new_path = pn.dirname.join(pn.basename.to_s.gsub('tar.gz', 'zip'))
68
+ File.rename(pn.to_s, new_path.to_s)
69
+
70
+ content = ZipHelper.new.resolve(new_path)
71
+ File.unlink(new_path)
72
+ elsif ['application/x-gzip', 'application/gzip'].include?(content_type)
73
+ # use tar helper as default (otherwise returns nil)
74
+ content = TarHelper.new.resolve(archive.path)
75
+ archive.unlink
76
+ end
77
+
78
+ content
79
+ end
80
+
81
+ def to_s
82
+ 'URL Loader'
83
+ end
84
+ end
85
+
86
+ Inspec::Targets.add_module('url', UrlHelper.new)
87
+ end