On 11/27, 'Tom Farrow' via Foreman users wrote:
> Hi,
>
> We'd like to rename a couple of classes, retaining all parameter overrides
> etc.
>
> We're looking to move "::apache" to "::legacy_apache" including all other
> classes within the module (::apache::mod::python etc).
>
> To me, the workflow seems to be:
> - Change code to use the new name
> - In the Foreman database, change the class names in the `puppetclasses`
> table (ie, update `puppetclasses` set `name` = 'apache' where `id`='15')
>
> Do we need to change the class name anywhere else? It looks like Foreman
> always references via this table for lookups, but I may be mistaken.
>
> Is there a nicer way to do this? Maybe via foreman-console?

Via foreman-console, you'd also ensure any references get updated. I would not
recommend doing any updates updating the db rows directly.

Also Puppetclasses in Foreman just have one attribute, 'name', no inheritance
or anything like that. You will have to update classes that look like apache
to legacy_apache.

For example, through the console:

Puppetclass.search_for("apache").each do |puppetclass|
  new_name = puppetclass.name.sub('apache', 'legacy_apache')
    puppetclass.update_attributes(:name => new_name)
end

Obviously test in a sandbox first, but I was able to rename the class in the
same way. I imagine the reason you want to do this is to preserve your 
overrides,
correct?


>
> Thanks for your help in advance
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Foreman users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/foreman-users.
> For more options, visit https://groups.google.com/d/optout.


--
Daniel Lobato Garcia

@dLobatog
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30
Keybase: https://keybase.io/elobato

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: PGP signature

Reply via email to