fab-user
[Top][All Lists]
Advanced

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

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


From: Tim O'Guin
Subject: [Fab-user] Problems escaping double and single quotes within run()
Date: Wed, 16 Jan 2013 14:29:21 -0600

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



reply via email to

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