Ejemplo n.º 1
0
    def get_magma_version(self):
        cache = apt.Cache()

        # Return the python version if magma is not there
        if 'magma' not in cache:
            return Version(version_code=cache['python3'].versions[0],
                           last_update_time='-')

        pkg = str(cache['magma'].versions[0])
        version = pkg.split('-')[0].split('=')[-1]
        timestamp = int(pkg.split('-')[1])

        return Version(
            version_code=version,
            last_update_time=datetime.utcfromtimestamp(timestamp).replace(
                tzinfo=tz.tzutc()).astimezone(
                    tz=tz.tzlocal()).strftime('%Y-%m-%d %H:%M:%S'))
Ejemplo n.º 2
0
    def get_magma_version(self):
        client = docker.from_env()
        container = client.containers.get('magmad')

        return Version(
            version_code=container.attrs['Config']['Image'],
            last_update_time='-',
        )