Commits

Christophe Chauvet committed b775ed1

add release function to retrieve the version of the debian distribution or derivated version

  • Participants
  • Parent commits 2a293b4

Comments (0)

Files changed (1)

File fabric/contrib/debian/__init__.py

 
 __import__('pkg_resources').declare_namespace(__name__)
 
+from fabric.api import env, sudo, run
+
+def release():
+    """
+    Return the version of the distribution
+    Use lsb_release
+    """
+    res = run('lsb_release -idrc')
+    ret = {}
+    for i in res.splitlines():
+        (j, k) = i.split(':')
+        ret[j.replace(' ', '_')] = k.strip()
+    return ret
+
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: