Skip to content

Commit

Permalink
Merge pull request #153 from Fryguy/remove_runcmd
Browse files Browse the repository at this point in the history
Remove gems-pending runcmd references in favor of AwesomeSpawn
  • Loading branch information
chessbyte authored Jan 27, 2021
2 parents 03207e0 + 7d51aa7 commit 311a018
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions lib/VmLocalDiskAccess/test/localCfg.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
require 'util/miq-xml'
require 'util/runcmd'
require 'metadata/VmConfig/VmConfig'
require 'VolumeManager/MiqNativeVolumeManager'
require 'fs/MiqMountManager'
require 'awesome_spawn'

module MiqNativeMountManager
LSHW = "lshw"

def self.mountVolumes
lshwXml = MiqUtil.runcmd("#{LSHW} -xml")
lshwXml = AwesomeSpawn.run!("lshw", :params => ["-xml"], :combined_output => true).output
nodeHash = Hash.new { |h, k| h[k] = [] }
doc = MiqXml.load(lshwXml)
doc.find_match("//node").each { |n| nodeHash[n.attributes["id"].split(':', 2)[0]] << n }
Expand Down
6 changes: 2 additions & 4 deletions lib/metadata/VmConfig/GetNativeCfg.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
require 'util/miq-xml'
require 'util/runcmd'
require 'metadata/VmConfig/VmConfig'
require 'awesome_spawn'

class GetNativeCfg
LSHW = "lshw"

def self.new
lshwXml = MiqUtil.runcmd("#{LSHW} -xml")
lshwXml = AwesomeSpawn.run!("lshw", :params => ["-xml"], :combined_output => true).output
nodeHash = Hash.new { |h, k| h[k] = [] }
doc = MiqXml.load(lshwXml)
doc.find_match("//node").each { |n| nodeHash[n.attributes["id"].split(':', 2)[0]] << n }
Expand Down
6 changes: 3 additions & 3 deletions lib/metadata/VmConfig/xmlConfig.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'util/miq-xml'
require 'util/runcmd'
require 'awesome_spawn'

module XmlConfig
def convert(filename)
Expand All @@ -12,9 +12,9 @@ def convert(filename)
if Sys::Platform::IMPL == :linux
begin
# First check to see if the command is available
MiqUtil.runcmd("virsh list")
AwesomeSpawn.run!("virsh", :params => ["list"])
begin
xml_data = MiqUtil.runcmd("virsh dumpxml #{File.basename(filename, ".*")}")
xml_data = AwesomeSpawn.run!("virsh", :params => ["dumpxml", File.basename(filename, ".*")], :combined_output => true).output
rescue => err
$log.error "#{err}\n#{err.backtrace.join("\n")}"
end
Expand Down
1 change: 1 addition & 0 deletions manageiq-smartstate.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "activesupport"
spec.add_dependency "awesome_spawn", "~> 1.5"
spec.add_dependency "azure-armrest", "~> 0.9"
spec.add_dependency "binary_struct", "~> 2.1"
spec.add_dependency "iniparse"
Expand Down

0 comments on commit 311a018

Please sign in to comment.