Ben Beuchler
2008-Dec-19 00:55 UTC
[Puppet Users] changing "name" of resource without changing the title
My initial base config contained a "vim" package. After installing a few servers I realized what I really wanted was a "vim-nox" package. Feeling clever, I changed this: package {"vim": ensure => installed, } To this: package {"vim": name => "vim-nox", ensure => installed, } That way I could still refer to the package by the generic term "vim" but I would get the bloated version. Unfortunately, none of the client nodes are picking up the change. They seem to think that since the resource is still called "vim" they don''t have to re-install it. Is there anything I can do to get this change to propagate? Of course if I go to each client and remove the "vim" package it gets replaced at the next run with "vim-nox", but I''m hoping for something a bit more elegant. And, perhaps, an explanation enumerating the ways in which my course of action was clueless. Thanks... -Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frank Sweetser
2008-Dec-19 01:14 UTC
[Puppet Users] Re: changing "name" of resource without changing the title
Ben Beuchler wrote:> My initial base config contained a "vim" package. After installing a > few servers I realized what I really wanted was a "vim-nox" package. > > Feeling clever, I changed this: > > package {"vim": > ensure => installed, > } > > To this: > > package {"vim": > name => "vim-nox", > ensure => installed, > } > > That way I could still refer to the package by the generic term "vim" > but I would get the bloated version. Unfortunately, none of the > client nodes are picking up the change. They seem to think that since > the resource is still called "vim" they don''t have to re-install it. > > Is there anything I can do to get this change to propagate? Of course > if I go to each client and remove the "vim" package it gets replaced > at the next run with "vim-nox", but I''m hoping for something a bit > more elegant. And, perhaps, an explanation enumerating the ways in > which my course of action was clueless.The fact that a run after manually removing the vim package installs vim-nox suggests to me that puppet itself is actually picking up on the change fine. (You could run puppetd with --debug to check this.) My first thought would be that your vim package is set up to advertise itself as providing an acceptable substitute for the vim-nox package. Thus, when puppet asks your package manager "do you have the vim-nox package installed?" it says "sure!" You don''t say which package manager you''re using, so this is purely speculation, but it would be simple enough to create a manifest to test this out. Try something like this: package { "vim-purge": name => "vim", ensure => absent } package { "vim": name => "vim-nox", ensure => installed, require => Package["vim-purge"] } The require should make sure that it uninstalls the vim package before attempting to install the vim-nox package. As an alternative, you could make a tiny class that contains just those two packages, and then refer to the vim class instead. That way you''d avoid the potentially confusing title vs name differences. -- Frank Sweetser fs at wpi.edu | For every problem, there is a solution that WPI Senior Network Engineer | is simple, elegant, and wrong. - HL Mencken GPG fingerprint = 6174 1257 129E 0D21 D8D4 E8A3 8E39 29E3 E2E8 8CEC --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ben Beuchler
2008-Dec-19 01:44 UTC
[Puppet Users] Re: changing "name" of resource without changing the title
> My first thought would be that your vim package is set up to advertise itself > as providing an acceptable substitute for the vim-nox package. Thus, when > puppet asks your package manager "do you have the vim-nox package installed?" > it says "sure!"It doesn''t look like it. Perusing the code for the provider, it looks like it uses this command to test for the presence of "vim-nox": # /usr/bin/dpkg-query -W --showformat ''${Status} ${Package} ${Version}\n'' vim-nox purge ok not-installed vim-nox # /usr/bin/dpkg-query -W --showformat ''${Status} ${Package} ${Version}\n'' vim install ok installed vim 1:7.1-138+1ubuntu3 As you can see, it admits it is not installed. Despite this, running "puppetd --test --debug" shows prefetching the package list and then no attempt to install vim-nox. No mention of> You don''t say which package manager you''re using, so this is purely speculation, > but it would be simple enough to create a manifest to test this out.I''m using the "aptitude" provider.> package { "vim-purge": > name => "vim", > ensure => absent > } > package { "vim": > name => "vim-nox", > ensure => installed, > require => Package["vim-purge"] > }Excellent suggestion. That, of course, fixed the problem. It''s still not clear to me why this happened, which is going to annoy me for a bit. Thanks! -Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Marcin Owsiany
2008-Dec-19 13:18 UTC
[Puppet Users] Re: changing "name" of resource without changing the title
On Thu, Dec 18, 2008 at 07:44:46PM -0600, Ben Beuchler wrote: [...]> > > package { "vim-purge": > > name => "vim", > > ensure => absent > > } > > package { "vim": > > name => "vim-nox", > > ensure => installed, > > require => Package["vim-purge"] > > } > > Excellent suggestion. That, of course, fixed the problem.That is not ideal, though, as it leaves you with a window of not having any vim installed. It would be better if puppet just decided to install vim-nox, at which point aptitude would remove vim if needed, before configuring vim-nox. -- Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/ GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216 "Every program in development at MIT expands until it can read mail." -- Unknown --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---