Revision c6d58a2b lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
54 | 54 |
- implement Exec |
55 | 55 |
- implement BuildHooksEnv |
56 | 56 |
- redefine HPATH and HTYPE |
57 |
- optionally redefine their run requirements (REQ_CLUSTER,
|
|
58 |
REQ_MASTER); note that all commands require root permissions
|
|
57 |
- optionally redefine their run requirements (REQ_MASTER); note that all
|
|
58 |
commands require root permissions |
|
59 | 59 |
|
60 | 60 |
""" |
61 | 61 |
HPATH = None |
62 | 62 |
HTYPE = None |
63 | 63 |
_OP_REQP = [] |
64 |
REQ_CLUSTER = True |
|
65 | 64 |
REQ_MASTER = True |
66 | 65 |
|
67 | 66 |
def __init__(self, processor, op, cfg, sstore): |
... | ... | |
82 | 81 |
if attr_val is None: |
83 | 82 |
raise errors.OpPrereqError("Required parameter '%s' missing" % |
84 | 83 |
attr_name) |
85 |
if self.REQ_CLUSTER: |
|
86 |
if not cfg.IsCluster():
|
|
87 |
raise errors.OpPrereqError("Cluster not initialized yet,"
|
|
88 |
" use 'gnt-cluster init' first.")
|
|
89 |
if self.REQ_MASTER:
|
|
90 |
master = sstore.GetMasterNode()
|
|
91 |
if master != utils.HostInfo().name:
|
|
92 |
raise errors.OpPrereqError("Commands must be run on the master"
|
|
93 |
" node %s" % master)
|
|
84 |
|
|
85 |
if not cfg.IsCluster(): |
|
86 |
raise errors.OpPrereqError("Cluster not initialized yet," |
|
87 |
" use 'gnt-cluster init' first.") |
|
88 |
if self.REQ_MASTER: |
|
89 |
master = sstore.GetMasterNode() |
|
90 |
if master != utils.HostInfo().name: |
|
91 |
raise errors.OpPrereqError("Commands must be run on the master" |
|
92 |
" node %s" % master) |
|
94 | 93 |
|
95 | 94 |
def __GetSSH(self): |
96 | 95 |
"""Returns the SshRunner object |
Also available in: Unified diff