[Puppet Users] Re: Permissions for Windows Files Sourced from Puppet Master

2014-01-04 Thread Igor Berger
I think ignore is the correct default on Windows, assuming it results in 
files / directories that inherit permissions of their parents.


On Friday, January 3, 2014 11:53:22 PM UTC-5, Rob Reynolds wrote:

 Folks supporting Windows, do you have an opinion with this warning? This 
 may have gotten lost with the holiday season so following up. :)


 On Wed, Nov 20, 2013 at 12:40 PM, Rob Reynolds 
 r...@puppetlabs.comjavascript:
  wrote:

 With the changes for http://projects.puppetlabs.com/issues/18931 (Don't 
 set mode on Windows if not specified)  
 http://projects.puppetlabs.com/issues/5240 (Default ownership for files 
 when uid/gid are unspecified), we've created the ability to specify whether 
 to use source permissions, use when creating or ignore. We've left the 
 default to :use so things work as expected. 

 However with Windows, when things download they will not use source 
 permissions as it is not supported in Windows at all. So what you get is a 
 warning for sourced items:

 Warning: Copying owner/mode/group from the puppet master to Windows 
 agents is not supported; use source_permissions = ignore.

 That warning will go away when you've updated all sourced files to add 
 that in your manifests.

 Would anyone be at odds with us moving the default for windows for 
 sourced items to ignore the source permissions? This would remove the 
 warning that gets displayed in the upcoming version until you would change 
 all sourced files to add `source_permissions = :ignore`.

 That way you would only see the warning if you tried to explicitly set 
 the source_permissions for a file.

 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  



 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/05f05e77-64e0-452d-b53f-8ce365a3fc8d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Geppetto complains about uninitialized variables in reduce function

2013-12-17 Thread Igor Berger
Hello,

I'm using the following expression to format a list:

$valid_environments = ['env1', 'env2', 'env3']
$env_message = $valid_environments.reduce |$message, $env| { 
${message}, ${env} }

It works at run-time (Puppet 3.2.4 standalone with --parser=future).

However in Eclipse (v4.3.1), Geppetto (v4.0) shows these errors:

Reference to not yet initialized variable: env'
Reference to not yet initialized variable: message'

The workspace Puppet target version is set to future.

Is there another syntax I could use to make Geppetto happy or is this a bug?

Thanks,
Igor.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/eb6d78c8-0223-496a-8aec-640c546e5559%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Providing hiera with module data

2013-12-01 Thread Igor Berger
Same problem here

