[kolla-ansible][kolla] merge_configs module replacing colon to equal

Sharath Ck sharath.madhava at gmail.com
Thu Jun 9 08:57:03 UTC 2022


Hi Mark,

Yes, that would be correct. If the function returns the delimiter and uses
the same while mapping key value, it would keep the config content intact.

If colon can be replaced by equal and vice versa in openstack configs,
especially api-paste.ini. I can continue with the merge now and update the
merge_configs module when a fix is available.

Regards,
Sharath


On Thu, Jun 9, 2022 at 2:20 PM Mark Goddard <mark at stackhpc.com> wrote:

> Hi Sharath,
>
> I had not realised this. Wikipedia suggests colons are sometimes used
> instead of equals. Perhaps the function should return which delimiter was
> found, and use it to generate the merged file?
>
> Mark
>
> On Tue, 7 Jun 2022 at 06:19, Sharath Ck <sharath.madhava at gmail.com> wrote:
>
>> Hi,
>>
>> In kolla-ansible, I am using the merge_configs module to merge service
>> configs files. I want to merge api-paste.ini config with my custom changes,
>> however while merging if a line consists of one colon, it is getting
>> replaced with equal sign. merge_configs splits the line by considering
>> colon as delimiter and treats two parts as key and value. Later which will
>> be substituted as key = value.
>>
>> Original
>> */v2.1: oscomputeversion_v2*
>> Merged
>> */v2.1= oscomputeversion_v2  *
>>
>> Below, colon will be 1 and equal will be -1,
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *def _split_key_value(self, line):        colon = line.find(':')
>> equal = line.find('=')        if colon < 0 and equal < 0:            return
>> self.error_invalid_assignment(line)        if colon < 0 or (equal >= 0 and
>> equal < colon):            key, value = line[:equal], line[equal + 1:]
>>   else:            key, value = line[:colon], line[colon + 1:]        value
>> = value.strip()        if value and value[0] == value[-1] and
>> value.startswith(("\"", "'")):            value = value[1:-1]        return
>> key.strip(), [value]*
>>
>> I want to keep the config as it is and merge only my custom changes.
>> Please let me know how to achieve this or colon can be escaped somehow.
>>
>> Regards,
>> Sharath
>> Regards,
>> Sharath
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20220609/888f73e0/attachment.htm>


More information about the openstack-discuss mailing list