repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/windows/feature_spec.rb | spec/type/windows/feature_spec.rb | require 'spec_helper'
set :backend, :cmd
set :os, :family => 'windows'
describe windows_feature('Minesweeper') do
it{ should be_installed }
end
describe windows_feature('IIS-Webserver') do
it{ should be_installed.by(:dism) }
end
describe windows_feature('Web-Webserver') do
it{ should be_installed.by(:powersh... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/windows/user_spec.rb | spec/type/windows/user_spec.rb | require 'spec_helper'
set :backend, :cmd
set :os, :family => 'windows'
describe user('test.user') do
it { should exist }
end
describe user('test.domain\test.user') do
it { should exist }
end
describe user('test.user') do
it { should belong_to_group 'test.group' }
end
describe user('test.user.domain\test.use... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/freebsd/port_spec.rb | spec/type/freebsd/port_spec.rb | require 'spec_helper'
set :os, :family => 'freebsd'
describe port(80) do
it { should be_listening }
end
describe port(80) do
it { should be_listening.with('tcp') }
end
describe port(80) do
it do
expect {
should be_listening.with('not implemented')
}.to raise_error(ArgumentError, %r/\A`be_listen... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/freebsd/file_spec.rb | spec/type/freebsd/file_spec.rb | require 'spec_helper'
set :os, :family => 'freebsd'
describe file('/etc/passwd') do
it { should be_mode 644 }
end
describe file('/etc/passwd') do
it { should be_owned_by 'root' }
end
describe file('/etc/passwd') do
it { should be_grouped_into 'root' }
end
describe file('/sbin/nologin') do
it { should be_li... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/freebsd/package_spec.rb | spec/type/freebsd/package_spec.rb | require 'spec_helper'
set :os, :family => 'freebsd'
describe package('httpd') do
it { should be_installed }
end
describe package('httpd') do
it { should be_installed.with_version('2.2.15-28.el6') }
end
describe package('httpd') do
let(:stdout) { "2.2.15\n" }
its(:version) { should eq '2.2.15' }
its(:versi... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/freebsd/service_spec.rb | spec/type/freebsd/service_spec.rb | require 'spec_helper'
set :os, :family => 'freebsd'
describe service('sshd') do
it { should be_enabled }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/fedora20/service_spec.rb | spec/type/fedora20/service_spec.rb | require 'spec_helper'
set :os, :family => 'fedora', :release => 20
describe service('sshd') do
it { should be_enabled }
end
describe service('sshd') do
it { should be_enabled.with_level(4) }
end
describe service('sshd') do
it { should be_running }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/fedora/service_spec.rb | spec/type/fedora/service_spec.rb | require 'spec_helper'
set :os, :family => 'fedora'
describe service('sshd') do
it { should be_enabled }
end
describe service('sshd') do
it { should be_enabled.with_level(4) }
end
describe service('sshd') do
it { should be_running }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/port_spec.rb | spec/type/solaris/port_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe port(80) do
it { should be_listening }
end
describe port(80) do
it { should be_listening.with('tcp') }
end
describe port(80) do
it do
expect {
should be_listening.with('not implemented')
}.to raise_error(ArgumentError, %r/\A`be_listen... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/file_spec.rb | spec/type/solaris/file_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe file('/tmp') do
it { should be_readable.by_user('mail') }
end
describe file('/tmp') do
it { should be_writable.by_user('mail') }
end
describe file('/tmp') do
it { should be_executable.by_user('mail') }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/group_spec.rb | spec/type/solaris/group_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe group('root') do
it { should have_gid 0 }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/ipnat_spec.rb | spec/type/solaris/ipnat_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe ipnat do
it { should have_rule 'map net1 192.168.0.0/24 -> 0.0.0.0/32' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/package_spec.rb | spec/type/solaris/package_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe package('httpd') do
it { should be_installed }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/service_spec.rb | spec/type/solaris/service_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe service('sshd') do
it { should be_enabled }
end
describe service('sshd') do
it { should be_running }
end
describe service('sshd') do
it { should have_property :foo => 'bar' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/ipfilter_spec.rb | spec/type/solaris/ipfilter_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe ipfilter do
it { should have_rule 'pass in quick on lo0 all' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/zfs_spec.rb | spec/type/solaris/zfs_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe zfs('rpool') do
it { should exist }
end
describe zfs('rpool') do
it { should have_property 'mountpoint' => '/rpool' }
end
describe zfs('rpool') do
it { should have_property 'mountpoint' => '/rpool', 'compression' => 'off' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/cron_spec.rb | spec/type/solaris/cron_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe cron do
it { should have_entry '* * * * * /usr/local/bin/batch.sh' }
end
describe cron do
it { should have_entry('* * * * * /usr/local/bin/batch.sh').with_user('root') }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/host_spec.rb | spec/type/solaris/host_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe host('127.0.0.1') do
it { should be_reachable }
end
describe host('127.0.0.1') do
it { should be_reachable.with(:proto => 'icmp', :timeout=> 1) }
end
describe host('127.0.0.1') do
it { should be_reachable.with(:proto => 'tcp', :port => 22, :timeout=... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris/user_spec.rb | spec/type/solaris/user_spec.rb | require 'spec_helper'
set :os, :family => 'solaris'
describe user('root') do
it { should belong_to_group 'root' }
end
describe user('root') do
it { should have_login_shell '/bin/bash' }
end
describe user('root') do
it { should have_home_directory '/root' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris10/file_spec.rb | spec/type/solaris10/file_spec.rb | require 'spec_helper'
set :os, :family => 'solaris', :release => 10
describe file('/etc/ssh/sshd_config') do
it { should be_file }
end
describe file('/etc/ssh') do
it { should be_directory }
end
describe file('/var/run/unicorn.sock') do
it { should be_socket }
end
describe file('/etc/ssh/sshd_config') do
i... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris10/group_spec.rb | spec/type/solaris10/group_spec.rb | require 'spec_helper'
set :os, :family => 'solaris', :release => 10
describe group('root') do
it { should exist }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris10/package_spec.rb | spec/type/solaris10/package_spec.rb | require 'spec_helper'
set :os, :family => 'solaris', :release => 10
describe package('httpd') do
it { should be_installed }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris10/host_spec.rb | spec/type/solaris10/host_spec.rb | require 'spec_helper'
set :os, :family => 'solaris', :release => 10
describe host('127.0.0.1') do
it { should be_reachable }
end
describe host('127.0.0.1') do
it { should be_reachable.with(:proto => 'icmp', :timeout=> 1) }
end
describe host('127.0.0.1') do
it { should be_reachable.with(:proto => 'tcp', :port ... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/type/solaris10/user_spec.rb | spec/type/solaris10/user_spec.rb | require 'spec_helper'
set :os, :family => 'solaris', :release => 10
describe user('root') do
it { should have_authorized_key 'XXXXXXXXXXXXXXX' }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/spec/helper/type_spec.rb | spec/helper/type_spec.rb | require 'spec_helper'
describe String do
subject { String.new }
it { should_not respond_to :host }
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec.rb | lib/serverspec.rb | require 'rubygems'
require 'rspec'
require 'rspec/its'
require 'specinfra'
require 'serverspec/version'
require 'serverspec/matcher'
require 'serverspec/helper'
require 'serverspec/setup'
require 'serverspec/subject'
require 'serverspec/commands/base'
require 'rspec/core/formatters/base_formatter'
require 'specinfra/he... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/version.rb | lib/serverspec/version.rb | module Serverspec
VERSION = "2.43.0"
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/setup.rb | lib/serverspec/setup.rb | require 'pathname'
require 'fileutils'
require 'erb'
module Serverspec
class Setup
def self.run
ask_os_type
if @os_type == 'UN*X'
ask_unix_backend
else
ask_windows_backend
end
if @backend_type == 'ssh'
print 'Vagrant instance y/n: '
@vagrant = $std... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher.rb | lib/serverspec/matcher.rb | # file
require 'serverspec/matcher/be_mounted'
require 'serverspec/matcher/contain'
require 'serverspec/matcher/be_readable'
require 'serverspec/matcher/be_writable'
require 'serverspec/matcher/be_executable'
# port
require 'serverspec/matcher/be_listening'
# host
require 'serverspec/matcher/be_resolvable'
require 's... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/helper.rb | lib/serverspec/helper.rb | # Subject type helper
require 'serverspec/helper/type'
extend Serverspec::Helper::Type
class RSpec::Core::ExampleGroup
extend Serverspec::Helper::Type
include Serverspec::Helper::Type
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/subject.rb | lib/serverspec/subject.rb | module Serverspec
class Subject
def value(v=nil)
if v.nil?
@value
else
@value = v
self
end
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/power_assert.rb | lib/serverspec/power_assert.rb | require 'test/unit'
require 'specinfra'
require 'serverspec/helper/type'
PowerAssert.configure do |c|
c.lazy_inspection = true
end
class Serverspec::TestCase < Test::Unit::TestCase
extend Serverspec::Helper::Type
include Serverspec::Helper::Type
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_monitored_by.rb | lib/serverspec/matcher/be_monitored_by.rb | RSpec::Matchers.define :be_monitored_by do |monitor|
match do |service|
service.monitored_by?(monitor, @monitor_name)
end
description do
if @monitor_name
"be monitored by #{monitor} with name #{@monitor_name}"
else
"be monitored by #{monitor}"
end
end
chain :with_name do |nam... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/belong_to_group.rb | lib/serverspec/matcher/belong_to_group.rb | RSpec::Matchers.define :belong_to_group do |group|
match do |user|
user.belongs_to_group?(group)
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/have_site_bindings.rb | lib/serverspec/matcher/have_site_bindings.rb | RSpec::Matchers.define :have_site_bindings do |port|
match do |subject|
if subject.class.name == 'Serverspec::Type::IisWebsite'
subject.has_site_bindings?(port, @protocol, @ipaddress, @host_header)
else
className = subject.class.name
raise "not supported class #{className}"
end
end
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_readable.rb | lib/serverspec/matcher/be_readable.rb | RSpec::Matchers.define :be_readable do
match do |file|
file.readable?(@by_whom, @by_user)
end
chain :by do |by_whom|
@by_whom = by_whom
end
chain :by_user do |by_user|
@by_user = by_user
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/have_rule.rb | lib/serverspec/matcher/have_rule.rb | RSpec::Matchers.define :have_rule do |rule|
match do |subject|
if subject.class.name == 'Serverspec::Type::Iptables' || subject.class.name == 'Serverspec::Type::Ip6tables'
subject.has_rule?(rule, @table, @chain)
else
subject.has_rule?(rule)
end
end
description do
message = %Q{have rul... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_writable.rb | lib/serverspec/matcher/be_writable.rb | RSpec::Matchers.define :be_writable do
match do |file|
file.writable?(@by_whom, @by_user)
end
chain :by do |by_whom|
@by_whom = by_whom
end
chain :by_user do |by_user|
@by_user = by_user
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/have_site_application.rb | lib/serverspec/matcher/have_site_application.rb | RSpec::Matchers.define :have_site_application do |app|
match do |subject|
if subject.class.name == 'Serverspec::Type::IisWebsite'
subject.has_site_application?(app, @pool, @physical_path)
else
className = subject.class.name
raise "not supported class #{className}"
end
end
chain :wit... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_resolvable.rb | lib/serverspec/matcher/be_resolvable.rb | RSpec::Matchers.define :be_resolvable do
match do |name|
name.resolvable?(@type)
end
chain :by do |type|
@type = type
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_listening.rb | lib/serverspec/matcher/be_listening.rb | RSpec::Matchers.define :be_listening do
match do |port|
port.listening? @with, @local_address
end
description do
message = 'be listening'
message << " on #{@local_address}" if @local_address
message << " with #{@with}" if @with
message
end
chain :with do |with|
@with = with
end
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_reachable.rb | lib/serverspec/matcher/be_reachable.rb | RSpec::Matchers.define :be_reachable do
match do |host|
proto = 'tcp'
timeout = 5
if @attr
port = @attr[:port]
proto = @attr[:proto] if @attr[:proto]
timeout = @attr[:timeout] if @attr[:timeout]
end
host.reachable?(port, proto, timeout)
end
chain :with do |attr|
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/belong_to_primary_group.rb | lib/serverspec/matcher/belong_to_primary_group.rb | RSpec::Matchers.define :belong_to_primary_group do |group|
match do |user|
user.belongs_to_primary_group?(group)
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/contain.rb | lib/serverspec/matcher/contain.rb | RSpec::Matchers.define :contain do |pattern|
match do |resource|
if resource.is_a?(String)
resource.match(Regexp.new([@from, pattern, @to].compact.join.gsub('/', '.*'), Regexp::MULTILINE))
else
resource.contain(pattern, @from, @to)
end
end
# for contain(pattern).from(/A/).to(/B/)
chain ... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_enforcing.rb | lib/serverspec/matcher/be_enforcing.rb | RSpec::Matchers.define :be_enforcing do
match do |selinux|
selinux.enforcing?(@with_policy)
end
chain :with_policy do |with_policy|
@with_policy = with_policy
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/have_entry.rb | lib/serverspec/matcher/have_entry.rb | RSpec::Matchers.define :have_entry do |entry|
match do |subject|
if subject.class.name == 'Serverspec::Type::Cron'
subject.has_entry?(@user, entry)
elsif subject.respond_to?(:has_entry?)
subject.has_entry?(entry)
end
end
# For cron type
chain :with_user do |user|
@user = user
end
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_mounted.rb | lib/serverspec/matcher/be_mounted.rb | RSpec::Matchers.define :be_mounted do
match do |path|
path.mounted?(@attr, @only_with)
end
chain :with do |attr|
@attr = attr
@only_with = false
end
chain :only_with do |attr|
@attr = attr
@only_with = true
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/have_virtual_dir.rb | lib/serverspec/matcher/have_virtual_dir.rb | RSpec::Matchers.define :have_virtual_dir do |vdir|
match do |subject|
if subject.class.name == 'Serverspec::Type::IisWebsite'
subject.has_virtual_dir?(vdir, @path)
else
className = subject.class.name
raise "not supported class #{className}"
end
end
chain :with_path do |path|
@pa... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_installed.rb | lib/serverspec/matcher/be_installed.rb | RSpec::Matchers.define :be_installed do
match do |subject|
if subject.class.name == 'Serverspec::Type::SelinuxModule'
subject.installed?(@version)
else
subject.installed?(@provider, @version)
end
end
description do
message = 'be installed'
message << %( by "#{@provider}") if @prov... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_running.rb | lib/serverspec/matcher/be_running.rb | RSpec::Matchers.define :be_running do
match do |subject|
if subject.class.name == 'Serverspec::Type::Service'
subject.running?(@under)
else
subject.running?
end
end
description do
message = 'be running'
message << " under #{@under}" if @under
message
end
chain :under do |... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_permissive.rb | lib/serverspec/matcher/be_permissive.rb | RSpec::Matchers.define :be_permissive do
match do |selinux|
selinux.permissive?(@with_policy)
end
chain :with_policy do |with_policy|
@with_policy = with_policy
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_enabled.rb | lib/serverspec/matcher/be_enabled.rb | RSpec::Matchers.define :be_enabled do
match do |subject|
if subject.class.name == 'Serverspec::Type::Service'
subject.enabled?(@level, @under)
else
subject.enabled?
end
end
description do
message = 'be enabled'
message << " under #{@under}" if @under
message << " with level #{... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/matcher/be_executable.rb | lib/serverspec/matcher/be_executable.rb | RSpec::Matchers.define :be_executable do
match do |file|
file.executable?(@by_whom, @by_user)
end
chain :by do |by_whom|
@by_whom = by_whom
end
chain :by_user do |by_user|
@by_user = by_user
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/command.rb | lib/serverspec/type/command.rb | require 'multi_json'
module Serverspec::Type
class Command < Base
def stdout
command_result.stdout
end
def stdout_as_json
MultiJson.load(command_result.stdout)
end
def stderr
command_result.stderr
end
def exit_status
command_result.exit_status.to_i
end
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/cron.rb | lib/serverspec/type/cron.rb | module Serverspec::Type
class Cron < Base
def has_entry?(user, entry)
@runner.check_cron_has_entry(user, entry)
end
def table
@runner.get_cron_table.stdout
end
def to_s
'Cron'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/port.rb | lib/serverspec/type/port.rb | require 'resolv'
module Serverspec::Type
class Port < Base
def protocols
%w(udp tcp tcp6 udp6)
end
def options
@options ||= {}
end
def protocol_matcher(protocol)
protocol = protocol.to_s.downcase
if protocols.include?(protocol)
options[:protocol] = protocol
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/windows_registry_key.rb | lib/serverspec/type/windows_registry_key.rb | module Serverspec::Type
class WindowsRegistryKey < Base
def exists?
@runner.check_registry_key_exists(@name)
end
def has_property?(property_name, property_type = :type_string)
@runner.check_registry_key_has_property(@name, {:name => property_name, :type => property_type})
end
def has... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/fstab.rb | lib/serverspec/type/fstab.rb | module Serverspec::Type
class Fstab < Base
def has_entry?(entry)
@runner.check_fstab_has_entry(entry)
end
def to_s
'Fstab'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/mysql_config.rb | lib/serverspec/type/mysql_config.rb | module Serverspec::Type
class MysqlConfig < Base
def value
ret = @runner.run_command("mysqld --verbose --help 2> /dev/null | grep '^#{@name}'")
val = ret.stdout.match(/#{@name}\s+(.+)$/)[1]
val = val.to_i if val.match(/^\d+$/)
val
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/x509_certificate.rb | lib/serverspec/type/x509_certificate.rb | require 'time'
module Serverspec::Type
class X509Certificate < Base
def certificate?
(run_openssl_command_with("-noout").exit_status == 0)
end
def subject
normalize_dn(run_openssl_command_with("-subject -noout").stdout.chomp.gsub(/^subject= */,''))
end
def issuer
normalize_dn(... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/cgroup.rb | lib/serverspec/type/cgroup.rb | module Serverspec::Type
class Cgroup < Base
attr_accessor :subsystem
def method_missing(meth)
if @subsystem.nil?
@subsystem = meth.to_s
self
else
param = "#{@subsystem}.#{meth.to_s}"
ret = @runner.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/group.rb | lib/serverspec/type/group.rb | module Serverspec::Type
class Group < Base
def exists?
@runner.check_group_exists(@name)
end
def gid
@runner.get_group_gid(@name).stdout.to_i
end
def has_gid?(gid)
@runner.check_group_has_gid(@name, gid)
end
def is_system_group?
@runner.check_group_is_system_grou... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/ppa.rb | lib/serverspec/type/ppa.rb | module Serverspec::Type
class Ppa < Base
def exists?
@runner.check_ppa_exists(@name)
end
def enabled?
@runner.check_ppa_is_enabled(@name)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/iptables.rb | lib/serverspec/type/iptables.rb | module Serverspec::Type
class Iptables < Base
def has_rule?(rule, table, chain)
@runner.check_iptables_has_rule(rule, table, chain)
end
def to_s
'iptables'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/kernel_module.rb | lib/serverspec/type/kernel_module.rb | module Serverspec::Type
class KernelModule < Base
def loaded?
@runner.check_kernel_module_is_loaded(@name)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/selinux_module.rb | lib/serverspec/type/selinux_module.rb | module Serverspec::Type
class SelinuxModule < Base
def enabled?
@runner.check_selinux_module_is_enabled(@name)
end
def installed?(version = nil)
@runner.check_selinux_module_is_installed(@name, version)
end
def to_s
%(SELinux module "#{@name}")
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/x509_private_key.rb | lib/serverspec/type/x509_private_key.rb | require 'time'
module Serverspec::Type
class X509PrivateKey < Base
def valid?
runner_res = @runner.run_command("echo | openssl rsa -in #{name} -check -noout -passin #{@options[:passin] || "stdin"}")
( runner_res.exit_status == 0 && runner_res.stdout.chomp == 'RSA key ok' ) && (!@options.has_key?(:pas... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/package.rb | lib/serverspec/type/package.rb | module Serverspec::Type
class Package < Base
def installed?(provider=nil, version=nil)
if provider.nil?
@inspection = Specinfra.command.get(:check_package_is_installed, @name, version)
@runner.check_package_is_installed(@name, version)
else
check_method = "check_package_is_inst... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/host.rb | lib/serverspec/type/host.rb | module Serverspec::Type
class Host < Base
def resolvable?(type)
@runner.check_host_is_resolvable(@name, type)
end
def reachable?(port, proto, timeout)
@runner.check_host_is_reachable(@name, port, proto, timeout)
end
def ipaddress
@runner.get_host_ipaddress(@name).stdout.strip
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/interface.rb | lib/serverspec/type/interface.rb | module Serverspec::Type
class Interface < Base
def exists?
@runner.check_interface_exists(@name)
end
def speed
ret = @runner.get_interface_speed_of(@name)
val_to_integer(ret)
end
def mtu
ret = @runner.get_interface_mtu_of(@name)
val_to_integer(ret)
end
def ... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/mail_alias.rb | lib/serverspec/type/mail_alias.rb | module Serverspec::Type
class MailAlias < Base
def aliased_to?(target)
@runner.check_mail_alias_is_aliased_to(@name, target)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/linux_kernel_parameter.rb | lib/serverspec/type/linux_kernel_parameter.rb | module Serverspec::Type
class LinuxKernelParameter < Base
def value
ret = @runner.run_command("/sbin/sysctl -q -n #{@name}")
val = ret.stdout.strip
val = val.to_i if val.match(/^\d+$/)
val
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/file.rb | lib/serverspec/type/file.rb | require 'date'
require 'multi_json'
require 'yaml'
module Serverspec::Type
class File < Base
attr_accessor :content
def file?
cmd = Specinfra.command.get(:check_file_is_file, @name)
@inspection = Specinfra.backend.build_command(cmd.to_s)
@runner.check_file_is_file(@name)
end
def b... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/yumrepo.rb | lib/serverspec/type/yumrepo.rb | module Serverspec::Type
class Yumrepo < Base
def exists?
@runner.check_yumrepo_exists(@name)
end
def enabled?
@runner.check_yumrepo_is_enabled(@name)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/selinux.rb | lib/serverspec/type/selinux.rb | module Serverspec::Type
class Selinux < Base
def disabled?
@runner.check_selinux_has_mode('disabled')
end
def enforcing?(with_policy)
@runner.check_selinux_has_mode('enforcing', with_policy)
end
def permissive?(with_policy)
@runner.check_selinux_has_mode('permissive', with_poli... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/bridge.rb | lib/serverspec/type/bridge.rb | module Serverspec::Type
class Bridge < Base
def exists?
@runner.check_bridge_exists(@name)
end
def has_interface?(interface)
@runner.check_bridge_has_interface(@name, interface)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/windows_firewall.rb | lib/serverspec/type/windows_firewall.rb | module Serverspec::Type
class WindowsFirewall < Base
def exists?
@runner.check_firewall_exists(@name)
end
def tcp?
@runner.check_firewall_has_protocol(@name, 'TCP')
end
def has_localport?(port)
@runner.check_firewall_has_localport(@name, port)
end
def inbound?
@r... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/php_extension.rb | lib/serverspec/type/php_extension.rb | module Serverspec::Type
class PhpExtension < Base
def loaded?
ret = @runner.run_command("php --ri '#{@name}'")
return false if ret.exit_status.to_i > 0
true
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/ip6tables.rb | lib/serverspec/type/ip6tables.rb | module Serverspec
module Type
class Ip6tables < Base
def has_rule?(rule, table, chain)
@runner.check_ip6tables_has_rule(rule, table, chain)
end
def to_s
'ip6tables'
end
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/ipnat.rb | lib/serverspec/type/ipnat.rb | module Serverspec::Type
class Ipnat < Base
def has_rule?(rule)
@runner.check_ipnat_has_rule(rule)
end
def to_s
'ipnat'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/docker_base.rb | lib/serverspec/type/docker_base.rb | require 'multi_json'
module Serverspec::Type
class DockerBase < Base
def exist?
get_inspection.success?
end
def [](key)
value = inspection
key.split('.').each do |k|
is_index = k.start_with?('[') && k.end_with?(']')
value = value[is_index ? k[1..-2].to_i : k]
end
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/base.rb | lib/serverspec/type/base.rb | module Serverspec::Type
class Base
attr_reader :name
def initialize(name=nil, options = {})
@name = name
@options = options
@runner = Specinfra::Runner
end
def to_s
type = self.class.name.split(':')[-1]
type.gsub!(/([a-z\d])([A-Z])/, '\1 \2')
type.cap... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/routing_table.rb | lib/serverspec/type/routing_table.rb | module Serverspec::Type
class RoutingTable < Base
def has_entry?(entry)
@runner.check_routing_table_has_entry(entry)
end
def to_s
'Routing Table'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/lxc.rb | lib/serverspec/type/lxc.rb | module Serverspec::Type
class Lxc < Base
def exists?
@runner.check_lxc_container_exists(@name)
end
def running?
@runner.check_lxc_container_is_running(@name)
end
def to_s
'LXC'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/windows_scheduled_task.rb | lib/serverspec/type/windows_scheduled_task.rb | module Serverspec::Type
class WindowsScheduledTask < Base
def exists?
@runner.check_scheduled_task_exists(@name)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/process.rb | lib/serverspec/type/process.rb | module Serverspec::Type
class Process < Base
def running?
pid = @runner.get_process(@name, :format => "pid=").stdout
not pid.empty?
end
def user
get_column("user")
end
def group
get_column("group")
end
def count
@runner.count_process(@name).stdout.strip.to_... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/kvm.rb | lib/serverspec/type/kvm.rb | module Serverspec::Type
class Kvm < Base
def exists?
@runner.check_kvm_guest_exists(@name)
end
def running?
@runner.check_kvm_guest_is_running(@name)
end
def enabled?
@runner.check_kvm_guest_is_enabled(@name)
end
def to_s
'KVM'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/php_config.rb | lib/serverspec/type/php_config.rb | module Serverspec::Type
class PhpConfig < Base
def value
extra = '';
extra = extra + "-c #{@options[:ini]}" if @options.has_key?(:ini)
ret = @runner.run_command("php #{extra} -r 'echo get_cfg_var( \"#{@name}\" );'")
val = ret.stdout
val = val.to_i if val.match(/^\d+$/)
val
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/ipfilter.rb | lib/serverspec/type/ipfilter.rb | module Serverspec::Type
class Ipfilter < Base
def has_rule?(rule)
@runner.check_ipfilter_has_rule(rule)
end
def to_s
'ipfilter'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/windows_feature.rb | lib/serverspec/type/windows_feature.rb | module Serverspec::Type
class WindowsFeature < Base
def installed?(provider, version)
@runner.check_feature_is_enabled(@name, provider)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/windows_hot_fix.rb | lib/serverspec/type/windows_hot_fix.rb | module Serverspec::Type
class WindowsHotFix < Base
def installed?(provider, version)
@runner.check_hot_fix_is_installed(@name, version)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/iis_app_pool.rb | lib/serverspec/type/iis_app_pool.rb | module Serverspec::Type
class IisAppPool < Base
def exists?()
@runner.check_iis_app_pool_exists(@name)
end
def has_dotnet_version?(dotnet)
@runner.check_iis_app_pool_has_dotnet_version(@name, dotnet)
end
def has_32bit_enabled?()
@runner.check_iis_app_pool_has_32bit_enabled(@nam... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/service.rb | lib/serverspec/type/service.rb | module Serverspec::Type
class Service < Base
def enabled?(level, under=nil)
under = under ? "_under_#{under.gsub(/^under_/, '')}" : ''
check_method = "check_service_is_enabled#{under}"
if level
@runner.send(check_method.to_sym, @name, level)
else
@runner.send(check_method.... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/iis_website.rb | lib/serverspec/type/iis_website.rb | module Serverspec::Type
class IisWebsite < Base
def exists?()
@runner.check_iis_website_is_installed(@name)
end
def enabled?()
@runner.check_iis_website_is_enabled(@name)
end
def running?()
@runner.check_iis_website_is_running(@name)
end
def in_app_pool?(app_pool)
... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/default_gateway.rb | lib/serverspec/type/default_gateway.rb | module Serverspec::Type
class DefaultGateway < Base
def ipaddress
@runner.get_default_gateway(:gateway)
end
def interface
@runner.get_default_gateway(:interface)
end
def to_s
'Default Gateway'
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/bond.rb | lib/serverspec/type/bond.rb | module Serverspec::Type
class Bond < Base
def exists?
@runner.check_bond_exists(@name)
end
def has_interface?(interface)
@runner.check_bond_has_interface(@name, interface)
end
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/zfs.rb | lib/serverspec/type/zfs.rb | module Serverspec::Type
class Zfs < Base
def exists?
@runner.check_zfs_exists(@name)
end
def has_property?(property)
@runner.check_zfs_has_property(@name, property)
end
def to_s
'ZFS'
end
def property
get_property if @property.nil?
@property
end
pr... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/linux_audit_system.rb | lib/serverspec/type/linux_audit_system.rb | module Serverspec::Type
class LinuxAuditSystem < Base
def initialize(name=nil)
@name = 'linux_audit_system'
@runner = Specinfra::Runner
@rules_content = nil
end
def enabled?
status_of('enabled') == '1'
end
def running?
pid = status_of('pid')
(!pid.nil? && pid.... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/docker_image.rb | lib/serverspec/type/docker_image.rb | module Serverspec::Type
class DockerImage < DockerBase
end
end
| ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
mizzy/serverspec | https://github.com/mizzy/serverspec/blob/a0acb13102f60b89c7e4e74b679b7786df6c97a6/lib/serverspec/type/docker_container.rb | lib/serverspec/type/docker_container.rb | module Serverspec::Type
class DockerContainer < DockerBase
def running?
inspection['State']['Running'] && !inspection['State']['Restarting']
end
def has_volume?(container_path, host_path)
if (inspection['Mounts'])
check_volume(container_path, host_path)
else
check_volume... | ruby | MIT | a0acb13102f60b89c7e4e74b679b7786df6c97a6 | 2026-01-04T15:54:51.970620Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.