:(


On Sunday, December 1, 2013 2:27:42 AM UTC-5, Steven Jonthen wrote:

 Hi,

 I have this problem: Hiera only looks inside data/common.yaml-file, 
 which is in my module-directory. When i put other data into another yaml 
 file data/example.yaml, then Puppet doesn't find that data. 

 What's the cause for this problem?


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0e6b1aca-7bdb-4946-8fce-6fdf1440a11b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Unable to specify hierarchy for data-in-modules

2013-09-18 Thread Igor Berger
Any ideas?


On Monday, September 16, 2013 11:30:42 AM UTC-4, Igor Berger wrote:

 Hello,

 I'm running Puppet agent stand-alone on Windows.

 I got data-in-modules working. However, no matter what I put into the 
 module hiera.yaml,
 I can only override the defaults from common.yaml by osfamily (and not, 
 e.g., by environment).

 In the setup below the following command outputs:

 puppet apply --binder -e notice lookup ('my_key') --environment=local
 Notice: Scope(Class[main]): windows-value
 Notice: Compiled catalog for myhostname in environment local in 1.40 
 seconds

 And if I delete the osfamily directory, the same command outputs 
 common-value.

 So, even though osfamily is not part of the hierarchy, it's used to 
 override the common value.
 Conversely, environment is part of the hierarchy, but it's not used.

 Did I miss anything?

 Thanks,
 Igor.


 Module structure:

 my_module/
 hiera.yaml
 data/
 common.yaml
 environment/
 local.yaml
 osfamily/
 windows.yaml


 hiera.yaml contains:

 ---
 version: 2
 hierarchy:
   [
['environment', '${environment}', 'data/environment/${environment}'],
['common', 'true', 'data/common']
   ]


 data/common.yaml contains:

 ---
 my_key: 'common-value'


 data/osfamily/windows.yaml contains:

 ---
 my_key: 'windows-value'


 data/environment/local.yaml contains:

 ---
 my_key: 'local-value'



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Unable to specify hierarchy for data-in-modules

2013-09-16 Thread Igor Berger
Hello,

I'm running Puppet agent stand-alone on Windows.

I got data-in-modules working. However, no matter what I put into the 
module hiera.yaml,
I can only override the defaults from common.yaml by osfamily (and not, 
e.g., by environment).

In the setup below the following command outputs:

puppet apply --binder -e notice lookup ('my_key') --environment=local
Notice: Scope(Class[main]): windows-value
Notice: Compiled catalog for myhostname in environment local in 1.40 seconds

And if I delete the osfamily directory, the same command outputs 
common-value.

So, even though osfamily is not part of the hierarchy, it's used to 
override the common value.
Conversely, environment is part of the hierarchy, but it's not used.

Did I miss anything?

Thanks,
Igor.


Module structure:

my_module/
hiera.yaml
data/
common.yaml
environment/
local.yaml
osfamily/
windows.yaml


hiera.yaml contains:

---
version: 2
hierarchy:
  [
   ['environment', '${environment}', 'data/environment/${environment}'],
   ['common', 'true', 'data/common']
  ]


data/common.yaml contains:

---
my_key: 'common-value'


data/osfamily/windows.yaml contains:

---
my_key: 'windows-value'


data/environment/local.yaml contains:

---
my_key: 'local-value'

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Incorrect return code for failed exec

2013-09-16 Thread Igor Berger
Done: https://projects.puppetlabs.com/issues/22572


On Thursday, September 12, 2013 10:07:49 AM UTC-4, Rob Reynolds wrote:

 Please log this at 
 https://projects.puppetlabs.com/projects/puppet/issues/new

 In keywords, please put windows.

 Thanks.


 On Tue, Sep 10, 2013 at 11:29 AM, Igor Berger codew...@gmail.comjavascript:
  wrote:

 Should log an issue about this someplace?


 On Tuesday, September 3, 2013 10:56:01 AM UTC-4, Igor Berger wrote:

 It returns 1053. The sc start command prints:

 [SC] StartService FAILED 1053: The service did not respond to the 
 start or control request in a timely fashion.

 You can easily reproduce it by registering a service with a non-existing 
 executable:

 sc create MyService binPath= C:\NotThere.exe

 Then add this to a test.cmd file:

 sc start MyService
 echo %errorlevel%


 On Tuesday, September 3, 2013 10:34:32 AM UTC-4, Rob Reynolds wrote:

 What does cmd /c sc start MyService return?


 On Tue, Sep 3, 2013 at 9:23 AM, Igor Berger codew...@gmail.com wrote:

 As I mentioned, I'm running into this issue when the service fails to 
 start.
 sc start returns a failure, Puppet mentions it in the log file.

 The problem is that puppet apply returns 0 (success) to the shell 
 when sc start fails.
 However, puppet apply --detailed-exitcodes returns a failure to the 
 shell correctly.



 On Monday, September 2, 2013 1:51:31 AM UTC-4, Rahul Khengare wrote:

 Hi Igor,
You can run sc start MyService command manually on your machine 
 and check whether the service run correctly. Also check the environment 
 parameters are set for that service.
 Can you explain your query in more detail manner.  

 Thanks and Regards,
 Rahul Khengare,
 NTT DATA OSS Center, Pune, India.


 On Saturday, August 31, 2013 3:20:54 AM UTC+5:30, Igor Berger wrote:

 Hello,

 I'm running puppet agent standalone on Windows.

 The last step in the manifest is exec { 'start_service': command = 
 sc start MyService }.

 When the service has a problem and doesn't start, Puppet logs:

 /Stage[main]//Exec[start_**servi**ce]/returns (err): change from 
 notrun to 0 failed: sc start MyService returned 29 instead of one of [0]

 However, the %errorlevel% returned is still 0.

 However, if I use --detailed-exitcodes, the %errorlevel% is 
 correctly set to 6.

 Regards,
 Igor.

  -- 
 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 post to this group, send email to puppet...@googlegroups.com.
 Visit this group at 
 http://groups.google.com/**group/puppet-usershttp://groups.google.com/group/puppet-users
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  
  -- 
 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 javascript:.
 To post to this group, send email to puppet...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/puppet-users.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Incorrect return code for failed exec

2013-09-10 Thread Igor Berger
Should log an issue about this someplace?


On Tuesday, September 3, 2013 10:56:01 AM UTC-4, Igor Berger wrote:

 It returns 1053. The sc start command prints:

 [SC] StartService FAILED 1053: The service did not respond to the 
 start or control request in a timely fashion.

 You can easily reproduce it by registering a service with a non-existing 
 executable:

 sc create MyService binPath= C:\NotThere.exe

 Then add this to a test.cmd file:

 sc start MyService
 echo %errorlevel%


 On Tuesday, September 3, 2013 10:34:32 AM UTC-4, Rob Reynolds wrote:

 What does cmd /c sc start MyService return?


 On Tue, Sep 3, 2013 at 9:23 AM, Igor Berger codew...@gmail.com wrote:

 As I mentioned, I'm running into this issue when the service fails to 
 start.
 sc start returns a failure, Puppet mentions it in the log file.

 The problem is that puppet apply returns 0 (success) to the shell when 
 sc start fails.
 However, puppet apply --detailed-exitcodes returns a failure to the 
 shell correctly.



 On Monday, September 2, 2013 1:51:31 AM UTC-4, Rahul Khengare wrote:

 Hi Igor,
You can run sc start MyService command manually on your machine 
 and check whether the service run correctly. Also check the environment 
 parameters are set for that service.
 Can you explain your query in more detail manner.  

 Thanks and Regards,
 Rahul Khengare,
 NTT DATA OSS Center, Pune, India.


 On Saturday, August 31, 2013 3:20:54 AM UTC+5:30, Igor Berger wrote:

 Hello,

 I'm running puppet agent standalone on Windows.

 The last step in the manifest is exec { 'start_service': command = 
 sc start MyService }.

 When the service has a problem and doesn't start, Puppet logs:

 /Stage[main]//Exec[start_**service]/returns (err): change from notrun 
 to 0 failed: sc start MyService returned 29 instead of one of [0]

 However, the %errorlevel% returned is still 0.

 However, if I use --detailed-exitcodes, the %errorlevel% is 
 correctly set to 6.

 Regards,
 Igor.

  -- 
 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 post to this group, send email to puppet...@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Re: Incorrect return code for failed exec

2013-09-03 Thread Igor Berger
As I mentioned, I'm running into this issue when the service fails to start.
sc start returns a failure, Puppet mentions it in the log file.

The problem is that puppet apply returns 0 (success) to the shell when 
sc start fails.
However, puppet apply --detailed-exitcodes returns a failure to the shell 
correctly.


On Monday, September 2, 2013 1:51:31 AM UTC-4, Rahul Khengare wrote:

 Hi Igor,
You can run sc start MyService command manually on your machine and 
 check whether the service run correctly. Also check the environment 
 parameters are set for that service.
 Can you explain your query in more detail manner.  

 Thanks and Regards,
 Rahul Khengare,
 NTT DATA OSS Center, Pune, India.


 On Saturday, August 31, 2013 3:20:54 AM UTC+5:30, Igor Berger wrote:

 Hello,

 I'm running puppet agent standalone on Windows.

 The last step in the manifest is exec { 'start_service': command = sc 
 start MyService }.

 When the service has a problem and doesn't start, Puppet logs:

 /Stage[main]//Exec[start_service]/returns (err): change from notrun to 0 
 failed: sc start MyService returned 29 instead of one of [0]

 However, the %errorlevel% returned is still 0.

 However, if I use --detailed-exitcodes, the %errorlevel% is correctly 
 set to 6.

 Regards,
 Igor.



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Re: Incorrect return code for failed exec

2013-09-03 Thread Igor Berger
It returns 1053. The sc start command prints:

[SC] StartService FAILED 1053: The service did not respond to the start 
or control request in a timely fashion.

You can easily reproduce it by registering a service with a non-existing 
executable:

sc create MyService binPath= C:\NotThere.exe

Then add this to a test.cmd file:

sc start MyService
echo %errorlevel%


On Tuesday, September 3, 2013 10:34:32 AM UTC-4, Rob Reynolds wrote:

 What does cmd /c sc start MyService return?


 On Tue, Sep 3, 2013 at 9:23 AM, Igor Berger codew...@gmail.comjavascript:
  wrote:

 As I mentioned, I'm running into this issue when the service fails to 
 start.
 sc start returns a failure, Puppet mentions it in the log file.

 The problem is that puppet apply returns 0 (success) to the shell when 
 sc start fails.
 However, puppet apply --detailed-exitcodes returns a failure to the 
 shell correctly.



 On Monday, September 2, 2013 1:51:31 AM UTC-4, Rahul Khengare wrote:

 Hi Igor,
You can run sc start MyService command manually on your machine 
 and check whether the service run correctly. Also check the environment 
 parameters are set for that service.
 Can you explain your query in more detail manner.  

 Thanks and Regards,
 Rahul Khengare,
 NTT DATA OSS Center, Pune, India.


 On Saturday, August 31, 2013 3:20:54 AM UTC+5:30, Igor Berger wrote:

 Hello,

 I'm running puppet agent standalone on Windows.

 The last step in the manifest is exec { 'start_service': command = 
 sc start MyService }.

 When the service has a problem and doesn't start, Puppet logs:

 /Stage[main]//Exec[start_**service]/returns (err): change from notrun 
 to 0 failed: sc start MyService returned 29 instead of one of [0]

 However, the %errorlevel% returned is still 0.

 However, if I use --detailed-exitcodes, the %errorlevel% is 
 correctly set to 6.

 Regards,
 Igor.

  -- 
 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 javascript:.
 To post to this group, send email to puppet...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/puppet-users.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 Join us at PuppetConf 2014, September 23-24 in San Francisco
  

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Creating Windows services

2013-08-30 Thread Igor Berger
For posterity, here's what I ended up with (no graceful service stop):


$process_name = 'myprocess'
$service_name = 'myservice'
$package_source = 'C:/source'
$package_target = 'C:/target'

$service_config = start= auto binPath= 
\$package_target/bin/$process_name.exe\
$service_exists = powershell get-service -name $service_name

Exec { path = $::path }

exec { 'create_service':
command = sc create $service_name $service_config,
unless = $service_exists,
}
-
exec { 'update_service':
command = sc config $service_name $service_config,
onlyif = $service_exists,
}
-
exec { 'configure_recovery':
command = sc failure $service_name reset= 0 actions= 
restart/1/restart/1/restart/1,
}
-
exec { 'disable_recovery':
command = sc failureflag $service_name 0,
}
-
exec { 'stop_service':
command = powershell stop-process -name $process_name,
returns = [0, 1],
}
-
file { 'copy_package':
ensure = directory,
force = true,
mode = '0600',
path = $package_target,
purge = true,
recurse = true,
source = $package_source,
}
-
exec { 'inherit_permissions':
command = icacls $package_target /reset /T,
}
-
exec { 'configure_service':
command = cmd /C $package_target/config.cmd,
}
-
exec { 'enable_recovery':
command = sc failureflag $service_name 1,
}
-
exec { 'start_service':
command = sc start $service_name,
}


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Incorrect return code for failed exec

2013-08-30 Thread Igor Berger
Hello,

I'm running puppet agent standalone on Windows.

The last step in the manifest is exec { 'start_service': command = sc 
start MyService }.

When the service has a problem and doesn't start, Puppet logs:

/Stage[main]//Exec[start_service]/returns (err): change from notrun to 0 
failed: sc start MyService returned 29 instead of one of [0]

However, the %errorlevel% returned is still 0.

However, if I use --detailed-exitcodes, the %errorlevel% is correctly set 
to 6.

Regards,
Igor.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Creating Windows services

2013-08-28 Thread Igor Berger
Hello,

Documentation mentions that Windows service resource provider can start, 
stop, enable, and disable services.

Is it possible to create (register) a service using this provider?

I'm running stand-alone Puppet agent 3.4.2 on Windows.

Thanks,
Igor.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Creating Windows services

2013-08-28 Thread Igor Berger
Thanks for a quick response.

I could use SC, but there are corner cases that require a lot of exec's and 
flow 
control,
which looks quite ugly in Puppet. It would be nice if something like this 
was built in:

1. If service doesn't exist, create it (sc create)

2. Set recovery actions (sc failure)

3. Re-configure the service (sc config) to change command-line arguments

4. Disable recovery (sc failureflag) in case service crashes while stopping

5. Stop service (sc stop)

6. Wait for some timeout (since sc stop is async)

7. If the service is still up, kill the process (powershell stop-process)

8. Copy new files

9. Re-enable recovery (sc failureflag)

10. Start service (sc start)

Regards,
Igor.

P.S. Yes, the version is 3.2.4.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.