Skip to content
Snippets Groups Projects
Commit b9a6a071 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added hkvmver and hkvmsetup tags

parent dcc18468
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ Just define a string or a function and it will be introspected and used as a
tag value.
"""
import re
import time
import datetime
import os as os_
import platform as platform_
from multiprocessing import cpu_count
......@@ -207,3 +209,17 @@ def load():
def plugins(handler):
return ' '.join(handler.plugins) or None
# HKVM related tags
def hkvmver():
"""HKVM version."""
fields = dict(x.split(': ', 1) for x in open('/etc/isimage').read().split('\n') if x.strip())
return int(fields['image version'])
def hkvmsetup():
"""HKVM setup date."""
fields = dict(x.split(': ', 1) for x in open('/etc/isimage').read().split('\n') if x.strip())
setup_date = datetime.datetime.strptime(fields['setup date'], '%a, %d %b %Y %H:%M:%S +0000')
return int(time.mktime(setup_date.timetuple()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment