Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check installed and check running for solaris family #202

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/serverspec/commands/smartos.rb
Expand Up @@ -8,6 +8,14 @@ def check_installed(package, version=nil)
end
cmd
end

def check_enabled(service, level=3)
"svcs -l #{escape(service)} 2> /dev/null | grep -wx '^enabled.*true$'"
end

def check_running(service)
"svcs -l #{escape(service)} status 2> /dev/null |grep -wx '^state.*online$'"
end
end
end
end
4 changes: 2 additions & 2 deletions lib/serverspec/commands/solaris.rb
Expand Up @@ -2,7 +2,7 @@ module Serverspec
module Commands
class Solaris < Base
def check_enabled(service, level=3)
"svcs -l #{escape(service)} 2> /dev/null | grep -wx '^enabled.*true$'"
"svcs -l #{escape(service)} 2> /dev/null | egrep '^enabled *true$'"
end

def check_installed(package, version=nil)
Expand All @@ -19,7 +19,7 @@ def check_listening(port)
end

def check_running(service)
"svcs -l #{escape(service)} status 2> /dev/null |grep -wx '^state.*online$'"
"svcs -l #{escape(service)} status 2> /dev/null | egrep '^state *online$'"
end

def check_cron_entry(user, entry)
Expand Down
4 changes: 2 additions & 2 deletions spec/solaris/commands_spec.rb
Expand Up @@ -21,12 +21,12 @@

describe 'check_enabled' do
subject { commands.check_enabled('httpd') }
it { should eq "svcs -l httpd 2> /dev/null | grep -wx '^enabled.*true$'" }
it { should eq "svcs -l httpd 2> /dev/null | egrep '^enabled *true$'" }
end

describe 'check_running' do
subject { commands.check_running('httpd') }
it { should eq "svcs -l httpd status 2> /dev/null |grep -wx '^state.*online$'" }
it { should eq "svcs -l httpd status 2> /dev/null | egrep '^state *online$'" }
end

describe 'check_belonging_group' do
Expand Down
4 changes: 2 additions & 2 deletions spec/solaris10/commands_spec.rb
Expand Up @@ -20,12 +20,12 @@

describe 'check_enabled' do
subject { commands.check_enabled('httpd') }
it { should eq "svcs -l httpd 2> /dev/null | grep -wx '^enabled.*true$'" }
it { should eq "svcs -l httpd 2> /dev/null | egrep '^enabled *true$'" }
end

describe 'check_running' do
subject { commands.check_running('httpd') }
it { should eq "svcs -l httpd status 2> /dev/null |grep -wx '^state.*online$'" }
it { should eq "svcs -l httpd status 2> /dev/null | egrep '^state *online$'" }
end

describe 'check_belonging_group' do
Expand Down
4 changes: 2 additions & 2 deletions spec/solaris11/commands_spec.rb
Expand Up @@ -21,12 +21,12 @@

describe 'check_enabled' do
subject { commands.check_enabled('httpd') }
it { should eq "svcs -l httpd 2> /dev/null | grep -wx '^enabled.*true$'" }
it { should eq "svcs -l httpd 2> /dev/null | egrep '^enabled *true$'" }
end

describe 'check_running' do
subject { commands.check_running('httpd') }
it { should eq "svcs -l httpd status 2> /dev/null |grep -wx '^state.*online$'" }
it { should eq "svcs -l httpd status 2> /dev/null | egrep '^state *online$'" }
end

describe 'check_belonging_group' do
Expand Down