Skip to content

Commit

Permalink
#139: fix bugs during execution of document accountUser
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Feb 24, 2023
1 parent a4589bc commit e945676
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions lib/metadataTypes/AccountUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,33 @@ class AccountUser extends MetadataType {
);
return;
}
if (Object.keys(metadata).length === 1) {

// if ran as part of retrieve/deploy with key, exit here
if (metadata && Object.keys(metadata).length === 1) {
Util.logger.debug(
'Only 1 user found. Skipping documentation, assuming we ran retrieve-by-key.'
);
return;
}

if (!metadata) {
// load users from disk if document was called directly and not part of a retrieve
try {
metadata = this.readBUMetadataForType(
File.normalizePath([
this.properties.directories.retrieve,
this.buObject.credential,
Util.parentBuName,
]),
true
).accountUser;
} catch (ex) {
Util.logger.error(ex.message);
return;
}
}

// print summary to cli
const counter = {
userActive: 0,
userInactive: 0,
Expand All @@ -620,22 +641,6 @@ class AccountUser extends MetadataType {
)
);

if (!metadata) {
// load users from disk if document was called directly and not part of a retrieve
try {
metadata = this.readBUMetadataForType(
File.normalizePath([
this.properties.directories.retrieve,
this.buObject.credential,
Util.parentBuName,
]),
true
).accountUser;
} catch (ex) {
Util.logger.error(ex.message);
return;
}
}
// init map of BU Ids > BU Name
this._getBuNames();

Expand Down

0 comments on commit e945676

Please sign in to comment.