Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _init_options(self, kwargs):
super(DeleteData, self)._init_options(kwargs)
# Split and trim objects string into a list if not already a list
if not isinstance(self.options["objects"], list):
self.options["objects"] = [
obj.strip() for obj in self.options["objects"].split(",")
]
self.options["hardDelete"] = process_bool_arg(self.options.get("hardDelete"))
def _init_options(self, kwargs):
super(UninstallPackagedIncremental, self)._init_options(kwargs)
if "path" not in self.options:
self.options["path"] = "src"
self.options["purge_on_delete"] = process_bool_arg(
self.options.get("purge_on_delete", True)
)
self.options["ignore"] = self.options.get("ignore") or {}
def _process_meta_xml(self, zipf):
if not process_bool_arg(self.options.get("clean_meta_xml", True)):
return zipf
self.logger.info(
"Cleaning meta.xml files of packageVersion elements for deploy"
)
zipf = zip_clean_metaxml(zipf, logger=self.logger)
return zipf
self.logger.info(
"Replacing namespace tokens from metadata with namespace prefix {}__".format(
self.options["namespace_inject"]
)
)
else:
self.logger.info(
"Stripping namespace tokens from metadata for unmanaged deployment"
)
zipf = process_text_in_zipfile(
zipf,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=managed,
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
),
logger=self.logger,
),
)
if self.options.get("namespace_strip"):
zipf = process_text_in_zipfile(
zipf,
functools.partial(
strip_namespace,
namespace=self.options["namespace_strip"],
logger=self.logger,
),
)
return zipf
def _init_options(self, kwargs):
super(BaseUninstallMetadata, self)._init_options(kwargs)
self.options['purge_on_delete'] = process_bool_arg(self.options.get(
'purge_on_delete',
True,
))
def _process_namespace(self, src_zip):
if self.options.get('namespace_tokenize'):
src_zip = zip_tokenize_namespace(src_zip, self.options['namespace_tokenize'], logger=self.logger)
if self.options.get('namespace_inject'):
kwargs = {}
kwargs['unmanaged'] = process_bool_arg(self.options.get('unmanaged', True))
kwargs['namespaced_org'] = process_bool_arg(self.options.get('namespaced_org', False))
kwargs['logger'] = self.logger
src_zip = zip_inject_namespace(src_zip, self.options['namespace_inject'], **kwargs)
if self.options.get('namespace_strip'):
src_zip = zip_strip_namespace(src_zip, self.options['namespace_strip'], logger=self.logger)
return src_zip
if self.options.get("namespace_tokenize"):
self.logger.info(
"Tokenizing namespace prefix {}__".format(
self.options["namespace_tokenize"]
)
)
zipf = process_text_in_zipfile(
zipf,
functools.partial(
tokenize_namespace,
namespace=self.options["namespace_tokenize"],
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
managed = not process_bool_arg(self.options.get("unmanaged", True))
if managed:
self.logger.info(
"Replacing namespace tokens from metadata with namespace prefix {}__".format(
self.options["namespace_inject"]
)
)
else:
self.logger.info(
"Stripping namespace tokens from metadata for unmanaged deployment"
)
zipf = process_text_in_zipfile(
zipf,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=managed,
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
tokenize_namespace,
namespace=self.options["namespace_tokenize"],
logger=self.logger,
),
)
if self.options.get("namespace_inject"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
inject_namespace,
namespace=self.options["namespace_inject"],
managed=not process_bool_arg(self.options.get("unmanaged", True)),
namespaced_org=process_bool_arg(
self.options.get("namespaced_org", False)
),
logger=self.logger,
),
)
if self.options.get("namespace_strip"):
src_zip = process_text_in_zipfile(
src_zip,
functools.partial(
strip_namespace,
namespace=self.options["namespace_strip"],
logger=self.logger,
),
)
return src_zip