You could do something like:
param = PuppetclassLookupKey.search_for('puppetclass = myclass and
key=MyParam').first
param.key.downcase!
param.save
On Mon, Jul 31, 2017 at 4:34 PM, 'Tom Farrow' via Foreman users <
[email protected]> wrote:
> This is a very interesting and viable option, thank you.
>
> Would you perhaps know of a way to use this to change a single parameter
> override at a time? Note that we use some parameter names across multiple
> classes, so I would want to be very specific.
>
> On Monday, 31 July 2017 12:03:42 UTC+1, Tomer Brisker wrote:
>>
>> You could work around this by renaming the parameters in foreman itself
>> using the foreman-console.
>> Something like:
>>
>> LookupKey.unscoped.all.each{|key| key.key.downcase!; key.save}
>>
>> should change the saved names of all class parameters to lowercase.
>>
>> Of course the puppetclasses should still be modified to look for the
>> lower case version of the parameter.
>>
>> On Mon, Jul 31, 2017 at 1:54 PM, 'Tom Farrow' via Foreman users <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> We're currently working, slowly, on preparing ourselves to upgrade from
>>> Puppet 3.
>>>
>>> In historic bad practice, there are a number of poorly chosen parameter
>>> names in our code. We have been able to fix issues with bad formatting,
>>> names, etc, but we're hitting an issue.
>>>
>>> From Puppet 4, parameters must not start with a capital letter.
>>> Unfortunately many of ours do. We can easily fix this on the Puppet side,
>>> but while foreman is case-aware, it does not seem to be case-sensitive. We
>>> are therefore inable to import new, decapitalised variable names into
>>> Foreman.
>>>
>>> We somehow need to import these new parameters and persist overrides set
>>> on them.
>>>
>>> The planned workflow was (assuming a bad parameter called "BadParam":
>>> -> Declare new parameter name in Puppet (ie, define "badparam") -> Copy
>>> all overrides manually from "BadParam" to "badparam" -> Delete "BadParam"
>>> from puppet, and switch all templates/other usages to use "badparam"
>>>
>>> We can't go with this, since importing two parameter names with just a
>>> difference in case won't work.
>>>
>>> I'm not sure whether this is a design in Puppet or Foreman.
>>>
>>> I'd really appreciate suggestions how we'd be able to achieve our goal.
>>> We'd rather avoid having to entirely change the parameter name.
>>>
>>> Thank you in advance for any advice, and let me know if I'm missing any
>>> information needed.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Have a nice day,
>> Tomer Brisker
>> Red Hat Engineering
>>
> --
> 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.
>
--
Have a nice day,
Tomer Brisker
Red Hat Engineering
--
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.