[PATCH master] Move a function from backend to ssconf

3 views
Skip to first unread message

Michael Hanselmann

unread,
Oct 3, 2012, 9:32:51 PM10/3/12
to ganeti...@googlegroups.com
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.
---
lib/backend.py | 9 ---------
lib/bootstrap.py | 3 +--
lib/server/noded.py | 3 ++-
lib/ssconf.py | 9 +++++++++
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index 912cd8c..dc1378f 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -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.

diff --git a/lib/bootstrap.py b/lib/bootstrap.py
index 7d25b49..dfd415b 100644
--- a/lib/bootstrap.py
+++ b/lib/bootstrap.py
@@ -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)
diff --git a/lib/server/noded.py b/lib/server/noded.py
index 7a41449..9561f0e 100644
--- a/lib/server/noded.py
+++ b/lib/server/noded.py
@@ -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 -----------------------

diff --git a/lib/ssconf.py b/lib/ssconf.py
index ae12149..ce7f876 100644
--- a/lib/ssconf.py
+++ b/lib/ssconf.py
@@ -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.

--
1.7.7.3

Iustin Pop

unread,
Oct 3, 2012, 9:37:45 PM10/3/12
to Michael Hanselmann, ganeti...@googlegroups.com
On Thu, Oct 04, 2012 at 03:32:51AM +0200, Michael Hanselmann wrote:
> 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.

LGTM, thanks.

iustin

Iustin Pop

unread,
Oct 3, 2012, 9:50:33 PM10/3/12
to Michael Hanselmann, ganeti...@googlegroups.com
Except that you didn't even run pylint. Please be more careful :)

iustin

Michael Hanselmann

unread,
Oct 3, 2012, 9:51:56 PM10/3/12
to Iustin Pop, ganeti...@googlegroups.com
2012/10/4 Iustin Pop <ius...@google.com>:
> Except that you didn't even run pylint. Please be more careful :)

Yes, a patch is coming. Sorry!

Michael
Reply all
Reply to author
Forward
0 new messages