FAQ
have the following in my manifest to delete old uninstall directories and
logs
using exec since we don't have tidy for windows yet

{code}
exec { 'CleanupOldUninstallDirs':
command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
"$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
}
exec { 'CleanupOldPatchLogs':
command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
"KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
}
{code}

runs correctly debug output below
[image: Inline image 1]

however, files are not deleted, as evidenced by running the same forfiles
at the command line

[image: Inline image 2]

yet the forfiles with delete works if I run it from the windows command line

Suggestions? Bug?

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Josh Cooper at Jun 20, 2012 at 7:38 pm
    Hi Michael,
    On Wed, Jun 20, 2012 at 10:29 AM, Michael Baydoun wrote:

    have the following in my manifest to delete old uninstall directories and
    logs
    using exec since we don't have tidy for windows yet

    {code}
    exec { 'CleanupOldUninstallDirs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
    "$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
    }
    exec { 'CleanupOldPatchLogs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
    "KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
    }
    {code}

    runs correctly debug output below
    [image: Inline image 1]

    however, files are not deleted, as evidenced by running the same forfiles
    at the command line

    [image: Inline image 2]

    yet the forfiles with delete works if I run it from the windows command
    line

    Suggestions? Bug?


    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    If this is a 64-bit OS, then I'm guessing it's an issue with filesystem
    redirection. Ruby is a 32-bit app, so any filesystem access to
    c:\windows\system32 is redirected to c:\windows\syswow64. You can avoid
    this by specifying c:\windows\sysnative instead.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Michael Baydoun at Jun 22, 2012 at 5:33 pm
    My windows client is running Windows 2003 Server 32 bit
    On Wed, Jun 20, 2012 at 3:38 PM, Josh Cooper wrote:

    Hi Michael,
    On Wed, Jun 20, 2012 at 10:29 AM, Michael Baydoun wrote:

    have the following in my manifest to delete old uninstall directories and
    logs
    using exec since we don't have tidy for windows yet

    {code}
    exec { 'CleanupOldUninstallDirs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
    "$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
    }
    exec { 'CleanupOldPatchLogs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m
    "KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
    }
    {code}

    runs correctly debug output below
    [image: Inline image 1]

    however, files are not deleted, as evidenced by running the same forfiles
    at the command line

    [image: Inline image 2]

    yet the forfiles with delete works if I run it from the windows command
    line

    Suggestions? Bug?


    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    If this is a 64-bit OS, then I'm guessing it's an issue with filesystem
    redirection. Ruby is a 32-bit app, so any filesystem access to
    c:\windows\system32 is redirected to c:\windows\syswow64. You can avoid
    this by specifying c:\windows\sysnative instead.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Josh Cooper at Jun 22, 2012 at 6:00 pm
    Hi Michael
    On Fri, Jun 22, 2012 at 10:33 AM, Michael Baydoun wrote:

    My windows client is running Windows 2003 Server 32 bit

    On Wed, Jun 20, 2012 at 3:38 PM, Josh Cooper wrote:

    Hi Michael,

    On Wed, Jun 20, 2012 at 10:29 AM, Michael Baydoun <indymichaelb@gmail.com
    wrote:
    have the following in my manifest to delete old uninstall directories
    and logs
    using exec since we don't have tidy for windows yet

    {code}
    exec { 'CleanupOldUninstallDirs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows"
    -m "$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
    }
    exec { 'CleanupOldPatchLogs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows"
    -m "KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
    }
    {code}
    Puppet requires that exec resources return non-zero exit status if the
    command fails. If I run the following, it still returns 0:

    C:\>forfiles -p c:\windows -m "$NtUninstall*" -d -65 -c "cmd /c foo"
    'foo' is not recognized as an internal or external command,
    operable program or batch file.
    ...
    C:\>echo %ERRORLEVEL%


    I think the issue is that dev is in your PATH when run from the command
    line, but is not in the PATH that puppet is running with. Try specifying
    the `path` parameter in your exec resources, e.g.

    path => 'c:\windows\system32;c:\windows;c:\path\to\dev;etc'


    runs correctly debug output below
    [image: Inline image 1]

    however, files are not deleted, as evidenced by running the same
    forfiles at the command line

    [image: Inline image 2]

    yet the forfiles with delete works if I run it from the windows command
    line

    Suggestions? Bug?


    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    If this is a 64-bit OS, then I'm guessing it's an issue with filesystem
    redirection. Ruby is a 32-bit app, so any filesystem access to
    c:\windows\system32 is redirected to c:\windows\syswow64. You can avoid
    this by specifying c:\windows\sysnative instead.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.


    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Josh Cooper at Jun 22, 2012 at 7:05 pm
    Hi Michael,
    On Fri, Jun 22, 2012 at 11:00 AM, Josh Cooper wrote:

    Hi Michael
    On Fri, Jun 22, 2012 at 10:33 AM, Michael Baydoun wrote:

    My windows client is running Windows 2003 Server 32 bit

    On Wed, Jun 20, 2012 at 3:38 PM, Josh Cooper wrote:

    Hi Michael,
    On Wed, Jun 20, 2012 at 10:29 AM, Michael Baydoun wrote:

    have the following in my manifest to delete old uninstall directories and logs
    using exec since we don't have tidy for windows yet

    {code}
    exec { 'CleanupOldUninstallDirs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m "$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
    }
    exec { 'CleanupOldPatchLogs':
    command => 'C:\Windows\system32\forfiles.exe -p "C:\Windows" -m "KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
    }
    {code}

    Puppet requires that exec resources return non-zero exit status if the command fails. If I run the following, it still returns 0:

    C:\>forfiles -p c:\windows -m "$NtUninstall*" -d -65 -c "cmd /c foo"
    'foo' is not recognized as an internal or external command,
    operable program or batch file.
    ...
    C:\>echo %ERRORLEVEL%


    I think the issue is that dev is in your PATH when run from the command line, but is not in the PATH that puppet is running with. Try specifying the `path` parameter in your exec resources, e.g.

    path => 'c:\windows\system32;c:\windows;c:\path\to\dev;etc'
    Or is that a typo? Should that be `del` instead of `dev`?
    runs correctly debug output below


    however, files are not deleted, as evidenced by running the same forfiles at the command line



    yet the forfiles with delete works if I run it from the windows command line

    Suggestions?  Bug?


    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

    If this is a 64-bit OS, then I'm guessing it's an issue with filesystem redirection. Ruby is a 32-bit app, so any filesystem access to c:\windows\system32 is redirected to c:\windows\syswow64. You can avoid this by specifying c:\windows\sysnative instead.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.



    --
    Josh Cooper
    Developer, Puppet Labs


    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Michael Baydoun at Jun 22, 2012 at 7:27 pm
    yes <hides head in shame>, that's a typo. Working now, thanks!
    Too bad it returns 0 all the time.
    On Fri, Jun 22, 2012 at 3:05 PM, Josh Cooper wrote:

    Hi Michael,
    On Fri, Jun 22, 2012 at 11:00 AM, Josh Cooper wrote:

    Hi Michael

    On Fri, Jun 22, 2012 at 10:33 AM, Michael Baydoun <
    indymichaelb@gmail.com> wrote:
    My windows client is running Windows 2003 Server 32 bit

    On Wed, Jun 20, 2012 at 3:38 PM, Josh Cooper wrote:

    Hi Michael,

    On Wed, Jun 20, 2012 at 10:29 AM, Michael Baydoun <
    indymichaelb@gmail.com> wrote:
    have the following in my manifest to delete old uninstall directories
    and logs
    using exec since we don't have tidy for windows yet

    {code}
    exec { 'CleanupOldUninstallDirs':
    command => 'C:\Windows\system32\forfiles.exe -p
    "C:\Windows" -m "$NtUninstall*" -d -65 -c "cmd /c dev /F /S /Q @path"',
    }
    exec { 'CleanupOldPatchLogs':
    command => 'C:\Windows\system32\forfiles.exe -p
    "C:\Windows" -m "KB*.log" -d -365 -c "cmd /c dev /F /S /Q @path"',
    }
    {code}

    Puppet requires that exec resources return non-zero exit status if the
    command fails. If I run the following, it still returns 0:
    C:\>forfiles -p c:\windows -m "$NtUninstall*" -d -65 -c "cmd /c foo"
    'foo' is not recognized as an internal or external command,
    operable program or batch file.
    ...
    C:\>echo %ERRORLEVEL%


    I think the issue is that dev is in your PATH when run from the command
    line, but is not in the PATH that puppet is running with. Try specifying
    the `path` parameter in your exec resources, e.g.
    path => 'c:\windows\system32;c:\windows;c:\path\to\dev;etc'
    Or is that a typo? Should that be `del` instead of `dev`?
    runs correctly debug output below


    however, files are not deleted, as evidenced by running the same
    forfiles at the command line


    yet the forfiles with delete works if I run it from the windows
    command line
    Suggestions? Bug?


    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.

    If this is a 64-bit OS, then I'm guessing it's an issue with
    filesystem redirection. Ruby is a 32-bit app, so any filesystem access to
    c:\windows\system32 is redirected to c:\windows\syswow64. You can avoid
    this by specifying c:\windows\sysnative instead.
    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.



    --
    Josh Cooper
    Developer, Puppet Labs


    --
    Josh Cooper
    Developer, Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 20, '12 at 5:29p
activeJun 22, '12 at 7:27p
posts6
users2
websitepuppetlabs.com

2 users in discussion

Michael Baydoun: 3 posts Josh Cooper: 3 posts

People

Translate

site design / logo © 2022 Grokbase