Skip to content
Snippets Groups Projects
Commit 01392dae authored by Gomez Goiri, Aitor's avatar Gomez Goiri, Aitor
Browse files

Fixing await related issues in user generation script

parent 20c00c3c
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ const modifyUser = async (
return modUser
}
const createOrModifyUserIfNeeded = (
const createOrModifyUserIfNeeded = async (
apiClient,
username,
password,
......@@ -42,7 +42,7 @@ const createOrModifyUserIfNeeded = (
) => {
try {
// Await is needed here to force the catch clausule if something goes wrong
return apiClient.createUser(
return await apiClient.createUser(
username,
password,
organization,
......@@ -62,7 +62,8 @@ const createUsers = async () => {
process.env.TRACEBLOCK_CHAINCODE
)
Object.entries(usersByOrg).forEach(async ([org, values]) => {
for (let el of Object.entries(usersByOrg)) {
const [org, values] = el
const admin = values.find(v => v.role === "admin")
await apiClient.signIn(admin.user, readPassword(admin.user, org), org)
......@@ -81,7 +82,7 @@ const createUsers = async () => {
)
await Promise.all(prom)
})
}
console.log("Users created")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment