Comments (8)
Can you confirm what version of puppet you're using?
Puppet v4.6.2. This problem occurred recently, so it might just be something that's changed from v4.6.1 to v4.6.2. I will try to confirm when we upgraded puppet.
We use puppet in Userspace so this process is confined to /opt/${::jboss::user} and runs as the jboss user.
Are you using the target parameter too? Is there anymore you can share?
I'm making use of the staging module within a custom jboss module. We do not manage the $staging_dir in the jboss module and leave this to the staging module.
This is the code where we make use of the staging resources
class { '::staging':
path => "/opt/${::jboss::user}/.staging",
mode => '0700',
owner => $::jboss::user,
group => $::jboss::group,
}
if $jboss::cumulative_patch_version != 'UNSET' {
staging::file { "jboss-${::jboss::cumulative_patch_version}-patch.zip":
source => "${::jboss::download_url}/jboss-${::jboss::cumulative_patch_version}-patch.zip",
}
}
staging::file { "jboss-${::jboss::version}.zip":
source => "${::jboss::download_url}/jboss-${::jboss::version}.zip",
} ->
staging::extract { "jboss-${::jboss::version}.zip":
target => "/opt/${::jboss::user}",
creates => "/opt/${::jboss::user}/jboss-${::jboss::version}/version.txt",
require => Staging::File["jboss-${::jboss::version}.zip"],
}
Values for above are as follows:
${::jboss::download_url} = http://x.x.x.x/jboss
${::jboss::cumulative_patch_version} = 'eap-6.4.6'
${::jboss::version} = 'eap-6.3'
${::jboss::user} = 'jboss4'
$::jboss::group = 'jboss4'
from puppet-staging.
It's actually really easy to reproduce something similar (perhaps not exactly the same issue), but I can get a duplicate resource error in a single line...
puppet apply -e 'staging::file { "master.zip": source => "https://github.com/voxpupuli/puppet-staging/archive/master.zip"}'
Notice: Compiled catalog for alex-virtualbox.ordsvy.gov.uk in environment production in 0.30 seconds
Error: Cannot alias File[/opt/staging/] to ["/opt/staging"] at /home/alex/.puppetlabs/etc/code/modules/staging/manifests/file.pp:40; resource ["File", "/opt/staging"] already declared at /home/alex/.puppetlabs/etc/code/modules/staging/manifests/init.pp:23
@shaunrampersad Your code where you call staging
from? Is it in a module? If not, $caller_module_name
(and $subdir
) will be an empty string.
$staging_dir = "${staging::path}/${subdir}"
will then result in a directory path that ends with a /
and is the same directory as already declared in init.pp
. The if !defined
won't trigger as the title of the resource in init.pp
won't have the trailing /
.
This shouldn't be too hard to fix. Meanwhile, if you explicitly set $subdir
, I think your problem will go away. You might also consider migrating to puppet-archive
. I think this is the preferred module for downloading stuff these days.
from puppet-staging.
@shaunrampersad That's quite odd. I can't quite see why if ! defined
wouldn't work (and presumably it does for most people??). ensure_resources
, on the other hand, can lead to duplicate resources in situations where the resource has been declared previously but with different parameters (probably not common, but some users may have done this in their profiles - perhaps to set group or mode perhaps??)
Can you confirm what version of puppet you're using?
from puppet-staging.
I have seen a similar issue.. if the 'if ! defined' happens before your other code not wrapped in an if ! defined is executed, there will be conflicts. (I have seen the same behavior with ensure_resources). @shaunrampersad do you have a regular file resource in your catalog for that folder, or is it only created via staging?
from puppet-staging.
@Cinderhaze That does happen, but the error message suggests it's two instances of the same defined type conflicting. That I don't understand...
is already declared in file /etc/puppetlabs/code/environments/jboss_master/modules/staging/manifests/file.pp:39; cannot redeclare at /etc/puppetlabs/code/environments/jboss_master/modules/staging/manifests/file.pp:39
from puppet-staging.
@shaunrampersad can you tell us the value of ::jboss::version and ::jboss::download_url?
from puppet-staging.
I suspect that for some reason two values of $staging_dir
aren't the same string, but refer to the same path. ie (/tmp/staging
and /tmp/staging/
) That would fool defined
, but not the type for file
which will munge the paths to be the same.
@shaunrampersad Are you using the target
parameter too? Is there anymore you can share?
from puppet-staging.
@alexjfisher , I'm calling the staging module from within my jboss module.
Will look into migrating to puppet-archive. thanks!
from puppet-staging.
Related Issues (20)
- Syntax error in staging_windir.rb HOT 8
- Failure to set '::staging::path' HOT 2
- Add deprecation notice to README
- Add an opts parameter for tar HOT 2
- Deprecate this module in favour of puppet/archive HOT 4
- source_permissions in file.pp is raising a deprecation warning HOT 4
- Remove staged file after deploy HOT 1
- Variable $path not correctly scoped HOT 1
- staging extract with rename HOT 1
- Staging Deploy to take strip parameter HOT 1
- Puppet 4 support HOT 4
- staging module can create 0 length files HOT 1
- File source using https with username/password fails with certain password character sequences HOT 1
- unzip should use -o -f always or optionally HOT 2
- Ability to validate checksum and/or file size of archive HOT 1
- Release to puppet-community namespace on forge HOT 3
- Error loading staging_windir.rb HOT 7
- JSON syntax in staging_windir fact causes syntax error using Ruby 1.8 HOT 2
- Path not fully qualified (Windows) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-staging.