Class: Object

### Home Classes Methods

### In Files

- lib/facter/util/monkey_patches.rb
- lib/facter/ipaddress6.rb
- lib/facter/selinux.rb
- lib/facter/ec2.rb

### Parent

BasicObject

### Methods

- #get_address_after_token
- #metadata
- #selinux_mount_point
- #userdata

### Files

- LICENSE
- Rakefile
- THANKS

### Class/Module Index

Quicksearch

- Facter
- Facter::Application
- Facter::Manufacturer
- Facter::Memory
- Facter::NetMask
- Facter::Util
- Facter::Util::CFPropertyList
- Facter::Util::CFPropertyList::CFArray
- Facter::Util::CFPropertyList::CFBoolean
- Facter::Util::CFPropertyList::CFData
- Facter::Util::CFPropertyList::CFDate
- Facter::Util::CFPropertyList::CFDictionary
- Facter::Util::CFPropertyList::CFInteger
- Facter::Util::CFPropertyList::CFReal
- Facter::Util::CFPropertyList::CFString
- Facter::Util::CFPropertyList::CFType
- Facter::Util::CFPropertyList::XML
- Facter::Util::Collection
- Facter::Util::CompositeLoader
- Facter::Util::Config
- Facter::Util::Confine
- Facter::Util::DirectoryLoader
- Facter::Util::DirectoryLoader::NoSuchDirectoryError
- Facter::Util::EC2
- Facter::Util::Fact
- Facter::Util::FileRead
- Facter::Util::IP
- Facter::Util::IP::Windows
- Facter::Util::IP::Windows::Bindings4
- Facter::Util::IP::Windows::Bindings6
- Facter::Util::Loader
- Facter::Util::Macaddress
- Facter::Util::Macaddress::Darwin
- Facter::Util::Macaddress::Windows
- Facter::Util::Macosx
- Facter::Util::MonkeyPatches
- Facter::Util::MonkeyPatches::Lines
- Facter::Util::NothingLoader
- Facter::Util::Parser
- Facter::Util::Parser::Base
- Facter::Util::Parser::JsonParser
- Facter::Util::Parser::KeyValuePairOutputFormat
- Facter::Util::Parser::NothingParser
- Facter::Util::Parser::PowershellParser
- Facter::Util::Parser::ScriptParser
- Facter::Util::Parser::TextParser
- Facter::Util::Parser::YamlParser
- Facter::Util::Processor
- Facter::Util::Registry
- Facter::Util::Resolution
- Facter::Util::SolarisZones
- Facter::Util::Uptime
- Facter::Util::Values
- Facter::Util::Virtual
- Facter::Util::Vlans
- Facter::Util::WMI
- Facter::Util::Xendomains
- Plist
- Plist::Emit
- Plist::Listener
- Plist::PArray
- Plist::PData
- Plist::PDate
- Plist::PDict
- Plist::PFalse
- Plist::PInteger
- Plist::PKey
- Plist::PList
- Plist::PReal
- Plist::PString
- Plist::PTag
- Plist::PTrue
- Plist::StreamParser
- CFFormatError
- CFPlistError
- CFTypeError
- IO
- Object
- String

No matching classes.

# Object

### Constants

RbConfig

### Public Instance Methods

get_address_after_token(output, token, return_first=false) click to toggle source

    # File lib/facter/ipaddress6.rb, line 26
    def get_address_after_token(output, token, return_first=false)
      ip = nil

      String(output).scan(/#{token}\s?((?>[0-9,a-f,A-F]*\:{1,2})+[0-9,a-f,A-F]{0,4})/).each do |match|
        match = match.first
        unless match =~ /fe80.*/ or match == "::1"
          ip = match
          break if return_first
        end
      end

      ip
    end

metadata(id = "") click to toggle source

    # File lib/facter/ec2.rb, line 4
    def metadata(id = "")
      open("http://169.254.169.254/2008-02-01/meta-data/#{id||=''}").read.
        split("\n").each do |o|
        key = "#{id}#{o.gsub(/\=.*$/, '/')}"
        if key[-1..-1] != '/'
          value = open("http://169.254.169.254/2008-02-01/meta-data/#{key}").read.
            split("\n")
          symbol = "ec2_#{key.gsub(/\-|\//, '_')}".to_sym
          Facter.add(symbol) { setcode { value.join(',') } }
        else
          metadata(key)
        end
      end
    rescue => details
      Facter.warn "Could not retrieve ec2 metadata: #{details.message}"
    end

selinux_mount_point() click to toggle source

This supports the fact that the selinux mount point is not always in the same location -- the selinux mount point is operating system specific.

    # File lib/facter/selinux.rb, line 17
    def selinux_mount_point
      path = "/selinux"
      if FileTest.exists?('/proc/self/mounts')
        # Centos 5 shows an error in which having ruby use File.read to read
        # /proc/self/mounts combined with the puppet agent run with --listen causes
        # a hang. Reading from other parts of /proc does not seem to cause this problem.
        # The work around is to read the file in another process.
        # -- andy Fri Aug 31 2012
        selinux_line = Facter::Util::Resolution.exec('cat /proc/self/mounts').lines.find { |line| line =~ /selinuxfs/ }
        if selinux_line
          path = selinux_line.split[1]
        end
      end
      path
    end

userdata() click to toggle source

    # File lib/facter/ec2.rb, line 21
    def userdata()
      Facter.add(:ec2_userdata) do
        setcode do
          if userdata = Facter::Util::EC2.userdata
            userdata.split
          end
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.