Commit c6d58a2b authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Remove REQ_CLUSTER from opcode handling code

It's not needed anymore now that all opcodes require a cluster. Cluster
initialization was the only exception.

Reviewed-by: iustinp
parent c4dbb30a
......@@ -54,14 +54,13 @@ class LogicalUnit(object):
- implement Exec
- implement BuildHooksEnv
- redefine HPATH and HTYPE
- optionally redefine their run requirements (REQ_CLUSTER,
REQ_MASTER); note that all commands require root permissions
- optionally redefine their run requirements (REQ_MASTER); note that all
commands require root permissions
"""
HPATH = None
HTYPE = None
_OP_REQP = []
REQ_CLUSTER = True
REQ_MASTER = True
def __init__(self, processor, op, cfg, sstore):
......@@ -82,15 +81,15 @@ class LogicalUnit(object):
if attr_val is None:
raise errors.OpPrereqError("Required parameter '%s' missing" %
attr_name)
if self.REQ_CLUSTER:
if not cfg.IsCluster():
raise errors.OpPrereqError("Cluster not initialized yet,"
" use 'gnt-cluster init' first.")
if self.REQ_MASTER:
master = sstore.GetMasterNode()
if master != utils.HostInfo().name:
raise errors.OpPrereqError("Commands must be run on the master"
" node %s" % master)
if not cfg.IsCluster():
raise errors.OpPrereqError("Cluster not initialized yet,"
" use 'gnt-cluster init' first.")
if self.REQ_MASTER:
master = sstore.GetMasterNode()
if master != utils.HostInfo().name:
raise errors.OpPrereqError("Commands must be run on the master"
" node %s" % master)
def __GetSSH(self):
"""Returns the SshRunner object
......
......@@ -117,7 +117,7 @@ class Processor(object):
if lu_class is None:
raise errors.OpCodeUnknown("Unknown opcode")
if lu_class.REQ_CLUSTER and self.cfg is None:
if self.cfg is None:
self.cfg = config.ConfigWriter()
self.sstore = ssconf.SimpleStore()
if self.cfg is not None:
......@@ -162,7 +162,7 @@ class Processor(object):
if lu_class is None:
raise errors.OpCodeUnknown("Unknown opcode")
if lu_class.REQ_CLUSTER and self.cfg is None:
if self.cfg is None:
self.cfg = config.ConfigWriter()
self.sstore = ssconf.SimpleStore()
#do_hooks = lu_class.HPATH is not None
......
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