fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Problems escaping double and single quotes within run()


From: Gilgamezh
Subject: Re: [Fab-user] Problems escaping double and single quotes within run()
Date: Wed, 16 Jan 2013 18:20:35 -0300
User-agent: Roundcube Webmail/0.8.4

Hi! maybe you can cat de file and then do a local parse with python. something like this:

pidginConfg = run('cat /path/to/file.conf')

now you have the file in pidginConfig and you can parse it. --> http://docs.python.org/2/library/xml.etree.elementtree.html#parsing-xml

Regards!!

Nicolás
address@hidden



El 2013-01-16 17:29, Tim O'Guin escribió:
Hi, all.

First off, I'm new to Fabric and Python, so I apologize if this is
something obvious that I'm doing wrong.

I'm writing a program to audit an XML config file on remote hosts.
Specifically, I'm auditing the configuration file for Pidgin to ensure
that chat logging is disabled. I'm attempting to use grep to find the
relevant lines and sed to pull out the True/False bool.

Here are the two relevant lines of code:

imbool = sudo("grep '<pref name=\'log_ims\' type=\'bool\'
value=\'[0|1]\'/>' " + configfile + " | sed 's/.*
value=\'\([01]\)\'.*/\1/'")
chatbool = sudo("grep '<pref name=\'log_chats\' type=\'bool\'
value=\'[0|1]\'/>' " + configfile + " | sed 's/.*
value=\'\([01]\)\'.*/\1/'")

I've gone around and around trying to escape quotes in different ways,
but none of them are working. I was told in the IRC channel that
escaping quotes is problematic.

I figured I'd make sure I'm not just missing something obvious before
I figure out the Python way to do it (i.e., without grep and sed).

Thanks!

- Tim O'Guin

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user



reply via email to

[Prev in Thread] Current Thread [Next in Thread]