template replacement

Patrick Venture venture at google.com
Tue Aug 13 10:00:56 AEST 2019


On Mon, Aug 12, 2019 at 4:58 PM Ed Tanous <ed.tanous at intel.com> wrote:
>
> On 8/12/19 9:10 AM, Patrick Venture wrote:
> > I've run into an issue and before I submitted a patch to solve my
> > specific problem, I wanted to get a sense of what was intended:
> >
> > I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
> > It finds the $bus match but then fails on the split.
> > If I add a " " it then fails as well.
> >
>
> Probably just a bug.  A quick scan of $bus in the configurations shows
> that we've only ever used it in cases where it was the complete string
> (ie "$bus") and even then, only used to populate numeric interfaces with
> the bus number to be used programmatically by downstream sensors.
>
> Some of the intent was to largely remove the bus number from the device
> naming convention, as outside the system the bus topology is largely
> irrelevant.  With that said, I could see how that might be desired for
> some setups.

Yeah, I figured out it -- there's an assumption that a field has at
least two other words other than $bus.

So like "$bus card temp" will work -> "26_card_temp"

But "$bus temp" will not -> "$bus_temp"

If the field ends with "$bus" it'll just end up being that value as an
int and lose the rest:

"this that $bus" -> 26

I haven't tried to debug the last case yet, and the names I'm using
happen to be two extra words, so I can hold off on fixing that more
generally -- i have a patch that should handle it, but haven't had a
cycle to test it.

>
>
> > It seems to be that if a template is at the end of the field, it works
> > fine, otherwise it assumes there must be some operation to perform.
> >
> > Did you already have a fix in mind?
>
> James is out the next few days, so his answer might differ from mine
> when he gets back, but I don't think we knew about this issue previously.


More information about the openbmc mailing list