Add helper functions to VMBuilder instances

This commit is contained in:
Joshua Boniface 2023-11-16 16:17:17 -05:00
parent f50f170d4e
commit 618a1c1c10
1 changed files with 21 additions and 1 deletions

View File

@ -34,7 +34,7 @@ from contextlib import contextmanager
from pvcapid.Daemon import config from pvcapid.Daemon import config
from daemon_lib.zkhandler import ZKHandler from daemon_lib.zkhandler import ZKHandler
from daemon_lib.celery import start, fail, log_info, log_warn, update, finish from daemon_lib.celery import start, fail, log_info, log_warn, log_err, update, finish
import daemon_lib.common as pvc_common import daemon_lib.common as pvc_common
import daemon_lib.node as pvc_node import daemon_lib.node as pvc_node
@ -87,6 +87,26 @@ class VMBuilder(object):
self.vm_profile = vm_profile self.vm_profile = vm_profile
self.vm_data = vm_data self.vm_data = vm_data
#
# Helper class functions; used by the individual scripts
#
def log_info(self, msg):
log_info(None, msg)
def log_warn(self, msg):
log_warn(None, msg)
def log_err(self, msg):
log_err(None, msg)
def fail(self, msg):
self.log_err(msg)
try:
self.cleanup()
except Exception:
pass
raise ProvisioningError()
# #
# Primary class functions; implemented by the individual scripts # Primary class functions; implemented by the individual scripts
# #