Commit ee501db1 authored by Michael Hanselmann's avatar Michael Hanselmann

Move a function from backend to ssconf

The “WriteSsconfFiles” function is used to write ssconf files. By moving
it we can avoid importing backend into bootstrap. The latter is imported
by CLI programs and backend doesn't have much to do with them.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 33e26038
......@@ -2128,15 +2128,6 @@ def RunOob(oob_program, command, node, timeout):
return result.stdout
def WriteSsconfFiles(values):
"""Update all ssconf files.
Wrapper around the SimpleStore.WriteFiles.
"""
ssconf.SimpleStore().WriteFiles(values)
def _OSOndiskAPIVersion(os_dir):
"""Compute and return the API version of a given OS.
......
......@@ -41,7 +41,6 @@ from ganeti import serializer
from ganeti import hypervisor
from ganeti import bdev
from ganeti import netutils
from ganeti import backend
from ganeti import luxi
from ganeti import jstore
from ganeti import pathutils
......@@ -549,7 +548,7 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
cfg = config.ConfigWriter(offline=True)
ssh.WriteKnownHostsFile(cfg, pathutils.SSH_KNOWN_HOSTS_FILE)
cfg.Update(cfg.GetClusterInfo(), logging.error)
backend.WriteSsconfFiles(cfg.GetSsconfValues())
ssconf.WriteSsconfFiles(cfg.GetSsconfValues())
# set up the inter-node password and certificate
_InitGanetiServerSetup(hostname.name)
......
......@@ -49,6 +49,7 @@ from ganeti import storage
from ganeti import serializer
from ganeti import netutils
from ganeti import pathutils
from ganeti import ssconf
import ganeti.http.server # pylint: disable=W0611
......@@ -807,7 +808,7 @@ class NodeRequestHandler(http.server.HttpServerHandler):
"""
(values,) = params
return backend.WriteSsconfFiles(values)
return ssconf.WriteSsconfFiles(values)
# os -----------------------
......
......@@ -511,6 +511,15 @@ class SimpleStore(object):
" family: %s" % err)
def WriteSsconfFiles(values):
"""Update all ssconf files.
Wrapper around L{SimpleStore.WriteFiles}.
"""
ssconf.SimpleStore().WriteFiles(values)
def GetMasterAndMyself(ss=None):
"""Get the master node and my own hostname.
......
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