diff options
author | James Shubin <james@shubin.ca> | 2013-12-12 18:59:06 -0500 |
---|---|---|
committer | James Shubin <james@shubin.ca> | 2013-12-12 19:12:50 -0500 |
commit | 1f58e5d384c872dec417c1043292ed7243e9d854 (patch) | |
tree | e63cc58b0cdae966984c2648519231fa4a8519f2 /lib | |
parent | afc33582a4129d1ade26bef6bebfa57dd3a292a7 (diff) | |
download | puppet-gluster-1f58e5d384c872dec417c1043292ed7243e9d854.tar.gz puppet-gluster-1f58e5d384c872dec417c1043292ed7243e9d854.tar.xz puppet-gluster-1f58e5d384c872dec417c1043292ed7243e9d854.zip |
Suppress warnings when gluster is not installed.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/gluster_ports.rb | 4 | ||||
-rw-r--r-- | lib/facter/gluster_uuid.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/facter/gluster_ports.rb b/lib/facter/gluster_ports.rb index 1eecf62..db22768 100644 --- a/lib/facter/gluster_ports.rb +++ b/lib/facter/gluster_ports.rb @@ -32,7 +32,7 @@ end if var.nil? # if we can't get a valid vardirtmp, then we can't continue - uuidfile = nil + xmlfile = nil else module_vardir = var+'gluster/' xmlfile = module_vardir+'xml.py' @@ -42,7 +42,7 @@ host = Facter.value('fqdn') found = {} # we need the script installed first to be able to generate the port facts... -if File.exist?(xmlfile) +if not(xmlfile.nil?) and File.exist?(xmlfile) volumes = `/usr/sbin/gluster volume list` if $?.exitstatus == 0 volumes.split.each do |x| diff --git a/lib/facter/gluster_uuid.rb b/lib/facter/gluster_uuid.rb index f1cd08f..7c48508 100644 --- a/lib/facter/gluster_uuid.rb +++ b/lib/facter/gluster_uuid.rb @@ -47,20 +47,20 @@ else end # NOTE: module specific mkdirs, needed to ensure there is no blocking/deadlock! -if not File.directory?(var) +if not(var.nil?) and not File.directory?(var) Dir::mkdir(var) end -if not File.directory?(module_vardir) +if not(module_vardir.nil?) and not File.directory?(module_vardir) Dir::mkdir(module_vardir) end -if not File.directory?(uuiddir) +if not(uuiddir.nil?) and not File.directory?(uuiddir) Dir::mkdir(uuiddir) end # generate uuid and parent directory if they don't already exist... -if not(uuidfile.nil?) and File.directory?(module_vardir) +if not(module_vardir.nil?) and File.directory?(module_vardir) if not File.directory?(uuiddir) Dir::mkdir(uuiddir) end @@ -75,7 +75,7 @@ if not(uuidfile.nil?) and File.directory?(module_vardir) end # create the fact if the uuid file contains a valid uuid -if File.exist?(uuidfile) +if not(uuidfile.nil?) and File.exist?(uuidfile) uuid = File.open(uuidfile, 'r').read.strip.downcase # read into str # skip over uuid's of the wrong length or that don't match (security!!) if uuid.length == 36 and regexp.match(uuid) @@ -95,7 +95,7 @@ end _uuid = '' found = {} prefix = 'uuid_' -if File.directory?(uuiddir) +if not(uuiddir.nil?) and File.directory?(uuiddir) Dir.glob(uuiddir+prefix+'*').each do |f| b = File.basename(f) |