Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// update the local helm repo and retry
log.debug("Updating Helm repo...")
await helm(namespace, context, log, ...["repo", "update"])
log.debug("Fetching chart (after updating)...")
await fetchChart(namespace, context, log, module)
}
}
const chartPath = await getChartPath(module)
// create the values.yml file (merge the configured parameters into the default values)
log.debug("Preparing chart...")
const chartValues = safeLoad(await helm(namespace, context, log, "inspect", "values", chartPath)) || {}
// Merge with the base module's values, if applicable
const specValues = baseModule ? jsonMerge(baseModule.spec.values, module.spec.values) : module.spec.values
const mergedValues = jsonMerge(chartValues, specValues)
const valuesPath = getValuesPath(chartPath)
log.silly(`Writing chart values to ${valuesPath}`)
await dumpYaml(valuesPath, mergedValues)
return { fresh: true }
}
const path = urlToArray(req.path);
const value = undefsafe(user.store, path.join('.'));
if (value === undefined) {
return res.status(404).json(null);
}
const parent = path.length ?
undefsafe(user.store, path.join('.')) :
user.store;
// merge
if (Array.isArray(parent)) {
parent.push(req.body);
} else {
const result = jsonmergepatch.apply(parent, req.body);
undefsafe(user.store, path.join('.'), result);
}
user.dirty('storeJson', { method: 'PATCH', path: path.join('.') });
user.save().then(user => {
res.status(200).json(undefsafe(user.store, path.join('.')));
}).catch(e => {
next(422);
});
});
await helm(namespace, context, log, ...["repo", "update"])
log.debug("Fetching chart (after updating)...")
await fetchChart(namespace, context, log, module)
}
}
const chartPath = await getChartPath(module)
// create the values.yml file (merge the configured parameters into the default values)
log.debug("Preparing chart...")
const chartValues = safeLoad(await helm(namespace, context, log, "inspect", "values", chartPath)) || {}
// Merge with the base module's values, if applicable
const specValues = baseModule ? jsonMerge(baseModule.spec.values, module.spec.values) : module.spec.values
const mergedValues = jsonMerge(chartValues, specValues)
const valuesPath = getValuesPath(chartPath)
log.silly(`Writing chart values to ${valuesPath}`)
await dumpYaml(valuesPath, mergedValues)
return { fresh: true }
}
{
const spec = JSON.parse(JSON.stringify(application.spec));
return services.applications.updateSpec(application.metadata.name, jsonMergePatch.apply(spec, JSON.parse(patch)));
}}/>
),
onSave={async patch => {
props.onAppChanged(jsonMergePatch.apply(app, JSON.parse(patch)));
setYamlMode(false);
return true;
}}
/>
onSave={async patch => {
props.onAppChanged(jsonMergePatch.apply(app, JSON.parse(patch)));
setYamlMode(false);
return true;
}}
/>
.then(latest => jsonMergePatch.apply(latest, patch))
.then(patched => services.cronWorkflows.update(patched, props.cronWorkflow.metadata.name, props.cronWorkflow.metadata.namespace))
public patchResource(resource: KubeResource, name: string, patch: object): object {
const apiKey = resource.listPath().substr(1);
const mockedObject = { ...this.data()[apiKey][name] };
const patchedReturn = JsonMergePatch.apply(mockedObject, patch);
this.updateMockedData(apiKey, name, patchedReturn);
return patchedReturn;
}
onSave={async patch => {
const spec = JSON.parse(JSON.stringify(application.spec));
return services.applications.updateSpec(application.metadata.name, jsonMergePatch.apply(spec, JSON.parse(patch)));
}}
/>