XAL - execution abstration layer

Presentation of XAL proof-of-concept, by Benoit Bryon.

This work is licensed under a Creative Commons Attribution 3.0 Unported License (CC BY 3.0)

Python for sysadmins

Python is great:

  • shell, scripts, provisioners, frameworks...
  • runs on almost any system


It’s hard to write and share portable scripts

  • environment vary: users, packages...
  • provisioners are overkill: just want a shell or a simple script
  • libraries are divided: fabric, buildout, salt...

Develop to XAL session

Write a script which takes a XAL session as argument:

def write_greetings(session):
    """Write 'Hello world!' in 'greetings.txt' file relative to user's home."""
    home = session.user.home
    file_path = session.file.join(home, 'greetings.txt')
    file_resource = session.file(file_path)
    if not file_resource.exists():
        file_resource.write('Hello world!')


Use it in a fabfile:

from fabric.api import task
import write_greetings
import xal

def hello_fabric():
    session = xal.fabric(sudoer=True)


In a buildout recipe:

import write_greetings
import xal

class HelloBuildout(object):
    def __init__(self, buildout, name, options):
        self.session = xal.buildout(buildout, name, options)

    def install(self):

    def update(self)


As a salt module:

import write_greetings
import xal

def hello_salt():
    session = xal.salt(__salt__)


In an interactive shell:

import write_greetings
import xal
session = xal.local()


XAL session is a proxy to resources:

  • files, directories,
  • users,
  • processes,
  • packages,
  • your own customized resources...

Share and reuse scripts!

  • Reduced cost of change
  • Enhanced collaboration between projects related to deployment

=> What about scripts fabric, buildout, salt... can share on PyPI?

XAL is a proof of concept