Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1851 add --ignoreFolder option to deploy --matchName #1863

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ yargs(hideBin(process.argv))
group: 'Options for deploy:',
describe:
'allows overwriting options.formatOnSave from the config file. Disable formatting via --no-format',
})
.option('ignoreFolder', {
type: 'boolean',
alias: 'if',
group: 'Options for deploy:',
describe:
'works with --matchName and allows skipping folder match if there is only 1 name match',
}),

(argv) => {
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class Mcdev {
'fixShared',
'format',
'fromRetrieve',
'ignoreFolder',
'json',
'keySuffix',
'like',
Expand Down
34 changes: 27 additions & 7 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ class DataExtension extends MetadataType {
try {
await this.validation('deploy', metadataMap[metadataKey], deployDir);
metadataMap[metadataKey] = await this.preDeployTasks(metadataMap[metadataKey]);

await this.createOrUpdate(
metadataMap,
metadataKey,
false,
metadataToUpdate,
metadataToCreate
);
} catch (ex) {
// output error & remove from deploy list
Util.logger.error(
Expand All @@ -67,13 +75,6 @@ class DataExtension extends MetadataType {
filteredByPreDeploy++;
continue;
}
await this.createOrUpdate(
metadataMap,
metadataKey,
false,
metadataToUpdate,
metadataToCreate
);
}
if (metadataToUpdate.length) {
Util.logger.info(
Expand Down Expand Up @@ -1666,6 +1667,25 @@ class DataExtension extends MetadataType {
` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and folder "${deployFolderPath}": ${cacheMatchedByName[this.definition.keyField]}`
)
);
} else if (
Util.OPTIONS.ignoreFolder &&
potentials[0][this.definition.folderIdField] !==
metadataItem[this.definition.folderIdField]
) {
cacheMatchedByName = potentials[0];

const cacheFolderPath = cache.searchForField(
'folder',
potentials[0][this.definition.folderIdField],
'ID',
'Path'
);

Util.logger.info(
Util.getGrayMsg(
` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and but folder is different (--ignoreFolder). New folder: "${deployFolderPath}". Old: "${cacheFolderPath}"`
)
);
} else {
const cacheFolderPath = cache.searchForField(
'folder',
Expand Down
10 changes: 0 additions & 10 deletions lib/metadataTypes/SenderProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ class SenderProfile extends MetadataType {
}): AutoForwardToEmailAddress and AutoForwardToName will be ignored because UseDefaultRMMRules is set to true; setting UseDefaultRMMRules to false`
);
metadata.UseDefaultRMMRules = false;
} else if (
!metadata.UseDefaultRMMRules &&
(metadata.AutoForwardToEmailAddress === '' || metadata.AutoForwardToName === '')
) {
Util.logger.warn(
` - ${this.definition.type} ${metadata[this.definition.nameField]} (${
metadata[this.definition.keyField]
}): AutoForwardToEmailAddress and AutoForwardToName are required when UseDefaultRMMRules is set to false; setting UseDefaultRMMRules to true`
);
metadata.UseDefaultRMMRules = true;
}
if (!Util.OPTIONS.matchName) {
// #4 make sure the name is unique
Expand Down
Loading