Skip to content

Commit

Permalink
remove test code
Browse files Browse the repository at this point in the history
  • Loading branch information
hop-dev committed Aug 8, 2023
1 parent e1dde30 commit 96fbdb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export const config: PluginConfigDescriptor = {
disableRegistryVersionCheck: schema.boolean({ defaultValue: false }),
allowAgentUpgradeSourceUri: schema.boolean({ defaultValue: false }),
bundledPackageLocation: schema.string({ defaultValue: DEFAULT_BUNDLED_PACKAGE_LOCATION }),
testSecretsIndex: schema.maybe(schema.string()),
}),
packageVerification: schema.object({
gpgKeyPath: schema.string({ defaultValue: DEFAULT_GPG_KEY_PATH }),
Expand Down
17 changes: 4 additions & 13 deletions x-pack/plugins/fleet/server/services/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ interface SecretPath {
value: PackagePolicyConfigRecordEntry;
}

// This will be removed once the secrets index PR is merged into elasticsearch
function getSecretsIndex() {
const testIndex = appContextService.getConfig()?.developer?.testSecretsIndex;
if (testIndex) {
return testIndex;
}
return SECRETS_INDEX;
}

export async function createSecrets(opts: {
esClient: ElasticsearchClient;
values: string[];
Expand All @@ -66,7 +57,7 @@ export async function createSecrets(opts: {
const logger = appContextService.getLogger();
const body = values.flatMap((value) => [
{
create: { _index: getSecretsIndex() },
create: { _index: SECRETS_INDEX },
},
{ value },
]);
Expand Down Expand Up @@ -99,7 +90,7 @@ export async function createSecrets(opts: {
value: values[i],
}));
} catch (e) {
const msg = `Error creating secrets in ${getSecretsIndex()} index: ${e}`;
const msg = `Error creating secrets in ${SECRETS_INDEX} index: ${e}`;
logger.error(msg);
throw new FleetError(msg);
}
Expand Down Expand Up @@ -192,7 +183,7 @@ export async function _deleteSecrets(opts: {
const logger = appContextService.getLogger();
const body = ids.flatMap((id) => [
{
delete: { _index: getSecretsIndex(), _id: id },
delete: { _index: SECRETS_INDEX, _id: id },
},
]);

Expand Down Expand Up @@ -221,7 +212,7 @@ export async function _deleteSecrets(opts: {
throw new Error(JSON.stringify(errorItems));
}
} catch (e) {
const msg = `Error deleting secrets from ${getSecretsIndex()} index: ${e}`;
const msg = `Error deleting secrets from ${SECRETS_INDEX} index: ${e}`;
logger.error(msg);
throw new FleetError(msg);
}
Expand Down

0 comments on commit 96fbdb2

Please sign in to comment.