Commit e2f53cce authored by Marco Mariani's avatar Marco Mariani

check compatible platforms

parent 155b8629
...@@ -5,10 +5,13 @@ import argparse ...@@ -5,10 +5,13 @@ import argparse
import ConfigParser import ConfigParser
import hashlib import hashlib
import json import json
import platform
import re import re
import sys import sys
import urllib2 import urllib2
from slapos.grid import networkcache
def maybe_md5(s): def maybe_md5(s):
return re.match('[0-9a-f]{32}', s) return re.match('[0-9a-f]{32}', s)
...@@ -42,8 +45,11 @@ def cache(): ...@@ -42,8 +45,11 @@ def cache():
entries = json.loads(response.read()) entries = json.loads(response.read())
linux_distribution = platform.linux_distribution()
header_printed = False header_printed = False
ostable = []
for entry in entries: for entry in entries:
meta = json.loads(entry[0]) meta = json.loads(entry[0])
os = ast.literal_eval(meta['os']) os = ast.literal_eval(meta['os'])
...@@ -52,9 +58,13 @@ def cache(): ...@@ -52,9 +58,13 @@ def cache():
print 'MD5: %s' % md5 print 'MD5: %s' % md5
print '-------------' print '-------------'
print 'Available for: ' print 'Available for: '
print 'distribution | version | id' print 'distribution | version | id | compatible?'
print '-----------------+--------------+---------------' print '-----------------+--------------+----------------+-------------'
header_printed = True header_printed = True
ostable.append(os)
ostable.sort()
print '%-16s | %12s | %s' % (os[0], os[1], os[2].center(14)) for os in ostable:
compatible = 'yes' if networkcache.os_matches(os, linux_distribution) else 'no'
print '%-16s | %12s | %s | %s' % (os[0], os[1], os[2].center(14), compatible)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment