rvlinden
2011-Sep-15 21:01 UTC
[Puppet Users] Puppet 2.7.3 Cannot alias .. already defined
Hi all,
Today I upgraded both my puppet server (2.7.1) a puppet client(s)
(2.6.9) to 2.7.3 and suddenly my modules didn''t work anymore. I
don''t
know if 2.7.3 is more strict than 2.7.1, or if it''s a bug, so I hope
someone can help me.
I have several modules where the file and/or directory are separated
from the permissions I set on them
This is because I sometimes want to create a single directory, and
later set specific user/group and permissions to one or all files
(recurse) in it.
Here is an example for the ntp module
class ntp (
$autoupgrade = ''false'' ){
require ntp::params
# Create var directory
file { "${ntp::params::var_directory}":
ensure => directory,
}
# Set var permissions
sysconfig::permissions { "${ntp::params::module_label}_permissions$
{ntp::params::var_directory}":
sysconfig_module => "${ntp::params::module_label}",
sysconfig_name => "${ntp::params::var_directory}",
sysconfig_owner => "${ntp::params::user_name}",
sysconfig_group => "${ntp::params::group_name}",
sysconfig_mode => "${ntp::params::var_permissions}",
}
.. removed some lines
} # End class
and also the sysconfig::permissions define module
define sysconfig::permissions (
$sysconfig_module,
$sysconfig_name,
$sysconfig_recurse = ''false'',
$sysconfig_owner,
$sysconfig_group,
$sysconfig_mode = undef ) {
# Load defaults
require sysconfig::params
# Set permissions
file { "${sysconfig_module}_${sysconfig_name}":
name => "${sysconfig_name}",
recurse => "${sysconfig_recurse}",
owner => "${sysconfig_owner}",
group => "${sysconfig_group}",
}
if $sysconfig_mode != undef {
File["${sysconfig_module}_${sysconfig_name}"] {
mode => "${sysconfig_mode}",
}
}
} # End define
When puppet runs, I get the following error
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
Cannot alias File[ntp_/var/lib/ntp] to ["/var/lib/ntp"] at
/etc/puppet/
modules/sysconfig/manifests/permissions.pp:47; resource ["File",
"/var/
lib/ntp"] already defined at /etc/puppet/modules/ntp/manifests/init.pp:
18 at /etc/puppet/modules/sysconfig/manifests/permissions.pp:47 on
node client.mydomain.com
In the previous version, this would not be a problem as the file in
the ntp module would be
file { "/var/lib/ntp": }
and the file in the sysconfig::permissions module would be
file { "ntp_/var/lib/ntp": }
I would reference from back from the sysconfig::permissions module to
the ntp module file by specifying
name => "/var/lib/ntp"
Do I need to change all my modules because I used a feature of puppet
which should not be there, and if so, how could I best fix this.
Kind regards,
Rene
--
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.
Peter Meier
2011-Sep-16 18:55 UTC
Re: [Puppet Users] Puppet 2.7.3 Cannot alias .. already defined
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1> I would reference from back from the sysconfig::permissions module to > the ntp module file by specifying > name => "/var/lib/ntp" > > Do I need to change all my modules because I used a feature of puppet > which should not be there, and if so, how could I best fix this.does a single manifests like file{''foo'': name => ''/tmp/foo'', mode => 0700; } with puppet apply, also raise an error? ~pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5zm6YACgkQbwltcAfKi3/k2QCfcG/LwcP+pebtbOA1vwFlOLwq BoAAn1ukeUejmGFp4w4yCBk4No34xJhw =pvok -----END PGP SIGNATURE----- -- 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.
rvlinden
2011-Sep-17 12:31 UTC
[Puppet Users] Re: Puppet 2.7.3 Cannot alias .. already defined
On Sep 16, 8:55 pm, Peter Meier <peter.me...@immerda.ch> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I would reference from back from the sysconfig::permissions module to > > the ntp module file by specifying > > name => "/var/lib/ntp" > > > Do I need to change all my modules because I used a feature of puppet > > which should not be there, and if so, how could I best fix this. > > does a single manifests like > > file{''foo'': > name => ''/tmp/foo'', > mode => 0700; > > } > > with puppet apply, also raise an error? > > ~pete > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAk5zm6YACgkQbwltcAfKi3/k2QCfcG/LwcP+pebtbOA1vwFlOLwq > BoAAn1ukeUejmGFp4w4yCBk4No34xJhw > =pvok > -----END PGP SIGNATURE-----A single manifest works fine and this might be my only option to get it working again. I donhowever -- 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.
rvlinden
2011-Sep-17 12:42 UTC
[Puppet Users] Re: Puppet 2.7.3 Cannot alias .. already defined
On Sep 16, 8:55 pm, Peter Meier <peter.me...@immerda.ch> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I would reference from back from the sysconfig::permissions module to > > the ntp module file by specifying > > name => "/var/lib/ntp" > > > Do I need to change all my modules because I used a feature of puppet > > which should not be there, and if so, how could I best fix this. > > does a single manifests like > > file{''foo'': > name => ''/tmp/foo'', > mode => 0700; > > } > > with puppet apply, also raise an error? > > ~pete > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAk5zm6YACgkQbwltcAfKi3/k2QCfcG/LwcP+pebtbOA1vwFlOLwq > BoAAn1ukeUejmGFp4w4yCBk4No34xJhw > =pvok > -----END PGP SIGNATURE-----A single manifests works fine, but this is not the only module I have where I set permissions using the sysconfig::permissions module. I can rewrite them, (and probably have to, to make it work again) but then it seems that the '' name'' option in the file type is going to be obsoleted as it doesn''t work anymore. -- 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.
Peter Meier
2011-Sep-17 13:54 UTC
Re: [Puppet Users] Re: Puppet 2.7.3 Cannot alias .. already defined
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1> A single manifests works fine, but this is not the only module I have > where I set permissions using the sysconfig::permissions module.Ah, now I as I read your problem better: The error indicates more that you name two resources with the same name/alias. And you can''t and shouldn''t do that! Actually your code should imho not work on 2.6.9 either and yes it looks like 2.7 got more strict. Anyway, you shouldn''t do what you do currently, this is quite dangerous! Note: Puppet automagically sets the execute flag on directories, so if you''d like to have the directory 0750 and the files 0640, then simply set the mode of the directory to 0640 and to recurse. If you would like to set the files to 0600, then you have to manage them invidually, because the file provider of puppet does (currently) not (yet) support that feature.> I can rewrite them, (and probably have to, to make it work again) but > then it seems that the '' name'' option in the file type is going to be > obsoleted as it doesn''t work anymore.Unlikely, name is quite an important attribute for all resources. It is more that you end up having two different resources with the same name or alias. And that should really not be. It looks like a serious bug _got_ fixed in 2.7 ~pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk50prIACgkQbwltcAfKi3+vjQCfboeXmfrBJzDS1/5NSsO8McDB pwIAn2QOSWif3fZVkCEvLt/se5BoeoFL =SOll -----END PGP SIGNATURE----- -- 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.
rvlinden
2011-Sep-17 15:42 UTC
[Puppet Users] Re: Puppet 2.7.3 Cannot alias .. already defined
On Sep 17, 3:54 pm, Peter Meier <peter.me...@immerda.ch> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > A single manifests works fine, but this is not the only module I have > > where I set permissions using the sysconfig::permissions module. > > Ah, now I as I read your problem better: The error indicates more that > you name two resources with the same name/alias. And you can''t and > shouldn''t do that! > Actually your code should imho not work on 2.6.9 either and yes it looks > like 2.7 got more strict. > > Anyway, you shouldn''t do what you do currently, this is quite dangerous! > > Note: Puppet automagically sets the execute flag on directories, so if > you''d like to have the directory 0750 and the files 0640, then simply > set the mode of the directory to 0640 and to recurse. If you would like > to set the files to 0600, then you have to manage them invidually, > because the file provider of puppet does (currently) not (yet) support > that feature. > > > I can rewrite them, (and probably have to, to make it work again) but > > then it seems that the '' name'' option in the file type is going to be > > obsoleted as it doesn''t work anymore. > > Unlikely, name is quite an important attribute for all resources. It is > more that you end up having two different resources with the same name > or alias. And that should really not be. It looks like a serious bug > _got_ fixed in 2.7 > > ~pete > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAk50prIACgkQbwltcAfKi3+vjQCfboeXmfrBJzDS1/5NSsO8McDB > pwIAn2QOSWif3fZVkCEvLt/se5BoeoFL > =SOll > -----END PGP SIGNATURE-----I just read the 2.7.3 changelog in detail and it''s bug 8596 that was fixed and caused this to not work anymore. they also concluded that the documentation was incorrect and based on that document I created my modules :-( -- 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.