COT.submodule
module¶
Parent classes for implementing COT subcommands.
Classes
COTGenericSubmodule |
Abstract interface for COT command submodules. |
COTReadOnlySubmodule |
Class for submodules that do not modify the OVF, such as ‘deploy’. |
COTSubmodule |
Class for submodules that read and write the OVF. |
-
class
COTGenericSubmodule
(UI)[source]¶ Bases:
object
Abstract interface for COT command submodules.
Note
Generally a command should not inherit directly from this class, but should instead subclass
COTReadOnlySubmodule
orCOTSubmodule
as appropriate.-
create_subparser
(parent, storage)[source]¶ Add subparser for the CLI of this submodule.
Parameters: - parent (object) – Subparser grouping object returned by
ArgumentParser.add_subparsers()
- storage (dict) – Dict of { ‘label’: subparser } to be updated with subparser(s) created, if any.
- parent (object) – Subparser grouping object returned by
-
finished
()[source]¶ Do any final actions before being destroyed.
This class does nothing; subclasses may choose to do things like write their VM state out to a file.
-
ready_to_run
()[source]¶ Check whether the module is ready to
run()
.Returns: (True, ready_message)
or(False, reason_why_not)
-
run
()[source]¶ Do the actual work of this submodule.
Raises: InvalidInputError
ifready_to_run()
reportsFalse
-
UI
= None¶ User interface instance (
UI
or subclass).
-
vm
= None¶ Virtual machine description (
VMDescription
).
-
-
class
COTReadOnlySubmodule
(UI)[source]¶ Bases:
COT.submodule.COTGenericSubmodule
Class for submodules that do not modify the OVF, such as ‘deploy’.
Inherited attributes:
vm
,UI
Attributes:
package
-
ready_to_run
()[source]¶ Check whether the module is ready to
run()
.Returns: (True, ready_message)
or(False, reason_why_not)
-
package
¶ VM description file to read from.
Calls
COT.vm_factory.VMFactory.create()
to instantiateself.vm
from the provided file.Raises: InvalidInputError
if the file does not exist.
-
-
class
COTSubmodule
(UI)[source]¶ Bases:
COT.submodule.COTGenericSubmodule
Class for submodules that read and write the OVF.
Inherited attributes:
vm
,UI
-
ready_to_run
()[source]¶ Check whether the module is ready to
run()
.Returns: (True, ready_message)
or(False, reason_why_not)
-
run
()[source]¶ Do the actual work of this submodule.
If
output
was not previously set, automatically sets it to the value ofPACKAGE
.Raises: InvalidInputError
ifready_to_run()
reportsFalse
-
output
¶ Output file for this submodule.
If the specified file already exists, will prompt the user (
confirm_or_die()
) to confirm overwriting the existing file.
-
package
¶ VM description file to read (and possibly write).
Calls
COT.vm_factory.VMFactory.create()
to instantiateself.vm
from the provided file.Raises: InvalidInputError
if the file does not exist.
-