Commit a3110c05 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Christos Stavrakakis
Browse files

Add os per node



This is needed for heterogeneous setups.
Depending on os the corresponding sources file is added
and the proper synnefo packages are installed (~wheezy or ~squeeze)
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
parent 09a3ee55
......@@ -5,6 +5,9 @@ domain = synnefo.live
subnet = 192.168.0.0/28
gateway = 192.168.0.14
[os]
node1 = squeeze
# node2 = wheezy
[hostnames]
node1 = auto1
......
......@@ -76,9 +76,10 @@ def install_package(package):
debug(env.host, " * Installing package %s..." % package)
APT_GET = "export DEBIAN_FRONTEND=noninteractive ;apt-get install -y --force-yes "
host_info = env.env.ips_info[env.host]
if ast.literal_eval(env.env.use_local_packages):
with settings(warn_only=True):
deb = local("ls %s/%s*deb" % (env.env.packages, package))
deb = local("ls %s/%s*%s.deb" % (env.env.packages, package, host_info[os]))
if deb:
debug(env.host, " * Package %s found in %s..." % (package, env.env.packages))
put(deb, "/tmp/")
......@@ -87,7 +88,9 @@ def install_package(package):
return
info = getattr(env.env, package)
if info in ["stable", "squeeze-backports", "testing", "unstable"]:
if info in ["squeeze-backports", "stable", "testing", "unstable"]:
if info == "squeeze-backports" and host_infa.os = "wheezy":
info = host_info.os
APT_GET += " -t %s %s " % (info, package)
elif info:
APT_GET += " %s=%s " % (package, info)
......@@ -358,7 +361,11 @@ def setup_apt():
curl -k https://dev.grnet.gr/files/apt-grnetdev.pub | apt-key add -
"""
try_run(cmd)
tmpl = "/etc/apt/sources.list.d/okeanos.list"
host_info = env.env.ips_info[env.host]
if host_info.os == "squeeze":
tmpl = "/etc/apt/sources.list.d/synnefo.squeeze.list"
else:
tmpl = "/etc/apt/sources.list.d/synnefo.wheezy.list"
replace = {}
custom = customize_settings_from_tmpl(tmpl, replace)
put(custom, tmpl)
......
deb http://ftp.de.debian.org/debian wheezy main non-free contrib
deb http://apt.dev.grnet.gr wheezy/
deb http://www.rabbitmq.com/debian/ testing main
......@@ -45,11 +45,12 @@ if not sys.stdout.isatty():
class Host(object):
def __init__(self, hostname, ip, mac, domain):
def __init__(self, hostname, ip, mac, domain, os):
self.hostname = hostname
self.ip = ip
self.mac = mac
self.domain = domain
self.os = os
@property
def fqdn(self):
......@@ -67,7 +68,7 @@ class Host(object):
class Alias(Host):
def __init__(self, host, alias):
super(Alias, self).__init__(host.hostname, host.ip, host.mac,
host.domain)
host.domain, host.os)
self.alias = alias
@property
......@@ -95,6 +96,7 @@ class Env(object):
self.node2hostname = dict(conf.get_section("nodes", "hostnames"))
self.node2ip = dict(conf.get_section("nodes", "ips"))
self.node2mac = dict(conf.get_section("nodes", "macs"))
self.node2os = dict(conf.get_section("nodes", "os"))
self.hostnames = [self.node2hostname[n]
for n in self.nodes.split(",")]
......@@ -115,7 +117,7 @@ class Env(object):
for node in self.nodes.split(","):
host = Host(self.node2hostname[node],
self.node2ip[node],
self.node2mac[node], self.domain)
self.node2mac[node], self.domain, self.node2os[node])
self.nodes_info[node] = host
self.hosts_info[host.hostname] = host
......
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