0

I wrote a custom fact to create current date and time in windows.That facts return the current date and time when i notifying it.

Eg:

  notify{"test time":
       message=>"$::windows_time",
         }

output of above code is '05-04-2016-194645'

But When i have tried to create a folder with custom facts , I can't create a folder with time-stamp. My Code is below.

    exec{"current date time folder":
    cwd=>"${prodequ_backup_loc}",
    command=>'C:\Windows\System32\cmd.exe /c "md $::windows_time"',
         }

That above code created a folder name with "${windows_time}".

my facts for creating date and time-stamp is below:

    require 'facter'
          #
          ##Default for non-Linux nodes
          Facter.add(:windows_time) do
          setcode do
           Facter::Util::Resolution.exec('C:\\Windows\\System32\\cmd.exe /c "C:\\time1.bat"')
          end
          end
          #For Linux Nodes
           Facter.add(:windows_time) do
           confine :kernel  => :linux
           setcode do
           nil
           end
           end

Any help is much appreciated.

1 Answers1

0

Reference

Code:

file {"c:\\full\\path\\to\\${::windows_time}":
  ensure => directory,
}
ferventcoder
  • 11,952
  • 3
  • 57
  • 90