[pve-devel] [PATCH manager 13/14] ceph: mon destroy: remove from mon_host
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jun 19 12:09:49 CEST 2019
On 6/19/19 12:03 PM, Dominik Csapak wrote:
> On 6/19/19 11:58 AM, Thomas Lamprecht wrote:
>> On 6/18/19 3:42 PM, Dominik Csapak wrote:
>>> + # ip only
>>> + $monhost =~ s/(^|[ ,;]+)\Q$addr\E(?:[ ,;]+|$)/$1/;
>>> + # ip + port
>>> + $monhost =~ s/(^|[ ,;]+)\Q$addr\E:\d+(?:[ ,;]+|$)/$1/;
>>
>> why not both at once with \d*
>
> should work, but we have to do '(:\d+)?'
yeah sure
>
>>
>>> +
>>> + # ipv6 only without brackets
>>> + if ($addr =~ m/^\[?(.*?:.*?)\]?$/) {
>>> + $addr = $1;
>>> + $monhost =~ s/(^|[ ,;]+)\Q$addr\E(?:[ ,;]+|$)/$1/;
>>> + }
>>> +
>>> + # remove trailing seperators
>>> + $monhost =~ s/[ ,;]+$//;
>>
>> not too happy about all above to be honest... but could work for now, I mean
>> you did not invent this "nice" format..
>
> me neither... but the only alternative i see is to build a full parser/writer, which is even more complicated code...
Hmm, not sure, a less-regex but token based one should not be to
problematic, IMO, if time allows I'll try to give it a look, but
until then we can use this.
More information about the pve-devel
mailing list