# Buggy code
def _set_parameters_for_default_template(
    cluster_location,
    cluster_name,
    admin_password,
    certificate_thumbprint,
    vault_id,
    certificate_id,
    reliability_level,
    admin_name,
    cluster_size,
    durability_level,
    vm_sku,
    os_type,
    linux,
):
    parameter_file, _ = _get_template_file_and_parameters_file(linux)
    parameters = get_file_json(parameter_file)["parameters"]
    if parameters is None:
        raise CLIError("Invalid parameters file")
    parameters["clusterLocation"]["value"] = cluster_location
    parameters["clusterName"]["value"] = cluster_name
    parameters["adminUserName"]["value"] = admin_name
    parameters["adminPassword"]["value"] = admin_password
    parameters["certificateThumbprint"]["value"] = certificate_thumbprint
    parameters["sourceVaultvalue"]["value"] = vault_id
    parameters["certificateUrlvalue"]["value"] = certificate_id
    parameters["reliabilityLevel"]["value"] = reliability_level
    parameters["nt0InstanceCount"]["value"] = int(cluster_size)
    parameters["durabilityLevel"]["value"] = durability_level
    parameters["vmSku"]["value"] = vm_sku
    parameters["vmImageSku"]["value"] = os_type
    return parameters


# Traceback (UnboundLocalError)
local variable 'output_file' referenced before assignment
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 197, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 336, in execute
six.reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 310, in execute
result = cmd(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__
return super(AzCliCommand, self).__call__(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 109, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 420, in default_command_handler
result = op(**command_args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 254, in new_cluster
parameter_file)
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 1834, in _set_parameters_for_customize_template
return parameters, output_file
UnboundLocalError: local variable 'output_file' referenced before assignment

# Fixed code
def _set_parameters_for_default_template(
    cluster_location,
    cluster_name,
    admin_password,
    certificate_thumbprint,
    vault_id,
    certificate_id,
    reliability_level,
    admin_name,
    cluster_size,
    durability_level,
    vm_sku,
    os_type,
    linux,
):
    parameter_file, _ = _get_template_file_and_parameters_file(linux)
    parameters = get_file_json(parameter_file)["parameters"]
    if parameters is None:
        raise CLIError("Invalid parameters file")
    parameters["clusterLocation"]["value"] = cluster_location
    parameters["clusterName"]["value"] = cluster_name
    parameters["adminUserName"]["value"] = admin_name
    parameters["adminPassword"]["value"] = admin_password
    parameters["certificateThumbprint"]["value"] = certificate_thumbprint
    parameters["sourceVaultvalue"]["value"] = vault_id
    parameters["certificateUrlvalue"]["value"] = certificate_id
    parameters["reliabilityLevel"]["value"] = reliability_level
    parameters["nt0InstanceCount"]["value"] = int(cluster_size)
    parameters["durabilityLevel"]["value"] = durability_level
    parameters["vmSku"]["value"] = vm_sku
    parameters["vmImageSku"]["value"] = os_type
    if "Datacenter-Core-1709" in os_type:
        parameters["vmImageOffer"]["value"] = "WindowsServerSemiAnnual"
    return parameters