Skip to content

Commit

Permalink
Update create.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisseah committed Apr 13, 2020
1 parent 6e85403 commit c58fe7c
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions src/commands/service/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,50 +286,39 @@ export const execute = async (
opts: CommandOptions,
exitFn: (status: number) => Promise<void>
): Promise<void> => {
if (!serviceName) {
logError(
buildError(
try {
if (!serviceName) {
throw buildError(
errorStatusCode.CMD_EXE_ERR,
"service-create-cmd-service-name-missing-err"
)
);
await exitFn(1);
return;
}
);
}

if (!servicePath) {
logError(
buildError(
if (!servicePath) {
throw buildError(
errorStatusCode.CMD_EXE_ERR,
"service-create-cmd-service-path-missing-err"
)
);
await exitFn(1);
return;
}
);
}

// validate user inputs are DNS compliant
try {
dns.assertIsValid("<service-name>", serviceName);
assertValidDnsInputs(opts);
} catch (err) {
logError(
buildError(
// validate user inputs are DNS compliant
try {
dns.assertIsValid("<service-name>", serviceName);
assertValidDnsInputs(opts);
} catch (err) {
throw buildError(
errorStatusCode.CMD_EXE_ERR,
"service-create-cmd-service-name-dns-invalid-err",
err
)
);
await exitFn(1);
}
);
}

// Sanity checking the specified Helm URLs
await validateGitUrl(opts.helmConfigGit, exitFn);
// Sanity checking the specified Helm URLs
await validateGitUrl(opts.helmConfigGit, exitFn);

const projectPath = process.cwd();
logger.verbose(`project path: ${projectPath}`);
const projectPath = process.cwd();
logger.verbose(`project path: ${projectPath}`);

try {
checkDependencies(projectPath);
const values = fetchValues(opts);
await createService(projectPath, serviceName, servicePath, values);
Expand Down

0 comments on commit c58fe7c

Please sign in to comment.