Skip to main content

Fabric extension: xfiles

Project description

This package contains the xfiles - Fabric extension. The module adds the support to work with XML files in Fabric.

Read the official documentation for installation, usage and examples: http://packages.python.org/fabric-contrib.xfiles

Usage

Brief introduction for xfiles -extension usage:

  1. Create Fabric configuration file fabfile.py, for example with following contents:

    from fabric.api import env, run
    from fabric.contrib import xfiles
    
    def test():
      for elem in xfiles.query('~/document.xml', '/root/item[id=test*]'):
        # List all the elements having the attribute 'id'·
        # and it with value 'test', or something that starts with it
        print elem.text
    

    In this example, it is expected you have XML -document in your home directory (on remotehost -server), for example:

    <root>
      <item id="foo">value1</item>
      <item id="testing">value2</item>
      <item id="test">value3</item>
    </root>
    
  2. To see the outcome, run the command:

    fab --username hostaccount -H remotehost test
    

    Unless you have SSH private key provided for the remotehost, it’ll prompt for the password. After successful login, the XML file is read and text from all /root/item -elements is listed.

    Tip

    If the host parameter is not provided, or it is localhost, no SSH connection is needed/created and the file path is expected to be found from local filesystem. For example, following query reads the XML from· same directory where the fabfile.py is:

    for elem in xfiles.query('test.xml', '/root/sub'):
      print elem
    

See more examples and detailed information from official documentation: http://packages.python.org/fabric-contrib.xfiles

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fabric-contrib.xfiles, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size fabric_contrib.xfiles-0.1.1-py2.6.egg (10.5 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size fabric-contrib.xfiles-0.1.1.tar.gz (8.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page