diff --git a/lib/serverspec/commands/smartos.rb b/lib/serverspec/commands/smartos.rb index 5fb00b02..8ace1b33 100644 --- a/lib/serverspec/commands/smartos.rb +++ b/lib/serverspec/commands/smartos.rb @@ -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 diff --git a/lib/serverspec/commands/solaris.rb b/lib/serverspec/commands/solaris.rb index 81b50ee2..27267a7e 100644 --- a/lib/serverspec/commands/solaris.rb +++ b/lib/serverspec/commands/solaris.rb @@ -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) @@ -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) diff --git a/spec/solaris/commands_spec.rb b/spec/solaris/commands_spec.rb index 8575be69..70447082 100644 --- a/spec/solaris/commands_spec.rb +++ b/spec/solaris/commands_spec.rb @@ -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 diff --git a/spec/solaris10/commands_spec.rb b/spec/solaris10/commands_spec.rb index 074f1724..d279eedc 100644 --- a/spec/solaris10/commands_spec.rb +++ b/spec/solaris10/commands_spec.rb @@ -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 diff --git a/spec/solaris11/commands_spec.rb b/spec/solaris11/commands_spec.rb index 196153a2..f1b1ece3 100644 --- a/spec/solaris11/commands_spec.rb +++ b/spec/solaris11/commands_spec.rb @@ -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