Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_task(self, stepnum, step_config):
task_config = copy.deepcopy(step_config["task_config"].config)
task_config = TaskConfig(task_config)
task_name = step_config["step_config"]["task"]
if "options" not in task_config.config:
task_config.config["options"] = {}
task_config.config["options"].update(
step_config["step_config"].get("options", {})
)
# If there were task option overrides passed in, merge them
if task_name in self.task_options:
task_config.config["options"].update(self.task_options[task_name])
# Handle dynamic value lookups in the format ^^task_name.attr1.attr2
for option, value in list(task_config.options.items()):
if str(value).startswith("^^"):
value_parts = value[2:].split(".")
def task_doc(config):
config_src = config.global_config
click.echo("==========================================")
click.echo("Tasks Reference")
click.echo("==========================================")
click.echo("")
for name, options in list(config_src.tasks.items()):
task_config = TaskConfig(options)
doc = doc_task(name, task_config)
click.echo(doc)
click.echo("")
@click.command(name='info', help="Displays information for a task")
@click.argument('task_name')
@pass_config
def task_info(config, task_name):
check_project_config(config)
task_config = getattr(config.project_config, 'tasks__{}'.format(task_name))
if not task_config:
raise TaskNotFoundError('Task not found: {}'.format(task_name))
task_config = TaskConfig(task_config)
click.echo(rst2ansi(doc_task(task_name, task_config)))
def _create_version_request(self, package_id, package_config):
# Prepare the version_info file
version_bytes = io.BytesIO()
version_info = zipfile.ZipFile(version_bytes, "w", zipfile.ZIP_DEFLATED)
# Zip up the packaged metadata
package_bytes = io.BytesIO()
package_zip = zipfile.ZipFile(package_bytes, "w", zipfile.ZIP_DEFLATED)
if package_config.get("source_format") == "sfdx":
self.logger.info("Converting from sfdx to mdapi format")
with temporary_dir(chdir=False) as path:
task_config = TaskConfig(
{
"options": {
"command": "force:source:convert -d {} -r {path} -n '{name}'".format(
path, **package_config
)
}
}
)
self.logger.info("cwd: {}".format(os.getcwd()))
task = SFDXBaseTask(self.project_config, task_config)
task()
self._add_files_to_package(package_zip, path)
else:
self._add_files_to_package(package_zip, package_config["path"])
package_zip.close()
def _dataload(self, subtask_options):
subtask_config = TaskConfig({"options": subtask_options})
subtask = LoadData(
project_config=self.project_config,
task_config=subtask_config,
org_config=self.org_config,
flow=self.flow,
name=self.name,
stepnum=self.stepnum,
)
subtask()
def task_info(config, task_name):
check_project_config(config)
task_config = getattr(config.project_config, 'tasks__{}'.format(task_name))
if not task_config:
raise TaskNotFoundError('Task not found: {}'.format(task_name))
task_config = TaskConfig(task_config)
click.echo(rst2ansi(doc_task(task_name, task_config)))
return
class_path = task_config.get('class_path')
task_class = import_class(class_path)
# General task info
click.echo('Description: {}'.format(task_config.get('description')))
click.echo('Class: {}'.format(task_config.get('class_path')))
# Default options
default_options = task_config.get('options', {})
if default_options:
click.echo('')
click.echo('Default Option Values')
for key, value in default_options.items():
click.echo(' {}: {}'.format(key, value))
def _datagen(self, subtask_options):
task_config = TaskConfig({"options": subtask_options})
data_gen_task = self.data_generation_task(
self.project_config, task_config, org_config=self.org_config
)
data_gen_task()
def _run_subtask(self, taskclass, **options):
"""Helper method for running CCI tasks"""
subtask_config = TaskConfig({"options": options})
return self.cumulusci._run_task(taskclass, subtask_config)