Skip to content

Commit

Permalink
fixes rockcarver/frodo-cli#430 - Issue with Importing Configurations …
Browse files Browse the repository at this point in the history
…with Dependencies or Two-Step Process in frodo
  • Loading branch information
vscheuber committed Aug 5, 2024
1 parent 927a6a6 commit f176896
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- rockcarver/frodo-cli#430: Frodo now properly supports exporting and importing of the email service with secondary configurations.

## [2.0.1-1] - 2024-07-26

## [2.0.1-0] - 2024-07-25
Expand Down
27 changes: 26 additions & 1 deletion src/ops/ServiceOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
updateProgressIndicator,
} from '../utils/Console';
import { getMetadata } from '../utils/ExportImportUtils';
import { cloneDeep } from '../utils/JsonUtils';
import { FrodoError } from './FrodoError';
import { type ExportMetaData } from './OpsTypes';

Expand Down Expand Up @@ -360,6 +361,7 @@ export async function putFullService({
message: `ServiceOps.putFullService: start, serviceId=${serviceId}, globalConfig=${globalConfig}`,
state,
});
const fullServiceDataCopy = cloneDeep(fullServiceData);
const nextDescendents = fullServiceData.nextDescendents;

delete fullServiceData.nextDescendents;
Expand Down Expand Up @@ -388,8 +390,14 @@ export async function putFullService({
// delete location field before adding or updating the service
delete fullServiceData.location;

// special-case email service, which may contain circular dependency
if (serviceId === 'email' && fullServiceData.transportType) {
// delete transport type so we can set it later from fullServiceDataCopy
delete fullServiceData.transportType;
}

// create service first
const result = await putService({
let result = await putService({
serviceId,
serviceData: fullServiceData,
globalConfig,
Expand Down Expand Up @@ -433,7 +441,24 @@ export async function putFullService({
return result;
})
);

// special-case email service, which may contain circular dependency
if (serviceId === 'email' && fullServiceDataCopy.transportType) {
// delete transport type so we can set it later from fullServiceDataCopy
fullServiceData.transportType = fullServiceDataCopy.transportType;

// create service first
result = await putService({
serviceId,
serviceData: fullServiceData,
globalConfig,
state,
});
}

// finally add nextDescendentResult
result.nextDescendents = nextDescendentResult;

debugMessage({
message: `ServiceOps.putFullService: end (w/ descendents)`,
state,
Expand Down

0 comments on commit f176896

Please sign in to comment.