specinfra-rb19 2.44.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.gitmodules +3 -0
- data/.travis.yml +19 -0
- data/Gemfile +4 -0
- data/Guardfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +43 -0
- data/appveyor.yml +56 -0
- data/examples/multiple_backends.rb +46 -0
- data/lib/specinfra.rb +45 -0
- data/lib/specinfra/backend.rb +12 -0
- data/lib/specinfra/backend/base.rb +55 -0
- data/lib/specinfra/backend/cmd.rb +68 -0
- data/lib/specinfra/backend/docker.rb +113 -0
- data/lib/specinfra/backend/dockerfile.rb +32 -0
- data/lib/specinfra/backend/exec.rb +152 -0
- data/lib/specinfra/backend/lxc.rb +45 -0
- data/lib/specinfra/backend/powershell/command.rb +40 -0
- data/lib/specinfra/backend/powershell/script_helper.rb +86 -0
- data/lib/specinfra/backend/powershell/support/check_file_access_rules.ps1 +8 -0
- data/lib/specinfra/backend/powershell/support/crop_text.ps1 +11 -0
- data/lib/specinfra/backend/powershell/support/find_group.ps1 +8 -0
- data/lib/specinfra/backend/powershell/support/find_iis_component.ps1 +90 -0
- data/lib/specinfra/backend/powershell/support/find_installed_application.ps1 +37 -0
- data/lib/specinfra/backend/powershell/support/find_installed_hot_fix.ps1 +18 -0
- data/lib/specinfra/backend/powershell/support/find_scheduled_task.ps1 +7 -0
- data/lib/specinfra/backend/powershell/support/find_service.ps1 +5 -0
- data/lib/specinfra/backend/powershell/support/find_user.ps1 +8 -0
- data/lib/specinfra/backend/powershell/support/find_usergroup.ps1 +9 -0
- data/lib/specinfra/backend/powershell/support/is_port_listening.ps1 +15 -0
- data/lib/specinfra/backend/powershell/support/is_remote_port_listening.ps1 +51 -0
- data/lib/specinfra/backend/powershell/support/list_windows_features.ps1 +68 -0
- data/lib/specinfra/backend/shell_script.rb +29 -0
- data/lib/specinfra/backend/ssh.rb +185 -0
- data/lib/specinfra/backend/telnet.rb +111 -0
- data/lib/specinfra/backend/winrm.rb +29 -0
- data/lib/specinfra/command.rb +311 -0
- data/lib/specinfra/command/aix.rb +1 -0
- data/lib/specinfra/command/aix/base.rb +2 -0
- data/lib/specinfra/command/aix/base/file.rb +21 -0
- data/lib/specinfra/command/aix/base/group.rb +8 -0
- data/lib/specinfra/command/aix/base/host.rb +17 -0
- data/lib/specinfra/command/aix/base/inventory.rb +38 -0
- data/lib/specinfra/command/aix/base/package.rb +11 -0
- data/lib/specinfra/command/aix/base/port.rb +8 -0
- data/lib/specinfra/command/aix/base/service.rb +11 -0
- data/lib/specinfra/command/aix/base/user.rb +15 -0
- data/lib/specinfra/command/alpine.rb +1 -0
- data/lib/specinfra/command/alpine/base.rb +2 -0
- data/lib/specinfra/command/alpine/base/package.rb +19 -0
- data/lib/specinfra/command/alpine/base/process.rb +20 -0
- data/lib/specinfra/command/alpine/base/service.rb +11 -0
- data/lib/specinfra/command/amazon.rb +2 -0
- data/lib/specinfra/command/amazon/base.rb +2 -0
- data/lib/specinfra/command/arch.rb +1 -0
- data/lib/specinfra/command/arch/base.rb +11 -0
- data/lib/specinfra/command/arch/base/file.rb +14 -0
- data/lib/specinfra/command/arch/base/package.rb +30 -0
- data/lib/specinfra/command/arch/base/service.rb +5 -0
- data/lib/specinfra/command/base.rb +21 -0
- data/lib/specinfra/command/base/bond.rb +2 -0
- data/lib/specinfra/command/base/bridge.rb +2 -0
- data/lib/specinfra/command/base/cron.rb +17 -0
- data/lib/specinfra/command/base/file.rb +179 -0
- data/lib/specinfra/command/base/fstab.rb +2 -0
- data/lib/specinfra/command/base/group.rb +26 -0
- data/lib/specinfra/command/base/host.rb +36 -0
- data/lib/specinfra/command/base/interface.rb +2 -0
- data/lib/specinfra/command/base/inventory.rb +2 -0
- data/lib/specinfra/command/base/ip6tables.rb +2 -0
- data/lib/specinfra/command/base/ipfilter.rb +2 -0
- data/lib/specinfra/command/base/ipnat.rb +2 -0
- data/lib/specinfra/command/base/iptables.rb +2 -0
- data/lib/specinfra/command/base/kernel_module.rb +2 -0
- data/lib/specinfra/command/base/localhost.rb +7 -0
- data/lib/specinfra/command/base/lxc_container.rb +2 -0
- data/lib/specinfra/command/base/mail_alias.rb +15 -0
- data/lib/specinfra/command/base/package.rb +51 -0
- data/lib/specinfra/command/base/port.rb +10 -0
- data/lib/specinfra/command/base/ppa.rb +2 -0
- data/lib/specinfra/command/base/process.rb +15 -0
- data/lib/specinfra/command/base/routing_table.rb +9 -0
- data/lib/specinfra/command/base/selinux.rb +2 -0
- data/lib/specinfra/command/base/selinux_module.rb +2 -0
- data/lib/specinfra/command/base/service.rb +15 -0
- data/lib/specinfra/command/base/user.rb +94 -0
- data/lib/specinfra/command/base/yumrepo.rb +3 -0
- data/lib/specinfra/command/base/zfs.rb +1 -0
- data/lib/specinfra/command/coreos.rb +1 -0
- data/lib/specinfra/command/coreos/base.rb +2 -0
- data/lib/specinfra/command/coreos/base/service.rb +5 -0
- data/lib/specinfra/command/cumulus.rb +11 -0
- data/lib/specinfra/command/cumulus/base.rb +2 -0
- data/lib/specinfra/command/cumulus/base/ppa.rb +17 -0
- data/lib/specinfra/command/cumulus/base/service.rb +7 -0
- data/lib/specinfra/command/darwin.rb +1 -0
- data/lib/specinfra/command/darwin/base.rb +2 -0
- data/lib/specinfra/command/darwin/base/file.rb +47 -0
- data/lib/specinfra/command/darwin/base/host.rb +39 -0
- data/lib/specinfra/command/darwin/base/interface.rb +42 -0
- data/lib/specinfra/command/darwin/base/inventory.rb +28 -0
- data/lib/specinfra/command/darwin/base/package.rb +51 -0
- data/lib/specinfra/command/darwin/base/port.rb +8 -0
- data/lib/specinfra/command/darwin/base/process.rb +7 -0
- data/lib/specinfra/command/darwin/base/service.rb +11 -0
- data/lib/specinfra/command/darwin/base/user.rb +15 -0
- data/lib/specinfra/command/debian.rb +1 -0
- data/lib/specinfra/command/debian/base.rb +11 -0
- data/lib/specinfra/command/debian/base/package.rb +33 -0
- data/lib/specinfra/command/debian/base/ppa.rb +2 -0
- data/lib/specinfra/command/debian/base/service.rb +32 -0
- data/lib/specinfra/command/debian/v8.rb +2 -0
- data/lib/specinfra/command/debian/v8/service.rb +5 -0
- data/lib/specinfra/command/esxi.rb +1 -0
- data/lib/specinfra/command/esxi/base.rb +2 -0
- data/lib/specinfra/command/esxi/base/package.rb +7 -0
- data/lib/specinfra/command/fedora.rb +1 -0
- data/lib/specinfra/command/fedora/base.rb +2 -0
- data/lib/specinfra/command/fedora/base/service.rb +11 -0
- data/lib/specinfra/command/fedora/v15.rb +2 -0
- data/lib/specinfra/command/fedora/v15/service.rb +5 -0
- data/lib/specinfra/command/freebsd.rb +1 -0
- data/lib/specinfra/command/freebsd/base.rb +3 -0
- data/lib/specinfra/command/freebsd/base/file.rb +49 -0
- data/lib/specinfra/command/freebsd/base/host.rb +24 -0
- data/lib/specinfra/command/freebsd/base/interface.rb +42 -0
- data/lib/specinfra/command/freebsd/base/inventory.rb +28 -0
- data/lib/specinfra/command/freebsd/base/package.rb +19 -0
- data/lib/specinfra/command/freebsd/base/port.rb +8 -0
- data/lib/specinfra/command/freebsd/base/routing_table.rb +9 -0
- data/lib/specinfra/command/freebsd/base/service.rb +11 -0
- data/lib/specinfra/command/freebsd/base/user.rb +20 -0
- data/lib/specinfra/command/freebsd/v10.rb +2 -0
- data/lib/specinfra/command/freebsd/v10/package.rb +31 -0
- data/lib/specinfra/command/freebsd/v6.rb +2 -0
- data/lib/specinfra/command/freebsd/v6/user.rb +19 -0
- data/lib/specinfra/command/gentoo.rb +1 -0
- data/lib/specinfra/command/gentoo/base.rb +2 -0
- data/lib/specinfra/command/gentoo/base/package.rb +7 -0
- data/lib/specinfra/command/gentoo/base/service.rb +19 -0
- data/lib/specinfra/command/linux.rb +1 -0
- data/lib/specinfra/command/linux/base.rb +2 -0
- data/lib/specinfra/command/linux/base/bond.rb +11 -0
- data/lib/specinfra/command/linux/base/bridge.rb +11 -0
- data/lib/specinfra/command/linux/base/file.rb +20 -0
- data/lib/specinfra/command/linux/base/fstab.rb +9 -0
- data/lib/specinfra/command/linux/base/interface.rb +38 -0
- data/lib/specinfra/command/linux/base/inventory.rb +41 -0
- data/lib/specinfra/command/linux/base/ip6tables.rb +15 -0
- data/lib/specinfra/command/linux/base/iptables.rb +12 -0
- data/lib/specinfra/command/linux/base/kernel_module.rb +7 -0
- data/lib/specinfra/command/linux/base/lxc_container.rb +11 -0
- data/lib/specinfra/command/linux/base/package.rb +2 -0
- data/lib/specinfra/command/linux/base/ppa.rb +2 -0
- data/lib/specinfra/command/linux/base/selinux.rb +13 -0
- data/lib/specinfra/command/linux/base/selinux_module.rb +16 -0
- data/lib/specinfra/command/linux/base/service.rb +2 -0
- data/lib/specinfra/command/linux/base/yumrepo.rb +2 -0
- data/lib/specinfra/command/linux/base/zfs.rb +5 -0
- data/lib/specinfra/command/module.rb +7 -0
- data/lib/specinfra/command/module/service/daemontools.rb +46 -0
- data/lib/specinfra/command/module/service/delegator.rb +20 -0
- data/lib/specinfra/command/module/service/god.rb +13 -0
- data/lib/specinfra/command/module/service/init.rb +42 -0
- data/lib/specinfra/command/module/service/monit.rb +13 -0
- data/lib/specinfra/command/module/service/runit.rb +13 -0
- data/lib/specinfra/command/module/service/supervisor.rb +13 -0
- data/lib/specinfra/command/module/service/systemd.rb +41 -0
- data/lib/specinfra/command/module/service/upstart.rb +13 -0
- data/lib/specinfra/command/module/ss.rb +39 -0
- data/lib/specinfra/command/module/systemd.rb +12 -0
- data/lib/specinfra/command/module/zfs.rb +25 -0
- data/lib/specinfra/command/nixos.rb +1 -0
- data/lib/specinfra/command/nixos/base.rb +2 -0
- data/lib/specinfra/command/nixos/base/package.rb +17 -0
- data/lib/specinfra/command/nixos/base/service.rb +5 -0
- data/lib/specinfra/command/openbsd.rb +1 -0
- data/lib/specinfra/command/openbsd/base.rb +4 -0
- data/lib/specinfra/command/openbsd/base/bond.rb +11 -0
- data/lib/specinfra/command/openbsd/base/bridge.rb +11 -0
- data/lib/specinfra/command/openbsd/base/file.rb +47 -0
- data/lib/specinfra/command/openbsd/base/fstab.rb +9 -0
- data/lib/specinfra/command/openbsd/base/host.rb +17 -0
- data/lib/specinfra/command/openbsd/base/interface.rb +47 -0
- data/lib/specinfra/command/openbsd/base/inventory.rb +33 -0
- data/lib/specinfra/command/openbsd/base/mail_alias.rb +8 -0
- data/lib/specinfra/command/openbsd/base/package.rb +15 -0
- data/lib/specinfra/command/openbsd/base/port.rb +7 -0
- data/lib/specinfra/command/openbsd/base/routing_table.rb +9 -0
- data/lib/specinfra/command/openbsd/base/service.rb +19 -0
- data/lib/specinfra/command/openbsd/base/user.rb +11 -0
- data/lib/specinfra/command/openbsd/v57.rb +2 -0
- data/lib/specinfra/command/openbsd/v57/service.rb +35 -0
- data/lib/specinfra/command/opensuse.rb +1 -0
- data/lib/specinfra/command/opensuse/base.rb +3 -0
- data/lib/specinfra/command/opensuse/base/service.rb +12 -0
- data/lib/specinfra/command/plamo.rb +1 -0
- data/lib/specinfra/command/plamo/base.rb +3 -0
- data/lib/specinfra/command/plamo/base/package.rb +11 -0
- data/lib/specinfra/command/plamo/base/service.rb +14 -0
- data/lib/specinfra/command/poky.rb +1 -0
- data/lib/specinfra/command/poky/base.rb +2 -0
- data/lib/specinfra/command/poky/base/interface.rb +2 -0
- data/lib/specinfra/command/poky/base/inventory.rb +2 -0
- data/lib/specinfra/command/poky/base/package.rb +26 -0
- data/lib/specinfra/command/poky/base/service.rb +5 -0
- data/lib/specinfra/command/raspbian.rb +1 -0
- data/lib/specinfra/command/redhat.rb +1 -0
- data/lib/specinfra/command/redhat/base.rb +2 -0
- data/lib/specinfra/command/redhat/base/file.rb +8 -0
- data/lib/specinfra/command/redhat/base/host.rb +2 -0
- data/lib/specinfra/command/redhat/base/iptables.rb +11 -0
- data/lib/specinfra/command/redhat/base/package.rb +39 -0
- data/lib/specinfra/command/redhat/base/port.rb +2 -0
- data/lib/specinfra/command/redhat/base/service.rb +2 -0
- data/lib/specinfra/command/redhat/base/yumrepo.rb +13 -0
- data/lib/specinfra/command/redhat/v5.rb +3 -0
- data/lib/specinfra/command/redhat/v5/iptables.rb +10 -0
- data/lib/specinfra/command/redhat/v7.rb +3 -0
- data/lib/specinfra/command/redhat/v7/host.rb +15 -0
- data/lib/specinfra/command/redhat/v7/port.rb +5 -0
- data/lib/specinfra/command/redhat/v7/service.rb +5 -0
- data/lib/specinfra/command/smartos.rb +1 -0
- data/lib/specinfra/command/smartos/base.rb +3 -0
- data/lib/specinfra/command/smartos/base/file.rb +11 -0
- data/lib/specinfra/command/smartos/base/package.rb +15 -0
- data/lib/specinfra/command/smartos/base/service.rb +11 -0
- data/lib/specinfra/command/solaris.rb +1 -0
- data/lib/specinfra/command/solaris/base.rb +2 -0
- data/lib/specinfra/command/solaris/base/cron.rb +12 -0
- data/lib/specinfra/command/solaris/base/file.rb +20 -0
- data/lib/specinfra/command/solaris/base/group.rb +8 -0
- data/lib/specinfra/command/solaris/base/host.rb +14 -0
- data/lib/specinfra/command/solaris/base/inventory.rb +42 -0
- data/lib/specinfra/command/solaris/base/ipfilter.rb +7 -0
- data/lib/specinfra/command/solaris/base/ipnat.rb +14 -0
- data/lib/specinfra/command/solaris/base/package.rb +14 -0
- data/lib/specinfra/command/solaris/base/port.rb +13 -0
- data/lib/specinfra/command/solaris/base/service.rb +24 -0
- data/lib/specinfra/command/solaris/base/user.rb +15 -0
- data/lib/specinfra/command/solaris/base/zfs.rb +13 -0
- data/lib/specinfra/command/solaris/v10.rb +2 -0
- data/lib/specinfra/command/solaris/v10/file.rb +42 -0
- data/lib/specinfra/command/solaris/v10/group.rb +7 -0
- data/lib/specinfra/command/solaris/v10/host.rb +13 -0
- data/lib/specinfra/command/solaris/v10/package.rb +11 -0
- data/lib/specinfra/command/solaris/v10/user.rb +18 -0
- data/lib/specinfra/command/suse.rb +1 -0
- data/lib/specinfra/command/suse/base.rb +2 -0
- data/lib/specinfra/command/suse/base/package.rb +21 -0
- data/lib/specinfra/command/suse/base/service.rb +14 -0
- data/lib/specinfra/command/ubuntu.rb +11 -0
- data/lib/specinfra/command/ubuntu/base.rb +2 -0
- data/lib/specinfra/command/ubuntu/base/ppa.rb +17 -0
- data/lib/specinfra/command/ubuntu/base/service.rb +7 -0
- data/lib/specinfra/command/ubuntu/v15.rb +1 -0
- data/lib/specinfra/command/ubuntu/v15/service.rb +5 -0
- data/lib/specinfra/command/windows.rb +1 -0
- data/lib/specinfra/command/windows/base.rb +22 -0
- data/lib/specinfra/command/windows/base/feature.rb +17 -0
- data/lib/specinfra/command/windows/base/file.rb +120 -0
- data/lib/specinfra/command/windows/base/group.rb +11 -0
- data/lib/specinfra/command/windows/base/host.rb +25 -0
- data/lib/specinfra/command/windows/base/hot_fix.rb +19 -0
- data/lib/specinfra/command/windows/base/iis_app_pool.rb +66 -0
- data/lib/specinfra/command/windows/base/iis_website.rb +59 -0
- data/lib/specinfra/command/windows/base/package.rb +11 -0
- data/lib/specinfra/command/windows/base/port.rb +17 -0
- data/lib/specinfra/command/windows/base/process.rb +31 -0
- data/lib/specinfra/command/windows/base/registry_key.rb +53 -0
- data/lib/specinfra/command/windows/base/scheduled_task.rb +10 -0
- data/lib/specinfra/command/windows/base/service.rb +31 -0
- data/lib/specinfra/command/windows/base/user.rb +22 -0
- data/lib/specinfra/command_factory.rb +87 -0
- data/lib/specinfra/command_result.rb +28 -0
- data/lib/specinfra/configuration.rb +62 -0
- data/lib/specinfra/core.rb +18 -0
- data/lib/specinfra/ec2_metadata.rb +93 -0
- data/lib/specinfra/ext.rb +2 -0
- data/lib/specinfra/ext/class.rb +9 -0
- data/lib/specinfra/ext/string.rb +14 -0
- data/lib/specinfra/helper.rb +6 -0
- data/lib/specinfra/helper/configuration.rb +41 -0
- data/lib/specinfra/helper/detect_os.rb +38 -0
- data/lib/specinfra/helper/detect_os/aix.rb +12 -0
- data/lib/specinfra/helper/detect_os/alpine.rb +8 -0
- data/lib/specinfra/helper/detect_os/arch.rb +7 -0
- data/lib/specinfra/helper/detect_os/coreos.rb +18 -0
- data/lib/specinfra/helper/detect_os/darwin.rb +11 -0
- data/lib/specinfra/helper/detect_os/debian.rb +26 -0
- data/lib/specinfra/helper/detect_os/esxi.rb +10 -0
- data/lib/specinfra/helper/detect_os/freebsd.rb +11 -0
- data/lib/specinfra/helper/detect_os/gentoo.rb +7 -0
- data/lib/specinfra/helper/detect_os/nixos.rb +7 -0
- data/lib/specinfra/helper/detect_os/openbsd.rb +11 -0
- data/lib/specinfra/helper/detect_os/plamo.rb +7 -0
- data/lib/specinfra/helper/detect_os/poky.rb +7 -0
- data/lib/specinfra/helper/detect_os/redhat.rb +31 -0
- data/lib/specinfra/helper/detect_os/solaris.rb +17 -0
- data/lib/specinfra/helper/detect_os/suse.rb +15 -0
- data/lib/specinfra/helper/docker.rb +11 -0
- data/lib/specinfra/helper/host_inventory.rb +12 -0
- data/lib/specinfra/helper/lxc.rb +11 -0
- data/lib/specinfra/helper/os.rb +35 -0
- data/lib/specinfra/helper/properties.rb +14 -0
- data/lib/specinfra/helper/set.rb +10 -0
- data/lib/specinfra/host_inventory.rb +69 -0
- data/lib/specinfra/host_inventory/base.rb +14 -0
- data/lib/specinfra/host_inventory/block_device.rb +35 -0
- data/lib/specinfra/host_inventory/cpu.rb +77 -0
- data/lib/specinfra/host_inventory/domain.rb +16 -0
- data/lib/specinfra/host_inventory/ec2.rb +11 -0
- data/lib/specinfra/host_inventory/filesystem.rb +31 -0
- data/lib/specinfra/host_inventory/fqdn.rb +16 -0
- data/lib/specinfra/host_inventory/hostname.rb +16 -0
- data/lib/specinfra/host_inventory/kernel.rb +27 -0
- data/lib/specinfra/host_inventory/memory.rb +83 -0
- data/lib/specinfra/host_inventory/platform.rb +9 -0
- data/lib/specinfra/host_inventory/platform_version.rb +15 -0
- data/lib/specinfra/host_inventory/virtualization.rb +45 -0
- data/lib/specinfra/processor.rb +229 -0
- data/lib/specinfra/properties.rb +17 -0
- data/lib/specinfra/runner.rb +35 -0
- data/lib/specinfra/version.rb +3 -0
- data/spec/backend/exec/build_command_spec.rb +152 -0
- data/spec/backend/exec/child_process_spec.rb +18 -0
- data/spec/backend/exec/env_spec.rb +16 -0
- data/spec/backend/exec/read_noblock_spec.rb +50 -0
- data/spec/backend/exec/stdxxx_handler_spec.rb +25 -0
- data/spec/backend/ssh/build_command_spec.rb +115 -0
- data/spec/command/amazon/interface_spec.rb +9 -0
- data/spec/command/amazon/package_spec.rb +7 -0
- data/spec/command/amazon/service_spec.rb +28 -0
- data/spec/command/base/file_spec.rb +91 -0
- data/spec/command/base/group_spec.rb +16 -0
- data/spec/command/base/host_spec.rb +23 -0
- data/spec/command/base/localhost_spec.rb +7 -0
- data/spec/command/base/mail_alias.rb +17 -0
- data/spec/command/base/package_spec.rb +11 -0
- data/spec/command/base/user_spec.rb +59 -0
- data/spec/command/darwin/file_spec.rb +16 -0
- data/spec/command/darwin/host_spec.rb +38 -0
- data/spec/command/darwin/interface_spec.rb +38 -0
- data/spec/command/darwin/process_spec.rb +7 -0
- data/spec/command/darwin/user_spec.rb +15 -0
- data/spec/command/debian/service_spec.rb +28 -0
- data/spec/command/esxi/package_spec.rb +8 -0
- data/spec/command/factory_spec.rb +30 -0
- data/spec/command/freebsd/file_spec.rb +12 -0
- data/spec/command/freebsd/host_spec.rb +24 -0
- data/spec/command/freebsd/interface_spec.rb +32 -0
- data/spec/command/linux/bond_spec.rb +12 -0
- data/spec/command/linux/bridge_spec.rb +12 -0
- data/spec/command/linux/file_spec.rb +12 -0
- data/spec/command/linux/interface_spec.rb +24 -0
- data/spec/command/linux/inventory_spec.rb +20 -0
- data/spec/command/linux/ip6tables_spec.rb +7 -0
- data/spec/command/linux/selinux_module_spec.rb +12 -0
- data/spec/command/linux/selinux_spec.rb +27 -0
- data/spec/command/module/service/daemontools_spec.rb +18 -0
- data/spec/command/module/service/init_spec.rb +18 -0
- data/spec/command/module/service/systemd_spec.rb +16 -0
- data/spec/command/module/ss_spec.rb +28 -0
- data/spec/command/module/systemd_spec.rb +19 -0
- data/spec/command/module/zfs_spec.rb +6 -0
- data/spec/command/openbsd/file_spec.rb +12 -0
- data/spec/command/openbsd/host_spec.rb +24 -0
- data/spec/command/openbsd/interface_spec.rb +38 -0
- data/spec/command/openbsd/mail_alias_spec.rb +19 -0
- data/spec/command/openbsd/service_spec.rb +12 -0
- data/spec/command/openbsd57/service_spec.rb +36 -0
- data/spec/command/redhat/package_spec.rb +8 -0
- data/spec/command/redhat/service_spec.rb +28 -0
- data/spec/command/redhat7/host_spec.rb +25 -0
- data/spec/command/redhat7/interface_spec.rb +9 -0
- data/spec/command/redhat7/port_spec.rb +8 -0
- data/spec/command/redhat7/service_spec.rb +32 -0
- data/spec/command/ubuntu/ppa_spec.rb +12 -0
- data/spec/command/windows/registry_key_spec.rb +36 -0
- data/spec/configuration_spec.rb +14 -0
- data/spec/helper/detect_os/aix_spec.rb +58 -0
- data/spec/helper/detect_os/darwin_spec.rb +42 -0
- data/spec/helper/detect_os/esxi_spec.rb +22 -0
- data/spec/helper/detect_os/freebsd_spec.rb +42 -0
- data/spec/helper/detect_os/openbsd_spec.rb +42 -0
- data/spec/helper/os_spec.rb +58 -0
- data/spec/helper/properties_spec.rb +11 -0
- data/spec/helper/set_spec.rb +14 -0
- data/spec/host_inventory/aix/filesystem_spec.rb +107 -0
- data/spec/host_inventory/darwin/filesystem_spec.rb +63 -0
- data/spec/host_inventory/freebsd/filesystem_spec.rb +123 -0
- data/spec/host_inventory/linux/block_device_spec.rb +46 -0
- data/spec/host_inventory/linux/cpu_spec.rb +123 -0
- data/spec/host_inventory/linux/filesystem_spec.rb +53 -0
- data/spec/host_inventory/linux/kernel_spec.rb +33 -0
- data/spec/host_inventory/linux/memory_spec.rb +145 -0
- data/spec/host_inventory/linux/virtualization_spec.rb +44 -0
- data/spec/host_inventory/openbsd/filesystem_spec.rb +43 -0
- data/spec/host_inventory/openbsd/virtualization_spec.rb +27 -0
- data/spec/host_inventory/solaris/filesystem_spec.rb +137 -0
- data/spec/host_inventory/solaris/virtualization_spec.rb +28 -0
- data/spec/spec_helper.rb +26 -0
- data/specinfra.gemspec +31 -0
- metadata +638 -0
@@ -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,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'freebsd'
|
5
|
+
|
6
|
+
describe get_command(:check_host_is_reachable, 'pink.unicorn.com', nil, 'tcp', 10) do
|
7
|
+
it { should eq "ping -t 10 -c 2 -n pink.unicorn.com"}
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_host_is_reachable, 'pink.unicorn.com', 53, 'udp', 66) do
|
11
|
+
it { should eq "nc -vvvvzu pink.unicorn.com 53 -w 66" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:get_host_ipaddress, 'pink.unicorn.com') do
|
15
|
+
it { should eq "getent hosts pink.unicorn.com | awk '{print $1; exit}'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:get_host_ipv4_address, 'pink.unicorn.com') do
|
19
|
+
it { should eq "getent hosts pink.unicorn.com | awk '$1 ~ /^[0-9.]+$/ {print $1}'" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:get_host_ipv6_address, 'pink.unicorn.com') do
|
23
|
+
it { should eq "getent hosts pink.unicorn.com | awk 'tolower($1) ~ /^[0-9a-f:]+$/ {print $1}'" }
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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
|
29
|
+
|
30
|
+
describe get_command(:get_interface_link_state, 'vtnet0') do
|
31
|
+
it { should eq %Q{ifconfig -u vtnet0 2>&1 | awk -v s=up '/status:/ && $2 != "active" { s="down" }; END {print s}'} }
|
32
|
+
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, :family => 'linux'
|
4
|
+
|
5
|
+
describe get_command(:get_inventory_memory) do
|
6
|
+
it { should eq 'cat /proc/meminfo' }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe get_command(:get_inventory_cpu) do
|
10
|
+
it { should eq 'cat /proc/cpuinfo' }
|
11
|
+
end
|
12
|
+
|
13
|
+
describe get_command(:get_inventory_kernel) do
|
14
|
+
it { should eq 'uname -s -r' }
|
15
|
+
end
|
16
|
+
|
17
|
+
describe get_command(:get_inventory_block_device) do
|
18
|
+
block_device_dirs = '/sys/block/*/{size,removable,device/{model,rev,state,timeout,vendor},queue/rotational}'
|
19
|
+
it { should eq "for f in $(ls #{block_device_dirs}); do echo -e \"${f}\t$(cat ${f})\"; done" }
|
20
|
+
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_selinux_module_is_installed, 'dnsmasq') do
|
7
|
+
it { should eq "semodule -l | grep $'^dnsmasq\\t'" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_selinux_module_is_enabled, 'dnsmasq') do
|
11
|
+
it { should eq "semodule -l | grep $'^dnsmasq\\t' | grep -v $'^dnsmasq\\t.*\\tDisabled$'" }
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'linux'
|
5
|
+
|
6
|
+
describe get_command(:check_selinux_has_mode, 'disabled') do
|
7
|
+
it do
|
8
|
+
should eq %Q{test ! -f /etc/selinux/config || (} +
|
9
|
+
%Q{getenforce | grep -i -- disabled} +
|
10
|
+
%Q{ && grep -iE -- '^\\s*SELINUX=disabled\\>' /etc/selinux/config)}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_selinux_has_mode, 'permissive', nil) do
|
15
|
+
it do
|
16
|
+
should eq %Q{getenforce | grep -i -- permissive} +
|
17
|
+
%Q{ && grep -iE -- '^\\s*SELINUX=permissive\\>' /etc/selinux/config}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe get_command(:check_selinux_has_mode, 'enforcing', 'targeted') do
|
22
|
+
it do
|
23
|
+
should eq %Q{getenforce | grep -i -- enforcing} +
|
24
|
+
%Q{ && grep -iE -- '^\\s*SELINUX=enforcing\\>' /etc/selinux/config} +
|
25
|
+
%Q{ && grep -iE -- '^\\s*SELINUXTYPE=targeted\\>' /etc/selinux/config}
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Module::Service::Daemontools do
|
4
|
+
class Specinfra::Command::Module::Service::Daemontools::Test < Specinfra::Command::Base
|
5
|
+
extend Specinfra::Command::Module::Service::Daemontools
|
6
|
+
end
|
7
|
+
let(:klass) { Specinfra::Command::Module::Service::Daemontools::Test }
|
8
|
+
it { expect(klass.check_is_enabled_under_daemontools('httpd')).to eq "test -L $([ -d /service ] && echo /service || echo /etc/service)/httpd && test -f $([ -d /service ] && echo /service || echo /etc/service)/httpd/run" }
|
9
|
+
it { expect(klass.check_is_running_under_daemontools('httpd')).to eq "svstat $([ -d /service ] && echo /service || echo /etc/service)/httpd | grep -E 'up \\(pid [0-9]+\\)'" }
|
10
|
+
it { expect(klass.enable_under_daemontools('httpd', '/tmp/service/httpd')).to eq 'ln -snf /tmp/service/httpd $([ -d /service ] && echo /service || echo /etc/service)/httpd' }
|
11
|
+
it { expect(klass.disable_under_daemontools('httpd')).to eq '( cd $([ -d /service ] && echo /service || echo /etc/service)/httpd && rm -f $([ -d /service ] && echo /service || echo /etc/service)/httpd && svc -dx . log )' }
|
12
|
+
it { expect(klass.start_under_daemontools('httpd')).to eq 'svc -u $([ -d /service ] && echo /service || echo /etc/service)/httpd' }
|
13
|
+
it { expect(klass.stop_under_daemontools('httpd')).to eq 'svc -d $([ -d /service ] && echo /service || echo /etc/service)/httpd' }
|
14
|
+
it { expect(klass.restart_under_daemontools('httpd')).to eq 'svc -t $([ -d /service ] && echo /service || echo /etc/service)/httpd' }
|
15
|
+
it { expect(klass.reload_under_daemontools('httpd')).to eq 'svc -h $([ -d /service ] && echo /service || echo /etc/service)/httpd' }
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Module::Service::Init do
|
4
|
+
class Specinfra::Command::Module::Service::Init::Test < Specinfra::Command::Base
|
5
|
+
extend Specinfra::Command::Module::Service::Init
|
6
|
+
end
|
7
|
+
let(:klass) { Specinfra::Command::Module::Service::Init::Test }
|
8
|
+
it { expect(klass.check_is_enabled_under_init('httpd')).to eq "chkconfig --list httpd | grep 3:on" }
|
9
|
+
it { expect(klass.check_is_running_under_init('httpd')).to eq 'service httpd status' }
|
10
|
+
it { expect(klass.enable_under_init('httpd')).to eq 'chkconfig httpd on' }
|
11
|
+
it { expect(klass.disable_under_init('httpd')).to eq 'chkconfig httpd off' }
|
12
|
+
it { expect(klass.start_under_init('httpd')).to eq 'service httpd start' }
|
13
|
+
it { expect(klass.stop_under_init('httpd')).to eq 'service httpd stop' }
|
14
|
+
it { expect(klass.restart_under_init('httpd')).to eq 'service httpd restart' }
|
15
|
+
it { expect(klass.reload_under_init('httpd')).to eq 'service httpd reload' }
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Module::Service::Systemd do
|
4
|
+
class Specinfra::Command::Module::Service::Systemd::Test < Specinfra::Command::Base
|
5
|
+
extend Specinfra::Command::Module::Service::Systemd
|
6
|
+
end
|
7
|
+
let(:klass) { Specinfra::Command::Module::Service::Systemd::Test }
|
8
|
+
it { expect(klass.check_is_enabled_under_systemd('httpd')).to eq "systemctl --quiet is-enabled httpd" }
|
9
|
+
it { expect(klass.check_is_running_under_systemd('httpd')).to eq 'systemctl is-active httpd' }
|
10
|
+
it { expect(klass.enable_under_systemd('httpd')).to eq 'systemctl enable httpd' }
|
11
|
+
it { expect(klass.disable_under_systemd('httpd')).to eq 'systemctl disable httpd' }
|
12
|
+
it { expect(klass.start_under_systemd('httpd')).to eq 'systemctl start httpd' }
|
13
|
+
it { expect(klass.stop_under_systemd('httpd')).to eq 'systemctl stop httpd' }
|
14
|
+
it { expect(klass.restart_under_systemd('httpd')).to eq 'systemctl restart httpd' }
|
15
|
+
it { expect(klass.reload_under_systemd('httpd')).to eq 'systemctl reload httpd' }
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Module::Ss do
|
4
|
+
class Specinfra::Command::Module::Ss::Test < Specinfra::Command::Base
|
5
|
+
extend Specinfra::Command::Module::Ss
|
6
|
+
end
|
7
|
+
let(:klass) { Specinfra::Command::Module::Ss::Test }
|
8
|
+
it { expect(klass.check_is_listening('80')).to eq 'ss -tunl | grep -- :80\ ' }
|
9
|
+
|
10
|
+
it { expect(klass.check_is_listening('80', options={:protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- :80\ ' }
|
11
|
+
it { expect(klass.check_is_listening('80', options={:protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- :80\ ' }
|
12
|
+
it { expect(klass.check_is_listening('80', options={:protocol => 'udp'})).to eq 'ss -unl4 | grep -- :80\ ' }
|
13
|
+
it { expect(klass.check_is_listening('80', options={:protocol => 'udp6'})).to eq 'ss -unl6 | grep -- :80\ ' }
|
14
|
+
|
15
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0'})).to eq 'ss -tunl | grep -- \ \*:80\ ' }
|
16
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- \ \*:80\ ' }
|
17
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- \ \*:80\ ' }
|
18
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp'})).to eq 'ss -unl4 | grep -- \ \*:80\ ' }
|
19
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -- \ \*:80\ ' }
|
20
|
+
|
21
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4'})).to eq 'ss -tunl | grep -- \ 1.2.3.4:80\ ' }
|
22
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -- \ 1.2.3.4:80\ ' }
|
23
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -- \ 1.2.3.4:80\ ' }
|
24
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp'})).to eq 'ss -unl4 | grep -- \ 1.2.3.4:80\ ' }
|
25
|
+
it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -- \ 1.2.3.4:80\ ' }
|
26
|
+
|
27
|
+
it { expect{klass.check_is_listening('80', options={:protocol => 'bad_proto'})}.to raise_error(ArgumentError, 'Unknown protocol [bad_proto]') }
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Specinfra::Command::Redhat::V7::Service do
|
4
|
+
let(:klass) { Specinfra::Command::Redhat::V7::Service }
|
5
|
+
it { expect(klass.check_is_enabled('httpd')).to eq "systemctl --quiet is-enabled httpd" }
|
6
|
+
it { expect(klass.check_is_enabled('httpd', 'multi-user.target')).to eq "systemctl --quiet is-enabled httpd" }
|
7
|
+
it { expect(klass.check_is_enabled('httpd.service')).to eq "systemctl --quiet is-enabled httpd.service" }
|
8
|
+
it { expect(klass.check_is_enabled('sshd.socket')).to eq "systemctl --quiet is-enabled sshd.socket" }
|
9
|
+
it { expect(klass.check_is_enabled('logrotate.timer')).to eq "systemctl --quiet is-enabled logrotate.timer" }
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe Specinfra::Command::Solaris::Base::Zfs do
|
3
|
+
let(:klass) { Specinfra::Command::Solaris::Base::Zfs }
|
4
|
+
it { expect(klass.check_exists('rpool')).to eq "zfs list -H rpool" }
|
5
|
+
it { expect(klass.check_has_property('rpool', {'mountpoint' => '/rpool' })).to eq "zfs list -H -o mountpoint rpool | grep -- \\^/rpool\\$" }
|
6
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd'
|
5
|
+
|
6
|
+
describe get_command(:get_file_mtime, '/tmp') do
|
7
|
+
it { should eq 'stat -f %m /tmp' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:get_file_size, '/tmp') do
|
11
|
+
it { should eq 'stat -f %z /tmp' }
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd'
|
5
|
+
|
6
|
+
describe get_command(:check_host_is_reachable, 'pink.unicorn.com', nil, 'tcp', 10) do
|
7
|
+
it { should eq "ping -w 10 -c 2 -n pink.unicorn.com"}
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_host_is_reachable, 'pink.unicorn.com', 53, 'udp', 66) do
|
11
|
+
it { should eq "nc -w 66 -vvvvzu pink.unicorn.com 53" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:get_host_ipaddress, 'pink.unicorn.com') do
|
15
|
+
it { should eq "getent hosts pink.unicorn.com | awk '{print $1; exit}'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:get_host_ipv4_address, 'pink.unicorn.com') do
|
19
|
+
it { should eq "getent hosts pink.unicorn.com | awk '$1 ~ /^[0-9.]+$/ {print $1}'" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:get_host_ipv6_address, 'pink.unicorn.com') do
|
23
|
+
it { should eq "getent hosts pink.unicorn.com | awk 'tolower($1) ~ /^[0-9a-f:]+$/ {print $1}'" }
|
24
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd'
|
5
|
+
|
6
|
+
describe get_command(:get_interface_speed_of, 'vio0') do
|
7
|
+
it { should eq "ifconfig vio0 | grep 'media\:' | perl -pe 's|.*media\:.*\\((.*?)\\)|\\1|'" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
|
11
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee '" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
|
15
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee prefixlen 64'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', 'fe80::5054:ff:fe01:10ee/64') do
|
19
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vio0 prefixlen 64'" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', 'fe80::5054:ff:fe01:10ee') do
|
23
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vio0 '" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:check_interface_has_ipv4_address, 'vio0', '192.168.0.123') do
|
27
|
+
it { should eq "ifconfig vio0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe get_command(:check_interface_has_ipv4_address, 'vio0', '192.168.0.123/24') do
|
31
|
+
it { should eq "ifconfig vio0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe get_command(:get_interface_link_state, 'vio0') do
|
35
|
+
it do should eq %Q{ifconfig vio0 2>&1 | awk -v s=down -F '[:<>,]' } +
|
36
|
+
%Q{'NR == 1 && $3 == "UP" { s="up" }; /status:/ && $2 != " active" { s="down" }; END{ print s }'}
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
set :os, { :family => 'openbsd' }
|
4
|
+
|
5
|
+
describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony') do
|
6
|
+
it do
|
7
|
+
should eq %Q{egrep ^pink:.*\\(\\[\\[:space:\\]\\]\\|,\\)\\[\\\"\\'\\]\\?} +
|
8
|
+
%Q{\\\\\\|/pony\\[\\\"\\'\\]\\?\\(,\\|\\$\\) } +
|
9
|
+
%Q{/etc/mail/aliases}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony, |/unicorn') do
|
14
|
+
it do
|
15
|
+
should eq %Q{egrep ^pink:.*\\(\\[\\[:space:\\]\\]\\|,\\)\\[\\\"\\'\\]\\?} +
|
16
|
+
%Q{\\\\\\|/pony,\\\\\\ \\\\\\|/unicorn\\[\\\"\\'\\]\\?\\(,\\|\\$\\) } +
|
17
|
+
%Q{/etc/mail/aliases}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd'
|
5
|
+
|
6
|
+
describe get_command(:check_service_is_enabled, 'httpd') do
|
7
|
+
it { should eq '/etc/rc.d/httpd status' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_service_is_running, 'httpd') do
|
11
|
+
it { should eq '/etc/rc.d/httpd check' }
|
12
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd', :release => '5.7'
|
5
|
+
|
6
|
+
describe get_command(:check_service_is_enabled, 'httpd') do
|
7
|
+
it { should eq 'rcctl get httpd status' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_service_is_running, 'httpd') do
|
11
|
+
it { should eq 'rcctl check httpd' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:enable_service, 'httpd') do
|
15
|
+
it { should eq 'rcctl set httpd status on' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:disable_service, 'httpd') do
|
19
|
+
it { should eq 'rcctl set httpd status off' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:start_service, 'httpd') do
|
23
|
+
it { should eq 'rcctl start httpd' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:stop_service, 'httpd') do
|
27
|
+
it { should eq 'rcctl stop httpd' }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe get_command(:restart_service, 'httpd') do
|
31
|
+
it { should eq 'rcctl restart httpd' }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe get_command(:reload_service, 'httpd') do
|
35
|
+
it { should eq 'rcctl reload httpd' }
|
36
|
+
end
|