Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-714

Facter doesn't recognize String time when using to_s on Time type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 2.1.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      CentOS 6.5
      puppet 3.5.1

    • Template:

      Description

      I have a fact similar to the following:

      # os_install_date.rb
       
      Facter.add('os_install_date') do
              setcode do
                      # Red Hat based OS
                      if File.exists?('/root/anaconda-ks.cfg')
                              File.mtime('/root/anaconda-ks.cfg').strftime('%Y/%m/%d-%H:%M:%S')
                      end
              end
      end
      

      And upon execution of facter -p I receive this:

      [root@dtiad04dma04p ~]# facter -p | fgrep install
      Fact resolution fact='os_install_date', resolution='<anonymous>' resolved to an invalid value: Expected Thu Sep 11 15:36:33 +0000 2014 to be one of [Integer, Float, TrueClass, FalseClass, NilClass, String, Array, Hash], but was Time
      os_install_date => 2014/09/11-15:36:33
      

      It actually works without any issues on other servers but they are pretty much the same servers going to the same puppet master with the same fact.

        Attachments

          Activity

            People

            Assignee:
            eric.sorenson Eric Sorenson
            Reporter:
            devnull Zahid Bukhari
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support