specinfra-cisco 2.40.2
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 +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -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 +112 -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 +14 -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 +182 -0
- data/lib/specinfra/backend/telnet.rb +111 -0
- data/lib/specinfra/backend/winrm.rb +29 -0
- data/lib/specinfra/command.rb +304 -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 +25 -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 +12 -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 +11 -0
- data/lib/specinfra/command/darwin/base/inventory.rb +28 -0
- data/lib/specinfra/command/darwin/base/package.rb +41 -0
- data/lib/specinfra/command/darwin/base/port.rb +8 -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 +42 -0
- data/lib/specinfra/command/freebsd/base/interface.rb +35 -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 +31 -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 +12 -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/nexus.rb +1 -0
- data/lib/specinfra/command/nexus/base.rb +2 -0
- data/lib/specinfra/command/nexus/base/file.rb +8 -0
- data/lib/specinfra/command/nexus/base/host.rb +2 -0
- data/lib/specinfra/command/nexus/base/iptables.rb +11 -0
- data/lib/specinfra/command/nexus/base/package.rb +30 -0
- data/lib/specinfra/command/nexus/base/port.rb +5 -0
- data/lib/specinfra/command/nexus/base/service.rb +2 -0
- data/lib/specinfra/command/nexus/base/yumrepo.rb +11 -0
- data/lib/specinfra/command/nexus/v7.rb +3 -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/interface.rb +40 -0
- data/lib/specinfra/command/openbsd/base/inventory.rb +28 -0
- data/lib/specinfra/command/openbsd/base/mail_alias.rb +7 -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 +11 -0
- data/lib/specinfra/command/openbsd/base/user.rb +11 -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/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 +37 -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 +113 -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 +83 -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/nexus.rb +14 -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/redhat.rb +31 -0
- data/lib/specinfra/helper/detect_os/solaris.rb +15 -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 +68 -0
- data/lib/specinfra/host_inventory/base.rb +14 -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 +39 -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 +148 -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/localhost_spec.rb +7 -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/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/interface_spec.rb +28 -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 +15 -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 +8 -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/interface_spec.rb +28 -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 +13 -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/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_docker_spec.rb +134 -0
- data/spec/host_inventory/linux/virtualization_kvm_spec.rb +132 -0
- data/spec/host_inventory/openbsd/filesystem_spec.rb +43 -0
- data/spec/host_inventory/solaris/filesystem_spec.rb +137 -0
- data/spec/spec_helper.rb +26 -0
- data/specinfra-cisco.gemspec +28 -0
- metadata +613 -0
@@ -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,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,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
|