Skip to content

fix freebsd service check#643

Merged
mizzy merged 1 commit intomizzy:masterfrom
b4ldr:fix_freebsd_service
Sep 7, 2017
Merged

fix freebsd service check#643
mizzy merged 1 commit intomizzy:masterfrom
b4ldr:fix_freebsd_service

Conversation

@b4ldr
Copy link
Contributor

@b4ldr b4ldr commented Sep 6, 2017

Hi,

Ill start by saying im not too familiar with your code base and will admit up front im not sure how to test the changes other then manully patching the file on my system and re running my my beacker tests.

The main issues is that the following check is returning false on FreeBSD 10.3, running in VirtualBOX via vagrant.

    describe service('openbgpd') do
      it { is_expected.to be_running }
    end

looking at the code and running it manually via irb suggests that there are unnecessary escape

irb(main):001:0> service = 'openbgpd'
=> "openbgpd"
irb(main):002:0> cmd = "service #{service} status | grep -E 'as \\(pid [0-9]+\\)'"
=> "service openbgpd status | grep -E 'as \\(pid [0-9]+\\)'"
irb(main):003:0> out = `#{cmd}`
=> ""
irb(main):004:0> $?
=> #<Process::Status: pid 2282 exit 1>
irb(main):005:0> cmd = "service #{service} status | grep -E 'as (pid [0-9]+)'"
=> "service openbgpd status | grep -E 'as (pid [0-9]+)'"
irb(main):006:0> out = `#{cmd}`
=> "openbgpd is running as pid 2028.\n"
irb(main):007:0> $?
=> #<Process::Status: pid 2288 exit 0>

hopefully this patch is useful but and happy to work on it more if you point me into the rigvht direction

Thanks

@b4ldr b4ldr force-pushed the fix_freebsd_service branch from f52939a to ffc11b0 Compare September 6, 2017 13:41
@b4ldr
Copy link
Contributor Author

b4ldr commented Sep 6, 2017

update: I have also added freebsd specific process commands. the main one that was failing is the Specinfra::Command::Base::Process.get() as freebsd ps does not support the -C switch. I suspect the others would have worked fine but thought i would update them to use pgrep as well

@mizzy
Copy link
Owner

mizzy commented Sep 7, 2017

LGTM. Thanks.

@mizzy mizzy merged commit ffd41dd into mizzy:master Sep 7, 2017
@mizzy
Copy link
Owner

mizzy commented Sep 7, 2017

Released as v2.71.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants