from .handler import ExpectedHandlerError, CrTplHandler
-__version__ = '0.3.4'
+__version__ = '0.4.1'
LOG = logging.getLogger(__name__)
self.config.password = getpass.getpass(prompt=prompt)
self.handler.config = self.config
+ if self.args.rotate:
+ self.handler.rotate_only = True
self.handler.initialized = True
self.initialized = True
vmware_group.add_argument(
'-F', '--folder', dest='folder',
help="Folder in vSphere, where to create the template (Default: {!r}).".format(
- CrTplConfiguration.default_template_vm)
+ CrTplConfiguration.default_folder)
)
vmware_group.add_argument(
"(Default: {!r}).").format(CrTplConfiguration.default_template_name)
)
+ vmware_group.add_argument(
+ '-N', '--number', '--number-templates', dest='number',
+ type=int, metavar='INT',
+ help=(
+ "Maximum number of templates to stay in templates folder ("
+ "1 <= x < 100, Default: {}).".format(
+ CrTplConfiguration.default_max_nr_templates_stay))
+ )
+
+ vmware_group.add_argument(
+ '-R', '--rotate', '--rotate-only', dest="rotate", action='store_true',
+ help="Execute rortation of existing templates only, don't create a new one."
+ )
+
+
# -------------------------------------------------------------------------
def _perform_arg_parser(self):
"""
if self.args.template:
self.config.template_name = self.args.template
+ if self.args.number is not None:
+ v = self.args.number
+ if v < 1:
+ LOG.error((
+ "Wrong number {} of templates to stay in templates folder, "
+ "must be greater than zero.").format(v))
+ elif v >= 100:
+ LOG.error((
+ "Wrong number {} of templates to stay in templates folder, "
+ "must be less than 100.").format(v))
+ else:
+ self.config.max_nr_templates_stay = v
+
# -------------------------------------------------------------------------
def _init_env(self):
"""