specinfra-cisco 2.40.2

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 (390) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +12 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +29 -0
  9. data/Rakefile +43 -0
  10. data/appveyor.yml +56 -0
  11. data/examples/multiple_backends.rb +46 -0
  12. data/lib/specinfra.rb +45 -0
  13. data/lib/specinfra/backend.rb +12 -0
  14. data/lib/specinfra/backend/base.rb +55 -0
  15. data/lib/specinfra/backend/cmd.rb +68 -0
  16. data/lib/specinfra/backend/docker.rb +112 -0
  17. data/lib/specinfra/backend/dockerfile.rb +32 -0
  18. data/lib/specinfra/backend/exec.rb +152 -0
  19. data/lib/specinfra/backend/lxc.rb +45 -0
  20. data/lib/specinfra/backend/powershell/command.rb +40 -0
  21. data/lib/specinfra/backend/powershell/script_helper.rb +86 -0
  22. data/lib/specinfra/backend/powershell/support/check_file_access_rules.ps1 +8 -0
  23. data/lib/specinfra/backend/powershell/support/crop_text.ps1 +11 -0
  24. data/lib/specinfra/backend/powershell/support/find_group.ps1 +8 -0
  25. data/lib/specinfra/backend/powershell/support/find_iis_component.ps1 +90 -0
  26. data/lib/specinfra/backend/powershell/support/find_installed_application.ps1 +37 -0
  27. data/lib/specinfra/backend/powershell/support/find_installed_hot_fix.ps1 +18 -0
  28. data/lib/specinfra/backend/powershell/support/find_scheduled_task.ps1 +7 -0
  29. data/lib/specinfra/backend/powershell/support/find_service.ps1 +5 -0
  30. data/lib/specinfra/backend/powershell/support/find_user.ps1 +8 -0
  31. data/lib/specinfra/backend/powershell/support/find_usergroup.ps1 +9 -0
  32. data/lib/specinfra/backend/powershell/support/is_port_listening.ps1 +14 -0
  33. data/lib/specinfra/backend/powershell/support/is_remote_port_listening.ps1 +51 -0
  34. data/lib/specinfra/backend/powershell/support/list_windows_features.ps1 +68 -0
  35. data/lib/specinfra/backend/shell_script.rb +29 -0
  36. data/lib/specinfra/backend/ssh.rb +182 -0
  37. data/lib/specinfra/backend/telnet.rb +111 -0
  38. data/lib/specinfra/backend/winrm.rb +29 -0
  39. data/lib/specinfra/command.rb +304 -0
  40. data/lib/specinfra/command/aix.rb +1 -0
  41. data/lib/specinfra/command/aix/base.rb +2 -0
  42. data/lib/specinfra/command/aix/base/file.rb +21 -0
  43. data/lib/specinfra/command/aix/base/group.rb +8 -0
  44. data/lib/specinfra/command/aix/base/host.rb +17 -0
  45. data/lib/specinfra/command/aix/base/inventory.rb +38 -0
  46. data/lib/specinfra/command/aix/base/package.rb +11 -0
  47. data/lib/specinfra/command/aix/base/port.rb +8 -0
  48. data/lib/specinfra/command/aix/base/service.rb +11 -0
  49. data/lib/specinfra/command/aix/base/user.rb +15 -0
  50. data/lib/specinfra/command/alpine.rb +1 -0
  51. data/lib/specinfra/command/alpine/base.rb +2 -0
  52. data/lib/specinfra/command/alpine/base/package.rb +19 -0
  53. data/lib/specinfra/command/alpine/base/process.rb +20 -0
  54. data/lib/specinfra/command/alpine/base/service.rb +11 -0
  55. data/lib/specinfra/command/amazon.rb +2 -0
  56. data/lib/specinfra/command/amazon/base.rb +2 -0
  57. data/lib/specinfra/command/arch.rb +1 -0
  58. data/lib/specinfra/command/arch/base.rb +11 -0
  59. data/lib/specinfra/command/arch/base/file.rb +14 -0
  60. data/lib/specinfra/command/arch/base/package.rb +30 -0
  61. data/lib/specinfra/command/arch/base/service.rb +5 -0
  62. data/lib/specinfra/command/base.rb +21 -0
  63. data/lib/specinfra/command/base/bond.rb +2 -0
  64. data/lib/specinfra/command/base/bridge.rb +2 -0
  65. data/lib/specinfra/command/base/cron.rb +17 -0
  66. data/lib/specinfra/command/base/file.rb +179 -0
  67. data/lib/specinfra/command/base/fstab.rb +2 -0
  68. data/lib/specinfra/command/base/group.rb +26 -0
  69. data/lib/specinfra/command/base/host.rb +25 -0
  70. data/lib/specinfra/command/base/interface.rb +2 -0
  71. data/lib/specinfra/command/base/inventory.rb +2 -0
  72. data/lib/specinfra/command/base/ip6tables.rb +2 -0
  73. data/lib/specinfra/command/base/ipfilter.rb +2 -0
  74. data/lib/specinfra/command/base/ipnat.rb +2 -0
  75. data/lib/specinfra/command/base/iptables.rb +2 -0
  76. data/lib/specinfra/command/base/kernel_module.rb +2 -0
  77. data/lib/specinfra/command/base/localhost.rb +7 -0
  78. data/lib/specinfra/command/base/lxc_container.rb +2 -0
  79. data/lib/specinfra/command/base/mail_alias.rb +12 -0
  80. data/lib/specinfra/command/base/package.rb +51 -0
  81. data/lib/specinfra/command/base/port.rb +10 -0
  82. data/lib/specinfra/command/base/ppa.rb +2 -0
  83. data/lib/specinfra/command/base/process.rb +15 -0
  84. data/lib/specinfra/command/base/routing_table.rb +9 -0
  85. data/lib/specinfra/command/base/selinux.rb +2 -0
  86. data/lib/specinfra/command/base/selinux_module.rb +2 -0
  87. data/lib/specinfra/command/base/service.rb +15 -0
  88. data/lib/specinfra/command/base/user.rb +94 -0
  89. data/lib/specinfra/command/base/yumrepo.rb +3 -0
  90. data/lib/specinfra/command/base/zfs.rb +1 -0
  91. data/lib/specinfra/command/coreos.rb +1 -0
  92. data/lib/specinfra/command/coreos/base.rb +2 -0
  93. data/lib/specinfra/command/coreos/base/service.rb +5 -0
  94. data/lib/specinfra/command/cumulus.rb +11 -0
  95. data/lib/specinfra/command/cumulus/base.rb +2 -0
  96. data/lib/specinfra/command/cumulus/base/ppa.rb +17 -0
  97. data/lib/specinfra/command/cumulus/base/service.rb +7 -0
  98. data/lib/specinfra/command/darwin.rb +1 -0
  99. data/lib/specinfra/command/darwin/base.rb +2 -0
  100. data/lib/specinfra/command/darwin/base/file.rb +47 -0
  101. data/lib/specinfra/command/darwin/base/host.rb +11 -0
  102. data/lib/specinfra/command/darwin/base/inventory.rb +28 -0
  103. data/lib/specinfra/command/darwin/base/package.rb +41 -0
  104. data/lib/specinfra/command/darwin/base/port.rb +8 -0
  105. data/lib/specinfra/command/darwin/base/service.rb +11 -0
  106. data/lib/specinfra/command/darwin/base/user.rb +15 -0
  107. data/lib/specinfra/command/debian.rb +1 -0
  108. data/lib/specinfra/command/debian/base.rb +11 -0
  109. data/lib/specinfra/command/debian/base/package.rb +33 -0
  110. data/lib/specinfra/command/debian/base/ppa.rb +2 -0
  111. data/lib/specinfra/command/debian/base/service.rb +32 -0
  112. data/lib/specinfra/command/debian/v8.rb +2 -0
  113. data/lib/specinfra/command/debian/v8/service.rb +5 -0
  114. data/lib/specinfra/command/esxi.rb +1 -0
  115. data/lib/specinfra/command/esxi/base.rb +2 -0
  116. data/lib/specinfra/command/esxi/base/package.rb +7 -0
  117. data/lib/specinfra/command/fedora.rb +1 -0
  118. data/lib/specinfra/command/fedora/base.rb +2 -0
  119. data/lib/specinfra/command/fedora/base/service.rb +11 -0
  120. data/lib/specinfra/command/fedora/v15.rb +2 -0
  121. data/lib/specinfra/command/fedora/v15/service.rb +5 -0
  122. data/lib/specinfra/command/freebsd.rb +1 -0
  123. data/lib/specinfra/command/freebsd/base.rb +3 -0
  124. data/lib/specinfra/command/freebsd/base/file.rb +42 -0
  125. data/lib/specinfra/command/freebsd/base/interface.rb +35 -0
  126. data/lib/specinfra/command/freebsd/base/inventory.rb +28 -0
  127. data/lib/specinfra/command/freebsd/base/package.rb +19 -0
  128. data/lib/specinfra/command/freebsd/base/port.rb +8 -0
  129. data/lib/specinfra/command/freebsd/base/routing_table.rb +9 -0
  130. data/lib/specinfra/command/freebsd/base/service.rb +11 -0
  131. data/lib/specinfra/command/freebsd/base/user.rb +20 -0
  132. data/lib/specinfra/command/freebsd/v10.rb +2 -0
  133. data/lib/specinfra/command/freebsd/v10/package.rb +31 -0
  134. data/lib/specinfra/command/freebsd/v6.rb +2 -0
  135. data/lib/specinfra/command/freebsd/v6/user.rb +19 -0
  136. data/lib/specinfra/command/gentoo.rb +1 -0
  137. data/lib/specinfra/command/gentoo/base.rb +2 -0
  138. data/lib/specinfra/command/gentoo/base/package.rb +7 -0
  139. data/lib/specinfra/command/gentoo/base/service.rb +19 -0
  140. data/lib/specinfra/command/linux.rb +1 -0
  141. data/lib/specinfra/command/linux/base.rb +2 -0
  142. data/lib/specinfra/command/linux/base/bond.rb +11 -0
  143. data/lib/specinfra/command/linux/base/bridge.rb +11 -0
  144. data/lib/specinfra/command/linux/base/file.rb +20 -0
  145. data/lib/specinfra/command/linux/base/fstab.rb +9 -0
  146. data/lib/specinfra/command/linux/base/interface.rb +38 -0
  147. data/lib/specinfra/command/linux/base/inventory.rb +31 -0
  148. data/lib/specinfra/command/linux/base/ip6tables.rb +15 -0
  149. data/lib/specinfra/command/linux/base/iptables.rb +12 -0
  150. data/lib/specinfra/command/linux/base/kernel_module.rb +7 -0
  151. data/lib/specinfra/command/linux/base/lxc_container.rb +11 -0
  152. data/lib/specinfra/command/linux/base/package.rb +2 -0
  153. data/lib/specinfra/command/linux/base/ppa.rb +2 -0
  154. data/lib/specinfra/command/linux/base/selinux.rb +12 -0
  155. data/lib/specinfra/command/linux/base/selinux_module.rb +16 -0
  156. data/lib/specinfra/command/linux/base/service.rb +2 -0
  157. data/lib/specinfra/command/linux/base/yumrepo.rb +2 -0
  158. data/lib/specinfra/command/linux/base/zfs.rb +5 -0
  159. data/lib/specinfra/command/module.rb +7 -0
  160. data/lib/specinfra/command/module/service/daemontools.rb +46 -0
  161. data/lib/specinfra/command/module/service/delegator.rb +20 -0
  162. data/lib/specinfra/command/module/service/god.rb +13 -0
  163. data/lib/specinfra/command/module/service/init.rb +42 -0
  164. data/lib/specinfra/command/module/service/monit.rb +13 -0
  165. data/lib/specinfra/command/module/service/runit.rb +13 -0
  166. data/lib/specinfra/command/module/service/supervisor.rb +13 -0
  167. data/lib/specinfra/command/module/service/systemd.rb +41 -0
  168. data/lib/specinfra/command/module/service/upstart.rb +13 -0
  169. data/lib/specinfra/command/module/ss.rb +39 -0
  170. data/lib/specinfra/command/module/systemd.rb +12 -0
  171. data/lib/specinfra/command/module/zfs.rb +25 -0
  172. data/lib/specinfra/command/nexus.rb +1 -0
  173. data/lib/specinfra/command/nexus/base.rb +2 -0
  174. data/lib/specinfra/command/nexus/base/file.rb +8 -0
  175. data/lib/specinfra/command/nexus/base/host.rb +2 -0
  176. data/lib/specinfra/command/nexus/base/iptables.rb +11 -0
  177. data/lib/specinfra/command/nexus/base/package.rb +30 -0
  178. data/lib/specinfra/command/nexus/base/port.rb +5 -0
  179. data/lib/specinfra/command/nexus/base/service.rb +2 -0
  180. data/lib/specinfra/command/nexus/base/yumrepo.rb +11 -0
  181. data/lib/specinfra/command/nexus/v7.rb +3 -0
  182. data/lib/specinfra/command/nixos.rb +1 -0
  183. data/lib/specinfra/command/nixos/base.rb +2 -0
  184. data/lib/specinfra/command/nixos/base/package.rb +17 -0
  185. data/lib/specinfra/command/nixos/base/service.rb +5 -0
  186. data/lib/specinfra/command/openbsd.rb +1 -0
  187. data/lib/specinfra/command/openbsd/base.rb +4 -0
  188. data/lib/specinfra/command/openbsd/base/bond.rb +11 -0
  189. data/lib/specinfra/command/openbsd/base/bridge.rb +11 -0
  190. data/lib/specinfra/command/openbsd/base/file.rb +47 -0
  191. data/lib/specinfra/command/openbsd/base/fstab.rb +9 -0
  192. data/lib/specinfra/command/openbsd/base/interface.rb +40 -0
  193. data/lib/specinfra/command/openbsd/base/inventory.rb +28 -0
  194. data/lib/specinfra/command/openbsd/base/mail_alias.rb +7 -0
  195. data/lib/specinfra/command/openbsd/base/package.rb +15 -0
  196. data/lib/specinfra/command/openbsd/base/port.rb +7 -0
  197. data/lib/specinfra/command/openbsd/base/routing_table.rb +9 -0
  198. data/lib/specinfra/command/openbsd/base/service.rb +11 -0
  199. data/lib/specinfra/command/openbsd/base/user.rb +11 -0
  200. data/lib/specinfra/command/opensuse.rb +1 -0
  201. data/lib/specinfra/command/opensuse/base.rb +3 -0
  202. data/lib/specinfra/command/opensuse/base/service.rb +12 -0
  203. data/lib/specinfra/command/plamo.rb +1 -0
  204. data/lib/specinfra/command/plamo/base.rb +3 -0
  205. data/lib/specinfra/command/plamo/base/package.rb +11 -0
  206. data/lib/specinfra/command/plamo/base/service.rb +14 -0
  207. data/lib/specinfra/command/redhat.rb +1 -0
  208. data/lib/specinfra/command/redhat/base.rb +2 -0
  209. data/lib/specinfra/command/redhat/base/file.rb +8 -0
  210. data/lib/specinfra/command/redhat/base/host.rb +2 -0
  211. data/lib/specinfra/command/redhat/base/iptables.rb +11 -0
  212. data/lib/specinfra/command/redhat/base/package.rb +39 -0
  213. data/lib/specinfra/command/redhat/base/port.rb +2 -0
  214. data/lib/specinfra/command/redhat/base/service.rb +2 -0
  215. data/lib/specinfra/command/redhat/base/yumrepo.rb +13 -0
  216. data/lib/specinfra/command/redhat/v5.rb +3 -0
  217. data/lib/specinfra/command/redhat/v5/iptables.rb +10 -0
  218. data/lib/specinfra/command/redhat/v7.rb +3 -0
  219. data/lib/specinfra/command/redhat/v7/host.rb +15 -0
  220. data/lib/specinfra/command/redhat/v7/port.rb +5 -0
  221. data/lib/specinfra/command/redhat/v7/service.rb +5 -0
  222. data/lib/specinfra/command/smartos.rb +1 -0
  223. data/lib/specinfra/command/smartos/base.rb +3 -0
  224. data/lib/specinfra/command/smartos/base/file.rb +11 -0
  225. data/lib/specinfra/command/smartos/base/package.rb +15 -0
  226. data/lib/specinfra/command/smartos/base/service.rb +11 -0
  227. data/lib/specinfra/command/solaris.rb +1 -0
  228. data/lib/specinfra/command/solaris/base.rb +2 -0
  229. data/lib/specinfra/command/solaris/base/cron.rb +12 -0
  230. data/lib/specinfra/command/solaris/base/file.rb +20 -0
  231. data/lib/specinfra/command/solaris/base/group.rb +8 -0
  232. data/lib/specinfra/command/solaris/base/host.rb +14 -0
  233. data/lib/specinfra/command/solaris/base/inventory.rb +37 -0
  234. data/lib/specinfra/command/solaris/base/ipfilter.rb +7 -0
  235. data/lib/specinfra/command/solaris/base/ipnat.rb +14 -0
  236. data/lib/specinfra/command/solaris/base/package.rb +14 -0
  237. data/lib/specinfra/command/solaris/base/port.rb +13 -0
  238. data/lib/specinfra/command/solaris/base/service.rb +24 -0
  239. data/lib/specinfra/command/solaris/base/user.rb +15 -0
  240. data/lib/specinfra/command/solaris/base/zfs.rb +13 -0
  241. data/lib/specinfra/command/solaris/v10.rb +2 -0
  242. data/lib/specinfra/command/solaris/v10/file.rb +42 -0
  243. data/lib/specinfra/command/solaris/v10/group.rb +7 -0
  244. data/lib/specinfra/command/solaris/v10/host.rb +13 -0
  245. data/lib/specinfra/command/solaris/v10/package.rb +11 -0
  246. data/lib/specinfra/command/solaris/v10/user.rb +18 -0
  247. data/lib/specinfra/command/suse.rb +1 -0
  248. data/lib/specinfra/command/suse/base.rb +2 -0
  249. data/lib/specinfra/command/suse/base/package.rb +21 -0
  250. data/lib/specinfra/command/suse/base/service.rb +14 -0
  251. data/lib/specinfra/command/ubuntu.rb +11 -0
  252. data/lib/specinfra/command/ubuntu/base.rb +2 -0
  253. data/lib/specinfra/command/ubuntu/base/ppa.rb +17 -0
  254. data/lib/specinfra/command/ubuntu/base/service.rb +7 -0
  255. data/lib/specinfra/command/ubuntu/v15.rb +1 -0
  256. data/lib/specinfra/command/ubuntu/v15/service.rb +5 -0
  257. data/lib/specinfra/command/windows.rb +1 -0
  258. data/lib/specinfra/command/windows/base.rb +22 -0
  259. data/lib/specinfra/command/windows/base/feature.rb +17 -0
  260. data/lib/specinfra/command/windows/base/file.rb +113 -0
  261. data/lib/specinfra/command/windows/base/group.rb +11 -0
  262. data/lib/specinfra/command/windows/base/host.rb +25 -0
  263. data/lib/specinfra/command/windows/base/hot_fix.rb +19 -0
  264. data/lib/specinfra/command/windows/base/iis_app_pool.rb +66 -0
  265. data/lib/specinfra/command/windows/base/iis_website.rb +59 -0
  266. data/lib/specinfra/command/windows/base/package.rb +11 -0
  267. data/lib/specinfra/command/windows/base/port.rb +17 -0
  268. data/lib/specinfra/command/windows/base/process.rb +31 -0
  269. data/lib/specinfra/command/windows/base/registry_key.rb +53 -0
  270. data/lib/specinfra/command/windows/base/scheduled_task.rb +10 -0
  271. data/lib/specinfra/command/windows/base/service.rb +31 -0
  272. data/lib/specinfra/command/windows/base/user.rb +22 -0
  273. data/lib/specinfra/command_factory.rb +83 -0
  274. data/lib/specinfra/command_result.rb +28 -0
  275. data/lib/specinfra/configuration.rb +62 -0
  276. data/lib/specinfra/core.rb +18 -0
  277. data/lib/specinfra/ec2_metadata.rb +93 -0
  278. data/lib/specinfra/ext.rb +2 -0
  279. data/lib/specinfra/ext/class.rb +9 -0
  280. data/lib/specinfra/ext/string.rb +14 -0
  281. data/lib/specinfra/helper.rb +6 -0
  282. data/lib/specinfra/helper/configuration.rb +41 -0
  283. data/lib/specinfra/helper/detect_os.rb +38 -0
  284. data/lib/specinfra/helper/detect_os/aix.rb +12 -0
  285. data/lib/specinfra/helper/detect_os/alpine.rb +8 -0
  286. data/lib/specinfra/helper/detect_os/arch.rb +7 -0
  287. data/lib/specinfra/helper/detect_os/coreos.rb +18 -0
  288. data/lib/specinfra/helper/detect_os/darwin.rb +11 -0
  289. data/lib/specinfra/helper/detect_os/debian.rb +26 -0
  290. data/lib/specinfra/helper/detect_os/esxi.rb +10 -0
  291. data/lib/specinfra/helper/detect_os/freebsd.rb +11 -0
  292. data/lib/specinfra/helper/detect_os/gentoo.rb +7 -0
  293. data/lib/specinfra/helper/detect_os/nexus.rb +14 -0
  294. data/lib/specinfra/helper/detect_os/nixos.rb +7 -0
  295. data/lib/specinfra/helper/detect_os/openbsd.rb +11 -0
  296. data/lib/specinfra/helper/detect_os/plamo.rb +7 -0
  297. data/lib/specinfra/helper/detect_os/redhat.rb +31 -0
  298. data/lib/specinfra/helper/detect_os/solaris.rb +15 -0
  299. data/lib/specinfra/helper/detect_os/suse.rb +15 -0
  300. data/lib/specinfra/helper/docker.rb +11 -0
  301. data/lib/specinfra/helper/host_inventory.rb +12 -0
  302. data/lib/specinfra/helper/lxc.rb +11 -0
  303. data/lib/specinfra/helper/os.rb +35 -0
  304. data/lib/specinfra/helper/properties.rb +14 -0
  305. data/lib/specinfra/helper/set.rb +10 -0
  306. data/lib/specinfra/host_inventory.rb +68 -0
  307. data/lib/specinfra/host_inventory/base.rb +14 -0
  308. data/lib/specinfra/host_inventory/cpu.rb +77 -0
  309. data/lib/specinfra/host_inventory/domain.rb +16 -0
  310. data/lib/specinfra/host_inventory/ec2.rb +11 -0
  311. data/lib/specinfra/host_inventory/filesystem.rb +31 -0
  312. data/lib/specinfra/host_inventory/fqdn.rb +16 -0
  313. data/lib/specinfra/host_inventory/hostname.rb +16 -0
  314. data/lib/specinfra/host_inventory/kernel.rb +27 -0
  315. data/lib/specinfra/host_inventory/memory.rb +83 -0
  316. data/lib/specinfra/host_inventory/platform.rb +9 -0
  317. data/lib/specinfra/host_inventory/platform_version.rb +15 -0
  318. data/lib/specinfra/host_inventory/virtualization.rb +39 -0
  319. data/lib/specinfra/processor.rb +229 -0
  320. data/lib/specinfra/properties.rb +17 -0
  321. data/lib/specinfra/runner.rb +35 -0
  322. data/lib/specinfra/version.rb +3 -0
  323. data/spec/backend/exec/build_command_spec.rb +148 -0
  324. data/spec/backend/exec/child_process_spec.rb +18 -0
  325. data/spec/backend/exec/env_spec.rb +16 -0
  326. data/spec/backend/exec/read_noblock_spec.rb +50 -0
  327. data/spec/backend/exec/stdxxx_handler_spec.rb +25 -0
  328. data/spec/backend/ssh/build_command_spec.rb +115 -0
  329. data/spec/command/amazon/interface_spec.rb +9 -0
  330. data/spec/command/amazon/package_spec.rb +7 -0
  331. data/spec/command/amazon/service_spec.rb +28 -0
  332. data/spec/command/base/file_spec.rb +91 -0
  333. data/spec/command/base/group_spec.rb +16 -0
  334. data/spec/command/base/localhost_spec.rb +7 -0
  335. data/spec/command/base/package_spec.rb +11 -0
  336. data/spec/command/base/user_spec.rb +59 -0
  337. data/spec/command/darwin/file_spec.rb +16 -0
  338. data/spec/command/darwin/user_spec.rb +15 -0
  339. data/spec/command/debian/service_spec.rb +28 -0
  340. data/spec/command/esxi/package_spec.rb +8 -0
  341. data/spec/command/factory_spec.rb +30 -0
  342. data/spec/command/freebsd/file_spec.rb +12 -0
  343. data/spec/command/freebsd/interface_spec.rb +28 -0
  344. data/spec/command/linux/bond_spec.rb +12 -0
  345. data/spec/command/linux/bridge_spec.rb +12 -0
  346. data/spec/command/linux/file_spec.rb +12 -0
  347. data/spec/command/linux/interface_spec.rb +24 -0
  348. data/spec/command/linux/inventory_spec.rb +15 -0
  349. data/spec/command/linux/ip6tables_spec.rb +7 -0
  350. data/spec/command/linux/selinux_module_spec.rb +12 -0
  351. data/spec/command/linux/selinux_spec.rb +8 -0
  352. data/spec/command/module/service/daemontools_spec.rb +18 -0
  353. data/spec/command/module/service/init_spec.rb +18 -0
  354. data/spec/command/module/service/systemd_spec.rb +16 -0
  355. data/spec/command/module/ss_spec.rb +28 -0
  356. data/spec/command/module/systemd_spec.rb +19 -0
  357. data/spec/command/module/zfs_spec.rb +6 -0
  358. data/spec/command/openbsd/file_spec.rb +12 -0
  359. data/spec/command/openbsd/interface_spec.rb +28 -0
  360. data/spec/command/redhat/package_spec.rb +8 -0
  361. data/spec/command/redhat/service_spec.rb +28 -0
  362. data/spec/command/redhat7/host_spec.rb +13 -0
  363. data/spec/command/redhat7/interface_spec.rb +9 -0
  364. data/spec/command/redhat7/port_spec.rb +8 -0
  365. data/spec/command/redhat7/service_spec.rb +32 -0
  366. data/spec/command/ubuntu/ppa_spec.rb +12 -0
  367. data/spec/command/windows/registry_key_spec.rb +36 -0
  368. data/spec/configuration_spec.rb +14 -0
  369. data/spec/helper/detect_os/aix_spec.rb +58 -0
  370. data/spec/helper/detect_os/darwin_spec.rb +42 -0
  371. data/spec/helper/detect_os/esxi_spec.rb +22 -0
  372. data/spec/helper/detect_os/freebsd_spec.rb +42 -0
  373. data/spec/helper/detect_os/openbsd_spec.rb +42 -0
  374. data/spec/helper/os_spec.rb +58 -0
  375. data/spec/helper/properties_spec.rb +11 -0
  376. data/spec/helper/set_spec.rb +14 -0
  377. data/spec/host_inventory/aix/filesystem_spec.rb +107 -0
  378. data/spec/host_inventory/darwin/filesystem_spec.rb +63 -0
  379. data/spec/host_inventory/freebsd/filesystem_spec.rb +123 -0
  380. data/spec/host_inventory/linux/cpu_spec.rb +123 -0
  381. data/spec/host_inventory/linux/filesystem_spec.rb +53 -0
  382. data/spec/host_inventory/linux/kernel_spec.rb +33 -0
  383. data/spec/host_inventory/linux/memory_spec.rb +145 -0
  384. data/spec/host_inventory/linux/virtualization_docker_spec.rb +134 -0
  385. data/spec/host_inventory/linux/virtualization_kvm_spec.rb +132 -0
  386. data/spec/host_inventory/openbsd/filesystem_spec.rb +43 -0
  387. data/spec/host_inventory/solaris/filesystem_spec.rb +137 -0
  388. data/spec/spec_helper.rb +26 -0
  389. data/specinfra-cisco.gemspec +28 -0
  390. metadata +613 -0
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'amazon' }
4
+
5
+ describe get_command(:check_package_is_installed, 'httpd') do
6
+ it { should eq 'rpm -q httpd' }
7
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'amazon'
5
+
6
+ describe get_command(:enable_service, 'httpd') do
7
+ it { should eq 'chkconfig httpd on' }
8
+ end
9
+
10
+ describe get_command(:disable_service, 'httpd') do
11
+ it { should eq 'chkconfig httpd off' }
12
+ end
13
+
14
+ describe get_command(:start_service, 'httpd') do
15
+ it { should eq 'service httpd start' }
16
+ end
17
+
18
+ describe get_command(:stop_service, 'httpd') do
19
+ it { should eq 'service httpd stop' }
20
+ end
21
+
22
+ describe get_command(:restart_service, 'httpd') do
23
+ it { should eq 'service httpd restart' }
24
+ end
25
+
26
+ describe get_command(:reload_service, 'httpd') do
27
+ it { should eq 'service httpd reload' }
28
+ end
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:check_file_is_directory, '/tmp') do
6
+ it { should eq 'test -d /tmp' }
7
+ end
8
+
9
+ describe get_command(:check_file_is_symlink, '/tmp') do
10
+ it { should eq 'test -L /tmp' }
11
+ end
12
+
13
+ describe get_command(:change_file_mode, '/tmp', '0644') do
14
+ it { should eq 'chmod 0644 /tmp' }
15
+ end
16
+
17
+ describe get_command(:change_file_owner, '/tmp', 'root') do
18
+ it { should eq 'chown root /tmp' }
19
+ end
20
+
21
+ describe get_command(:change_file_owner, '/tmp', 'root', 'root') do
22
+ it { should eq 'chown root:root /tmp' }
23
+ end
24
+
25
+ describe get_command(:change_file_group, '/tmp', 'root') do
26
+ it { should eq 'chgrp root /tmp' }
27
+ end
28
+
29
+ describe get_command(:create_file_as_directory, '/tmp') do
30
+ it { should eq 'mkdir -p /tmp' }
31
+ end
32
+
33
+ describe get_command(:get_file_owner_user, '/tmp') do
34
+ it { should eq 'stat -c %U /tmp' }
35
+ end
36
+
37
+ describe get_command(:get_file_owner_group, '/tmp') do
38
+ it { should eq 'stat -c %G /tmp' }
39
+ end
40
+
41
+ describe get_command(:move_file, '/src', '/dest') do
42
+ it { should eq 'mv /src /dest' }
43
+ end
44
+
45
+ describe get_command(:link_file_to, '/link', '/target') do
46
+ it { should eq 'ln -s /target /link' }
47
+ end
48
+
49
+ describe get_command(:link_file_to, '/link', '/target', :force => true) do
50
+ it { should eq 'ln -sf /target /link' }
51
+ end
52
+
53
+ describe get_command(:remove_file, '/tmp') do
54
+ it { should eq 'rm -rf /tmp' }
55
+ end
56
+
57
+ describe get_command(:check_file_is_link, '/tmp') do
58
+ it { should eq 'test -L /tmp' }
59
+ end
60
+
61
+ describe get_command(:check_file_is_pipe, '/tmp') do
62
+ it { should eq 'test -p /tmp' }
63
+ end
64
+
65
+ describe get_command(:check_file_is_block_device, '/tmp') do
66
+ it { should eq 'test -b /tmp' }
67
+ end
68
+
69
+ describe get_command(:check_file_is_character_device, '/tmp') do
70
+ it { should eq 'test -c /tmp' }
71
+ end
72
+
73
+ describe get_command(:get_file_link_target, '/tmp') do
74
+ it { should eq 'readlink /tmp' }
75
+ end
76
+
77
+ describe get_command(:check_file_exists, '/tmp') do
78
+ it { should eq 'test -e /tmp' }
79
+ end
80
+
81
+ describe get_command(:get_file_mtime, '/tmp') do
82
+ it { should eq 'stat -c %Y /tmp' }
83
+ end
84
+
85
+ describe get_command(:get_file_size, '/tmp') do
86
+ it { should eq 'stat -c %s /tmp' }
87
+ end
88
+
89
+ describe get_command(:download_file, 'http://example.com/sample_file', '/tmp/sample_file') do
90
+ it { should eq 'curl -sSL http://example.com/sample_file -o /tmp/sample_file' }
91
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:get_group_gid, 'foo') do
6
+ it { should eq "getent group foo | cut -f 3 -d ':'" }
7
+ end
8
+
9
+ describe get_command(:update_group_gid, 'foo', 1234) do
10
+ it { should eq "groupmod -g 1234 foo" }
11
+ end
12
+
13
+ describe get_command(:add_group, 'foo', :gid => 1234) do
14
+ it { should eq 'groupadd -g 1234 foo' }
15
+ end
16
+
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:check_localhost_is_ec2_instance) do
6
+ it { should eq 'curl --connect-timeout=1 http://169.254.169.254:80/' }
7
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:check_package_is_installed_by_gem, 'serverspec', '2.0.0') do
6
+ it { should eq 'gem list --local | grep -iw -- \\^serverspec | grep -w -- "[( ]2.0.0[,)]"' }
7
+ end
8
+
9
+ describe get_command(:check_package_is_installed_by_rvm, 'rbx', '2.4.1') do
10
+ it { should eq 'rvm list strings | grep -iw -- \\^rbx | grep -w -- 2.4.1' }
11
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:get_user_uid, 'foo') do
6
+ it { should eq 'id -u foo' }
7
+ end
8
+
9
+ describe get_command(:get_user_gid, 'foo') do
10
+ it { should eq 'id -g foo' }
11
+ end
12
+
13
+ describe get_command(:get_user_home_directory, 'foo') do
14
+ it { should eq "getent passwd foo | awk -F: '{ print $6 }'" }
15
+ end
16
+
17
+ describe get_command(:update_user_home_directory, 'user', 'dir') do
18
+ it { should eq "usermod -d dir user" }
19
+ end
20
+
21
+ describe get_command(:update_user_uid, 'foo', 100) do
22
+ it { should eq 'usermod -u 100 foo' }
23
+ end
24
+
25
+ describe get_command(:update_user_gid, 'foo', 100) do
26
+ it { should eq 'usermod -g 100 foo' }
27
+ end
28
+
29
+ describe get_command(:add_user, 'foo', :home_directory => '/home/foo', :password => '$6$foo/bar', :shell => '/bin/tcsh', :create_home => true) do
30
+ it { should eq 'useradd -d /home/foo -p \$6\$foo/bar -s /bin/tcsh -m foo' }
31
+ end
32
+
33
+ describe get_command(:update_user_encrypted_password, 'foo', 'xxxxxxxx') do
34
+ it { should eq 'echo foo:xxxxxxxx | chpasswd -e' }
35
+ end
36
+
37
+ describe get_command(:get_user_encrypted_password, 'foo') do
38
+ it { should eq "getent shadow foo | awk -F: '{ print $2 }'" }
39
+ end
40
+
41
+ describe get_command(:check_user_has_login_shell, 'foo', '/bin/sh') do
42
+ it { should eq "getent passwd foo | cut -f 7 -d ':' | grep -w -- /bin/sh" }
43
+ end
44
+
45
+ describe get_command(:get_user_minimum_days_between_password_change, 'foo') do
46
+ it { should eq "chage -l foo | grep '^Minimum.*:' | awk -F ': ' '{print $2}'" }
47
+ end
48
+
49
+ describe get_command(:get_user_maximum_days_between_password_change, 'foo') do
50
+ it { should eq "chage -l foo | grep '^Maximum.*:' | awk -F ': ' '{print $2}'" }
51
+ end
52
+
53
+ describe get_command(:get_user_login_shell, 'foo') do
54
+ it { should eq "getent passwd foo | cut -f 7 -d ':'" }
55
+ end
56
+
57
+ describe get_command(:update_user_login_shell, 'foo', '/bin/bash') do
58
+ it { should eq 'usermod -s /bin/bash foo' }
59
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'darwin'
5
+
6
+ describe get_command(:get_file_sha256sum, '/etc/services') do
7
+ it { should eq 'ruby -e "require \'digest\'; puts Digest::SHA256.hexdigest File.read \'/etc/services\'"' }
8
+ end
9
+
10
+ describe get_command(:check_file_is_owned_by, '/tmp', 'root') do
11
+ it { should eq 'stat -f %Su /tmp | grep -- \\^root\\$' }
12
+ end
13
+
14
+ describe get_command(:check_file_is_grouped, '/tmp', 'wheel') do
15
+ it { should eq 'stat -f %Sg /tmp | grep -- \\^wheel\\$' }
16
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'darwin' }
4
+
5
+ describe get_command(:check_user_has_home_directory, 'foo', '/Users/foo') do
6
+ it { should eq "finger foo | grep -E '^Directory' | awk '{ print $2 }' | grep -E '^/Users/foo$'" }
7
+ end
8
+
9
+ describe get_command(:check_user_has_login_shell, 'foo', '/bin/bash') do
10
+ it { should eq "finger foo | grep -E '^Directory' | awk '{ print $4 }' | grep -E '^/bin/bash$'" }
11
+ end
12
+
13
+ describe get_command(:get_user_home_directory, 'foo') do
14
+ it { should eq "finger foo | grep -E '^Directory' | awk '{ print $2 }'" }
15
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian'
5
+
6
+ describe get_command(:enable_service, 'apache2') do
7
+ it { should eq 'update-rc.d apache2 defaults' }
8
+ end
9
+
10
+ describe get_command(:disable_service, 'apache2') do
11
+ it { should eq 'update-rc.d -f apache2 remove' }
12
+ end
13
+
14
+ describe get_command(:start_service, 'apache2') do
15
+ it { should eq 'service apache2 start' }
16
+ end
17
+
18
+ describe get_command(:stop_service, 'apache2') do
19
+ it { should eq 'service apache2 stop' }
20
+ end
21
+
22
+ describe get_command(:restart_service, 'apache2') do
23
+ it { should eq 'service apache2 restart' }
24
+ end
25
+
26
+ describe get_command(:reload_service, 'apache2') do
27
+ it { should eq 'service apache2 reload' }
28
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, { :family => 'esxi' }
5
+
6
+ describe get_command(:check_package_is_installed, 'httpd') do
7
+ it { should eq 'esxcli software vib list | grep httpd' }
8
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'create_command_class work correctly' do
4
+ before do
5
+ property[:os] = nil
6
+ end
7
+
8
+ context 'family: base, release: nil' do
9
+ before do
10
+ set :os, :family => 'base'
11
+ end
12
+ it { expect(Specinfra.command.send(:create_command_class, 'file')).to eq Specinfra::Command::Base::File }
13
+ end
14
+
15
+ context 'family: redhat, release: nil' do
16
+ before do
17
+ set :os, :family => 'redhat'
18
+ end
19
+ it { expect(Specinfra.command.send(:create_command_class, 'file')).to eq Specinfra::Command::Redhat::Base::File }
20
+
21
+ it { expect(Specinfra.command.send(:create_command_class, 'selinux')).to eq Specinfra::Command::Linux::Base::Selinux }
22
+ end
23
+
24
+ context 'family: redhat, release: 7' do
25
+ before do
26
+ set :os, :family => 'redhat', :release => 7
27
+ end
28
+ it { expect(Specinfra.command.send(:create_command_class, 'file')).to eq Specinfra::Command::Redhat::V7::File }
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'freebsd'
5
+
6
+ describe get_command(:check_file_is_owned_by, '/tmp', 'root') do
7
+ it { should eq 'stat -f%Su /tmp | grep -- \\^root\\$' }
8
+ end
9
+
10
+ describe get_command(:check_file_is_grouped, '/tmp', 'wheel') do
11
+ it { should eq 'stat -f%Sg /tmp | grep -- \\^wheel\\$' }
12
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'freebsd'
5
+
6
+ describe get_command(:check_interface_has_ipv6_address, 'vtnet0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
7
+ it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee '" }
8
+ end
9
+
10
+ describe get_command(:check_interface_has_ipv6_address, 'vtnet0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
11
+ it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee prefixlen 64'" }
12
+ end
13
+
14
+ describe get_command(:check_interface_has_ipv6_address, 'vtnet0', 'fe80::5054:ff:fe01:10ee/64') do
15
+ it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vtnet0 prefixlen 64'" }
16
+ end
17
+
18
+ describe get_command(:check_interface_has_ipv6_address, 'vtnet0', 'fe80::5054:ff:fe01:10ee') do
19
+ it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vtnet0 '" }
20
+ end
21
+
22
+ describe get_command(:check_interface_has_ipv4_address, 'vtnet0', '192.168.0.123') do
23
+ it { should eq "ifconfig vtnet0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
24
+ end
25
+
26
+ describe get_command(:check_interface_has_ipv4_address, 'vtnet0', '192.168.0.123/24') do
27
+ it { should eq "ifconfig vtnet0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
28
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'linux'
5
+
6
+ describe get_command(:check_bond_exists, 'bond0') do
7
+ it { should eq "ip link show bond0" }
8
+ end
9
+
10
+ describe get_command(:check_bond_has_interface, 'br0', 'eth0') do
11
+ it { should eq "grep -o 'Slave Interface: eth0' /proc/net/bonding/br0" }
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'linux'
5
+
6
+ describe get_command(:check_bridge_exists, 'br0') do
7
+ it { should eq "ip link show br0" }
8
+ end
9
+
10
+ describe get_command(:check_bridge_has_interface, 'br0', 'eth0') do
11
+ it { should eq "brctl show br0 | grep -o eth0" }
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'linux'
5
+
6
+ describe get_command(:check_file_is_immutable, 'some_file') do
7
+ it { should eq "lsattr -d some_file 2>&1 | awk '$1~/^[A-Za-z-]+$/ && $1~/i/ {exit 0} {exit 1}'" }
8
+ end
9
+
10
+ describe get_command(:get_file_selinuxlabel, 'some_file') do
11
+ it { should eq 'stat -c %C some_file' }
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'linux'
5
+
6
+ describe get_command(:check_interface_has_ipv6_address, 'eth0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
7
+ it { should eq "ip -6 addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/'" }
8
+ end
9
+
10
+ describe get_command(:check_interface_has_ipv6_address, 'eth0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
11
+ it { should eq "ip -6 addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64 '" }
12
+ end
13
+
14
+ describe get_command(:check_interface_has_ipv4_address, 'eth0', '192.168.0.123') do
15
+ it { should eq "ip -4 addr show eth0 | grep 'inet 192\\.168\\.0\\.123/'" }
16
+ end
17
+
18
+ describe get_command(:check_interface_has_ipv4_address, 'eth0', '192.168.0.123/24') do
19
+ it { should eq "ip -4 addr show eth0 | grep 'inet 192\\.168\\.0\\.123/24 '" }
20
+ end
21
+
22
+ describe get_command(:get_interface_link_state, 'eth0') do
23
+ it { should eq "cat /sys/class/net/eth0/operstate" }
24
+ end