Windows Package Install file permissions

56 views
Skip to first unread message

Armindo Silva

unread,
Feb 28, 2014, 1:23:45 PM2/28/14
to puppet...@googlegroups.com
Hi,

I have the following class for installing check_mk on windows machines:

class windows_check_mk {

  require windows_common

   package{ 'Check_MKAgent 1.2.4':
    ensure          => installed,
    source          => 'c:\\<my folder>\\installers\\check-mk-agent.exe',
    install_options => ['/S', '/D=C:\<myfolder>\check_mk'],
  }

}


The windows_common take cares of creating the folder c:\<my folder>\ and fetching several subfolders there - including subfolder installers.

This class successfully installs check_mk agent inside  C:\<myfolder>\check_mk but none of the files inside can be exec by any user, if I change install_options to

['/S', '/D=C:\\check_mk'],

this does not happen and all exes can be executed.

Why does this happens? Is there a way to workaround it?

I am using puppet 3.4.3 either on master and on the clients.

Thank you.

Josh Cooper

unread,
Feb 28, 2014, 2:51:21 PM2/28/14
to puppet...@googlegroups.com
Hi Armindo,


On Fri, Feb 28, 2014 at 5:23 AM, Armindo Silva <deatho...@gmail.com> wrote:
Hi,

I have the following class for installing check_mk on windows machines:

class windows_check_mk {

  require windows_common

   package{ 'Check_MKAgent 1.2.4':
    ensure          => installed,
    source          => 'c:\\<my folder>\\installers\\check-mk-agent.exe',

Per the puppet language docs, a double backslash in a single quoted string is supposed to be a literal backslash[1]. But puppet actually interprets that as a double backslash due to a long standing bug[2]. You'll want to use single backslashes, or switch to double quotes.

    install_options => ['/S', '/D=C:\<myfolder>\check_mk'],

I was going to point you to our windows package documentation[3], but I see that it too needs updating. If you want to specify key/value pairs, then you will want to do:

    ['/S', { '/D' => 'C:\<myfolder\check_mk' }]

Note puppet will automatically quote the path if it contains spaces.

  }

}


The windows_common take cares of creating the folder c:\<my folder>\ and fetching several subfolders there - including subfolder installers.

This class successfully installs check_mk agent inside  C:\<myfolder>\check_mk but none of the files inside can be exec by any user, if I change install_options to

['/S', '/D=C:\\check_mk'],

this does not happen and all exes can be executed. 

Why does this happens? Is there a way to workaround it?

I am using puppet 3.4.3 either on master and on the clients.

Thank you.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/86c664eb-4eae-4098-98e6-eeb1a4c272fe%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Josh

--
Josh Cooper
Developer, Puppet Labs

Join us at PuppetConf 2014September 23-24 in San Francisco - http://bit.ly/pupconf14
Register now and save $350!

Armindo Silva

unread,
Feb 28, 2014, 3:45:23 PM2/28/14
to puppet...@googlegroups.com
Hi Josh,

Thank you for your reply, but this is not a problem with either the backslashes (btw, I am using doubles because of the example here: http://docs.puppetlabs.com/windows/writing.html#packagepackage), neither with the install_options array - both versions install the check_mk exe successfully.

When I have


    install_options => ['/S', '/D=C:\<myfolder>\check_mk'],

check_mk is successfully installed but the files inside C:\<myfolder>\check_mk (check_mk installation dir) although readable I can not exec them;

When I have

    install_options => ['/S', '/D=C:\check_mk'],

check_mk is also successfully installed and I can exec the files  inside C:\check_mk  (check_mk installation dir).


I think I found the problem, this puppet installation was updated from 3.3.2, where it was still acceptable to set permissions on Windows files, I just added

   if $osfamily == 'windows' {
     File { source_permissions => ignore }
   }

to my sites.pp, then deleted C:\<myfolder>\ and re-ran puppet agent, now the file permissions are as supposed - I had already tried to delete this folder, but without ignoring the source_permissions windows wide, and  although the exec files that were fetched from the master could be ran the ones created by the check_mk installer were not.
Reply all
Reply to author
Forward
0 new messages