<div dir="ltr">Hi Mark,<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,<div>Sharath</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 9, 2022 at 2:20 PM Mark Goddard <<a href="mailto:mark@stackhpc.com">mark@stackhpc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi Sharath,</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">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?</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Mark</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 7 Jun 2022 at 06:19, Sharath Ck <<a href="mailto:sharath.madhava@gmail.com" target="_blank">sharath.madhava@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><br>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.<div><br></div><div>Original</div><div><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap"><i>/v2.1: oscomputeversion_v2</i></span></div><div><font color="#24292f" face="ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace"><span style="font-size:12px;white-space:pre-wrap">Merged</span></font></div><div><i><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">/v2.1= oscomputeversion_v2</span> </i><font color="#24292f" face="ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace"><span style="font-size:12px;white-space:pre-wrap"><br></span></font><br>Below, colon will be 1 and equal will be -1,<br><br><i>def _split_key_value(self, line):<br> colon = line.find(':')<br> equal = line.find('=')<br> if colon < 0 and equal < 0:<br> return self.error_invalid_assignment(line)<br><br> if colon < 0 or (equal >= 0 and equal < colon):<br> key, value = line[:equal], line[equal + 1:]<br> else:<br> key, value = line[:colon], line[colon + 1:]<br><br> value = value.strip()<br> if value and value[0] == value[-1] and value.startswith(("\"", "'")):<br> value = value[1:-1]<br> return key.strip(), [value]</i><br> <br>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.<br><br>Regards,<br>Sharath <br clear="all"><div><div dir="ltr"><div dir="ltr">Regards,<div>Sharath</div></div></div></div></div></div>
</blockquote></div>
</blockquote></div>