Hi folks, I''m overriding some resource attribute in a subclass. It seems that specifying a resource by its alias doesn''t work in a subclass. Looks like a bug, no ? === module-classes.pp ==class module::base { file {"/tmp/test-module": alias => test-module, content => "module::base", } } class module::specific inherits module::base { File[test-module] { content => "module::specific", } } include module::specific ======================== With puppet version 0.22.1 as well as latest git checkout: $ puppet module-classes.pp err: Could not find object(s) File[test-module] $ Thanks !
On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote:> Hi folks, > > I''m overriding some resource attribute in a subclass. It seems that > specifying a resource by its alias doesn''t work in a subclass. > > Looks like a bug, no ? > > > === module-classes.pp ==> class module::base { > file {"/tmp/test-module": > alias => test-module, > content => "module::base", > } > } > > class module::specific inherits module::base { > File[test-module] { > content => "module::specific", > } > } > > include module::specific > ========================> > With puppet version 0.22.1 as well as latest git checkout: > > $ puppet module-classes.pp > err: Could not find object(s) File[test-module] > $I''m thinking your alias will be scoped just like the original, i.e. it would be module::test-module, not just test-module... Thijs> > Thanks ! > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
Hmm.. wait a sec. I was too fast. I don''t see a problem really (and I think I have many of the same type of constructs in my manifests). Although.. you might want to quote test-module, as I don''t know how puppet likes the - in there... Thijs On 24/08/07, Thijs Oppermann <thijso+puppet@gmail.com> wrote:> On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote: > > Hi folks, > > > > I''m overriding some resource attribute in a subclass. It seems that > > specifying a resource by its alias doesn''t work in a subclass. > > > > Looks like a bug, no ? > > > > > > === module-classes.pp ==> > class module::base { > > file {"/tmp/test-module": > > alias => test-module, > > content => "module::base", > > } > > } > > > > class module::specific inherits module::base { > > File[test-module] { > > content => "module::specific", > > } > > } > > > > include module::specific > > ========================> > > > With puppet version 0.22.1 as well as latest git checkout: > > > > $ puppet module-classes.pp > > err: Could not find object(s) File[test-module] > > $ > > I''m thinking your alias will be scoped just like the original, i.e. it > would be module::test-module, not just test-module... > > Thijs > > > > > Thanks ! > > _______________________________________________ > > Puppet-users mailing list > > Puppet-users@madstop.com > > https://mail.madstop.com/mailman/listinfo/puppet-users > > >
Thijs Oppermann wrote:> I don''t see a problem really (and I think I have many of the same type > of constructs in my manifests). Although.. you might want to quote > test-module, as I don''t know how puppet likes the - in there...Quoting the alias doesn''t fix it. In fact the following doesn''t work either. ======================class module::base { file {"/tmp/test-module": alias => test-module, content => "module::base", } File[test-module] { content => "module::base2", } } include module::base ====================== err: Could not find object(s) File[test-module] My guess is that the "File[xxx] { }" construct is not correctly taking the aliases into account.
Ok, weirdness. I''ve tested some stuff on my install, and it seems that you''re right: the alias keyword is funky. Using this: class module::base { file { "test-module": path => "/tmp/test-module", content => "module::base", } File[test-module] { content => "module::base2", } } include module::base I get a different error (about not being able to redefine within the same scope), but at least it finds the file resource. So try to work around it like that first. And see if Luke (or someone else) has any good ideas about what''s going on. Thijs On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote:> Thijs Oppermann wrote: > > > I don''t see a problem really (and I think I have many of the same type > > of constructs in my manifests). Although.. you might want to quote > > test-module, as I don''t know how puppet likes the - in there... > > Quoting the alias doesn''t fix it. > > In fact the following doesn''t work either. > > ======================> class module::base { > file {"/tmp/test-module": > alias => test-module, > content => "module::base", > } > File[test-module] { > content => "module::base2", > } > } > include module::base > ======================> > err: Could not find object(s) File[test-module] > > > My guess is that the "File[xxx] { }" construct is not correctly taking > the aliases into account. > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
Thijs Oppermann schrieb:> Ok, weirdness. I''ve tested some stuff on my install, and it seems that > you''re right: the alias keyword is funky. > > Using this: > > class module::base { > file { "test-module": > path => "/tmp/test-module", > content => "module::base", > } > File[test-module] { > content => "module::base2", > } > } > include module::base > > > I get a different error (about not being able to redefine within the > same scope), but at least it finds the file resource.Thats the right behavior i´d say - in your example you want to redefine the file in the same class you created it in which doesn´t make a lot of sense to me. This should work: # class module::base { file { "mytest-module": alias => "test-module" path => "/tmp/test-module", content => "module::base", } } class module::base2 inherits module::base { File[test-module] { content => "module::base2", } } include module::base2 #> So try to work > around it like that first. And see if Luke (or someone else) has any > good ideas about what''s going on. > > > Thijs > > On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote: > >> Thijs Oppermann wrote: >> >> >>> I don''t see a problem really (and I think I have many of the same type >>> of constructs in my manifests). Although.. you might want to quote >>> test-module, as I don''t know how puppet likes the - in there... >>> >> Quoting the alias doesn''t fix it. >> >> In fact the following doesn''t work either. >> >> ======================>> class module::base { >> file {"/tmp/test-module": >> alias => test-module, >> content => "module::base", >> } >> File[test-module] { >> content => "module::base2", >> } >> } >> include module::base >> ======================>> >> err: Could not find object(s) File[test-module] >> >> >> My guess is that the "File[xxx] { }" construct is not correctly taking >> the aliases into account. >> _______________________________________________ >> Puppet-users mailing list >> Puppet-users@madstop.com >> https://mail.madstop.com/mailman/listinfo/puppet-users >> >> > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
On 24/08/07, Simon Mügge <simu@webde.de> wrote:> Thijs Oppermann schrieb: > > Ok, weirdness. I''ve tested some stuff on my install, and it seems that > > you''re right: the alias keyword is funky. > > > > Using this: > > > > class module::base { > > file { "test-module": > > path => "/tmp/test-module", > > content => "module::base", > > } > > File[test-module] { > > content => "module::base2", > > } > > } > > include module::base > > > > > > I get a different error (about not being able to redefine within the > > same scope), but at least it finds the file resource. > Thats the right behavior i´d say - in your example you want to redefine > the file in the same class you created it in which doesn´t make a lot of > sense to me. >Ugh... yeah, should have elaborated. I was just saying that the original poster''s problem went away, so if he uses it like that he should be able to get his idea working. Thijs> This should work: > > # > class module::base { > file { "mytest-module": > alias => "test-module" > path => "/tmp/test-module", > content => "module::base", > } > } > > class module::base2 inherits module::base { > File[test-module] { > content => "module::base2", > } > } > > include module::base2 > # > > > > So try to work > > around it like that first. And see if Luke (or someone else) has any > > good ideas about what''s going on. > > > > > > Thijs > > > > On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote: > > > >> Thijs Oppermann wrote: > >> > >> > >>> I don''t see a problem really (and I think I have many of the same type > >>> of constructs in my manifests). Although.. you might want to quote > >>> test-module, as I don''t know how puppet likes the - in there... > >>> > >> Quoting the alias doesn''t fix it. > >> > >> In fact the following doesn''t work either. > >> > >> ======================> >> class module::base { > >> file {"/tmp/test-module": > >> alias => test-module, > >> content => "module::base", > >> } > >> File[test-module] { > >> content => "module::base2", > >> } > >> } > >> include module::base > >> ======================> >> > >> err: Could not find object(s) File[test-module] > >> > >> > >> My guess is that the "File[xxx] { }" construct is not correctly taking > >> the aliases into account. > >> _______________________________________________ > >> Puppet-users mailing list > >> Puppet-users@madstop.com > >> https://mail.madstop.com/mailman/listinfo/puppet-users > >> > >> > > _______________________________________________ > > Puppet-users mailing list > > Puppet-users@madstop.com > > https://mail.madstop.com/mailman/listinfo/puppet-users > > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
Thijs Oppermann wrote:> I get a different error (about not being able to redefine within the > same scope), but at least it finds the file resource. So try to work > around it like that first. And see if Luke (or someone else) has any > good ideas about what''s going on.Right, this workaround works. A bug report was filed as #790. class module::base { file {"test-module": path => "/tmp/test-module", alias => test-module, content => "module::base", } } class module::specific inherits module::base { File["test-module"] { content => "module::specific", } } include module::specific
Reading this: http://reductivelabs.com/trac/puppet/wiki/TypeReference#available-metaparameters I think this might be a known thing, and not necessarily a (real) bug. It looks like the way you''re trying to use alias here is not how it was meant to be used. Thijs On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote:> Thijs Oppermann wrote: > > > I get a different error (about not being able to redefine within the > > same scope), but at least it finds the file resource. So try to work > > around it like that first. And see if Luke (or someone else) has any > > good ideas about what''s going on. > > Right, this workaround works. A bug report was filed as #790. > > > class module::base { > file {"test-module": > path => "/tmp/test-module", > alias => test-module, > content => "module::base", > } > } > class module::specific inherits module::base { > File["test-module"] { > content => "module::specific", > } > } > include module::specific > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
On Aug 24, 2007, at 8:03 AM, Francois Deppierraz wrote:> My guess is that the "File[xxx] { }" construct is not correctly taking > the aliases into account.Exactly. It''s got nothing to do with being in a class or whatever. The ''alias'' metaparam is only used on the client, which means that the parser doesn''t know anything about it. I can''t decide if this is a bug or not, considering that you''ve already got the ability to easily have two names for your resource (the name and title). In retrospect, though, it might make more sense to get rid of this whole name/title split and just stick to aliases as the means of providing multiple names. Hmm. I never thought of that. Hrm. /me swoons -- Nature and nature''s laws lay hid in night, God said, "Let Newton be," and all was light. It did not last; the devil howling "Ho! Let Einstein be!" restored the status quo. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Francois Deppierraz
2007-Aug-28 10:18 UTC
[Puppet-users] Aliases not working in a subclass ?
Luke Kanies wrote:> The ''alias'' metaparam is only used on the client, which means that > the parser doesn''t know anything about it. I can''t decide if this is > a bug or not, considering that you''ve already got the ability to > easily have two names for your resource (the name and title).Thanks, everything is now working fine using title/name instead of title/alias. Ticket #790 type was changed to enhancement.> In retrospect, though, it might make more sense to get rid of this > whole name/title split and just stick to aliases as the means of > providing multiple names. Hmm. I never thought of that. Hrm.In my base, the alias meta-parameter was more intuitive at first than using a name attribute. What was the reasoning behind the implementation of the alias meta-parameter ?
On Aug 28, 2007, at 12:18 PM, Francois Deppierraz wrote:> > Thanks, everything is now working fine using title/name instead of > title/alias. Ticket #790 type was changed to enhancement.Great.> In my base, the alias meta-parameter was more intuitive at first than > using a name attribute. > > What was the reasoning behind the implementation of the alias > meta-parameter ?The reasoning was that sometimes resources have lots of names. I really never realized the extent to which the aliases metaparam can be used to replace this whole name/title thing. I feel like a complete ninny. Considering I''m already planning on refactoring the RAL as my next big refactor project, after this REST => XMLRPC thing, I''ll probably switch to making aliases work throughout both the language and library, and get rid of the title/name thing, since it would be redundant (yay, three naming parameters). -- Everything that is really great and inspiring is created by the individual who can labor in freedom. -- Albert Einstein --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com