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

Facter 4 Does Not Support Built-In Windows Commands

    XMLWordPrintable

Details

    • Hide

      Custom fact works as expected

      Show
      Custom fact works as expected
    • Phoenix
    • 3
    • Phoenix 2022-08-17, Phoenix 2022-08-31, Phoenix 2022-09-14
    • Needs Assessment
    • 48852
    • 1
    • Bug Fix
    • Facter 3.x special-cased `echo` for windows to allow it to run using the built-in for a Windows shell; Facter 4 upgrade neglected to include this special case. This fix adds that special case back in.
    • Needs Assessment

    Description

      When executing the custom fact, Facter version 4.2.x fails with the "command not found" error.

       

      Created custom facts to test the scenario as shown below.

      Facter.add(:factertestingwindows) do
        confine :kernel => 'windows'
        setcode do
          Facter::Core::Execution.execute('echo Hello', :timeout => 10)
        end
      end 

       

      It is working as expected in Facter version 3.14.x

      PS C:\Users\Administrator> facter --version
      3.14.22 (commit 4d4afa91b226dfa8d2f92c495b7070377134386f) 

      PS C:\Users\Administrator> facter -p factertestingwindows
      Hello
      PS C:\Users\Administrator> 

      and Not working in Facter version 4.2.x

      PS C:\Users\Administrator> facter --version
      4.2.2 

      PS C:\Users\Administrator> puppet agent -t
      Info: Using configured environment 'production'
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Loading facts
      Error: Facter: Error while resolving custom fact fact='factertestingwindows', resolution='<anonymous>': Could not execute 'echo Hello': command not found
      Info: Caching catalog for baroque-fort.delivery.puppetlabs.net
      Info: Applying configuration version 'pe-202130-master-production-67440e89804'
      Notice: Applied catalog in 0.42 seconds 

      Attachments

        Issue Links

          Activity

            People

              tony.vu Tony Vu
              selvakumar.subburaj Selvakumar Azhagarsami
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support