Skip to content

Commit

Permalink
[miq_memcached.rb] Use AwesomeSpawn::CommandResultError for rescue
Browse files Browse the repository at this point in the history
Fixes a bug introduced by changing Miq.runcmd to use AwesomeSpawn to get
a proper output from the error instead of what was generated by
awesomespawn (which is the CMD + the existatus)
  • Loading branch information
NickLaMuro authored and root committed Feb 24, 2020
1 parent 8a7cd9b commit 02c5d63
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/miq_memcached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ def self.restart!(opts = {})

def self.killall
MiqUtil.runcmd("killall -9 memcached")
rescue => err
raise unless err.to_s =~ /memcached: no process/
rescue AwesomeSpawn::CommandResultError => err
raise unless err.result.output =~ /memcached: no process/
end

def self.status
begin
res = MiqUtil.runcmd('service memcached status').to_s.chomp
rescue RuntimeError => err
rescue AwesomeSpawn::CommandResultError => err
return false, err.result.output.chomp
rescue => err
return false, err.to_s.chomp
else
return true, res
Expand Down

0 comments on commit 02c5d63

Please sign in to comment.