On Tue, Jun 5, 2012 at 2:07 PM, Lars Ellenberg <lars.ellenb...@linbit.com>wrote:
> On Sat, Jun 02, 2012 at 03:07:10PM +0300, Borislav Borisov wrote: > > Hello, > > > > I have patched the exportfs RA to allow anonymous usage. The patch is in > > the following fork commit - > > > https://github.com/borislav-borisov/resource-agents/commit/be684a71c1fd1b5811df399101752078ac7c9e3e > > . > > I'm lazy. > If I am asked by email to look at patches, > I really like them to be inlined in that very email. > Saves so much time. > Noted. > wget -nv -O- > https://github.com/borislav-borisov/resource-agents/commit/be684a71c1fd1b5811df399101752078ac7c9e3e.diff > diff --git a/heartbeat/exportfs b/heartbeat/exportfs > index 8bcc1ea..fb2a24e 100755 > --- a/heartbeat/exportfs > +++ b/heartbeat/exportfs > @@ -188,7 +188,7 @@ exportfs_monitor () > # We unwrap here with sed. > # We then do a literal match on the full line (grep -x -F) > exportfs | > - sed -e '$! N; s/\n[[:space:]]\+/ /; t; > s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; P;D;' | > + sed -e '$! N; s/\n[[:space:]]\+/ /; t; > s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; s/<world>/*/g; P;D;' | > grep -q -x -F "${OCF_RESKEY_directory} > ${OCF_RESKEY_clientspec}" > > #Adapt grep status code to OCF return code > > > > Ok. So we forgot about exportfs "*:/path", > which is shown as /path <world>. > > I'd like to have it anchored. > oes this still work for you? > > + sed -e '$! N; s/\n[[:space:]]\+/ /; t; > s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; s/ <world>$/ */g; P;D;' To some extent it does... it will catch the ones that end with <world>, but the problem is the search and replaces used are appending a newline. Also, I initially missed a replace after the first search and replace. Eventually I ended up with something close to what you want: sed -e '$! N; s/\n[[:space:]]\+/ /; s/ <world>$/ */g; t; s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; s/ <world>\(\n\|$\)/ *\1/g; P;D;' That one, however, is bugging me a lot. So I came up with another solution, which of course isn't anchored either, but is more readable: sed -n '1h; 1!H; ${g; s/[[:space:]]\+\([^[:space:]]\+\)\(\n\|$\)/ \1\2/g; s/ <world>/ */g; p}' I do not consider myself a sed guru, maybe someone who is can figure a better approach. > > > > -- > : Lars Ellenberg > : LINBIT | Your Way to High Availability > : DRBD/HA support and consulting http://www.linbit.com > _______________________________________________________ > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > Home Page: http://linux-ha.org/ >
_______________________________________________________ Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/