1 Answer

First, make sure that when you define classes, you split them into separate .pp files that follow the Puppet module autoload naming convention. Next, I think you can rewrite your classes as a single class like so (some names changed to better reflect functionality):

This is completely untested, so YMMV. The idea is that you stage the file into the target location first, then the file resource will be applied to change the owner and group. This class will live in a file named <moduledir>/modules/deployapp/manifests/stage_warfile.pp.

UPDATE: Here's a version of the code using a file resource default block to hopefully avoid the duplication definition error:

Comments

Greg, i have tried this method alos , but it is causing duplicate variable declaration issue as i am using stage module and file resoure,
Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: File[/wic/wso2as/repository/deployment/server/webapps/wws.war] is alre

Greg, i am able to avoid the duplication issue, but the issue is , staging doesnot have parameter called to replace the file or overwrite. because the application name war may be available in the dir , if that is the case stage module has replace the file or overwrite the new war. can you suggest me

In order to replace the file, you'll have to manage and clean up the parent directory prior to staging the new version of the file. That is described here: http://bit.ly/1JK89hO The reason is that the internal file resource used by the module sets "replace => false".