Revision 989ba0c4
b/lib/cmdlib.py | ||
---|---|---|
685 | 685 |
(instance.name, reason), errors.ECODE_STATE) |
686 | 686 |
|
687 | 687 |
|
688 |
def _CheckExportMode(mode): |
|
689 |
"""Ensures that a given export mode is valid. |
|
690 |
|
|
691 |
@param mode: the export mode to check |
|
692 |
@raise errors.OpPrereqError: when the export mode is not valid |
|
693 |
|
|
694 |
""" |
|
695 |
if mode not in constants.EXPORT_MODES: |
|
696 |
raise errors.OpPrereqError("Invalid export mode %r" % mode, |
|
697 |
errors.ECODE_INVAL) |
|
698 |
|
|
699 |
|
|
688 | 700 |
def _ExpandItemName(fn, name, kind): |
689 | 701 |
"""Expand an item name. |
690 | 702 |
|
... | ... | |
9160 | 9172 |
"""Check the arguments. |
9161 | 9173 |
|
9162 | 9174 |
""" |
9163 |
if self.op.mode not in constants.EXPORT_MODES: |
|
9164 |
raise errors.OpPrereqError("Invalid export mode %r" % self.op.mode, |
|
9165 |
errors.ECODE_INVAL) |
|
9175 |
_CheckExportMode(self.op.mode) |
|
9166 | 9176 |
|
9167 | 9177 |
def ExpandNames(self): |
9168 | 9178 |
self._ExpandAndLockInstance() |
... | ... | |
9237 | 9247 |
raise errors.OpPrereqError("Can not remove instance without shutting it" |
9238 | 9248 |
" down before") |
9239 | 9249 |
|
9240 |
if self.op.mode not in constants.EXPORT_MODES: |
|
9241 |
raise errors.OpPrereqError("Invalid export mode %r" % self.op.mode, |
|
9242 |
errors.ECODE_INVAL) |
|
9250 |
_CheckExportMode(self.op.mode) |
|
9243 | 9251 |
|
9244 | 9252 |
if self.op.mode == constants.EXPORT_MODE_REMOTE: |
9245 | 9253 |
if not self.x509_key_name: |
Also available in: Unified diff