Merge pull request #17349 from tdabasinskas/puppetdb_backend_imprv
Fix import paths and examples in catalog-backend-module-puppetdb
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-puppetdb': patch
|
||||
---
|
||||
|
||||
Fixes import paths and updates documentation
|
||||
@@ -5,7 +5,7 @@ authorUrl: https://github.com/tdabasinskas
|
||||
category: Configuration Management
|
||||
description: Import nodes from PuppetDB into Backstage as Resource Entities
|
||||
documentation: https://github.com/backstage/backstage/blob/master/plugins/catalog-backend-module-puppetdb/README.md
|
||||
iconUrl: https://avatars.githubusercontent.com/u/234268?s=200&v=4
|
||||
iconUrl: /img/puppet.png
|
||||
npmPackageName: '@backstage/plugin-catalog-backend-module-puppetdb'
|
||||
tags:
|
||||
- puppet
|
||||
|
||||
@@ -31,9 +31,9 @@ Update the catalog plugin initialization in your backend to add the provider and
|
||||
+ schedule: env.scheduler.createScheduledTaskRunner({
|
||||
+ frequency: { minutes: 10 },
|
||||
+ timeout: { minutes: 50 },
|
||||
+ initialDelay: { seconds: 15}
|
||||
+ initialDelay: { seconds: 15 }
|
||||
+ }),
|
||||
+ });
|
||||
+ })
|
||||
+ );
|
||||
```
|
||||
|
||||
@@ -67,7 +67,7 @@ of overriding the default transformer.
|
||||
export const customResourceTransformer: ResourceTransformer = async (
|
||||
node,
|
||||
config,
|
||||
): Promise<GroupEntity | undefined> => {
|
||||
): Promise<ResourceEntity | undefined> => {
|
||||
// Transformations may change namespace, owner, change entity naming pattern, add labels, annotations, etc.
|
||||
|
||||
// Create the Resource Entity on your own, or wrap the default transformer
|
||||
@@ -77,14 +77,16 @@ export const customResourceTransformer: ResourceTransformer = async (
|
||||
|
||||
2. Configure the provider with the transformer:
|
||||
|
||||
```ts
|
||||
const puppetDbEntityProvider = PuppetDbEntityProvider.fromConfig(env.config, {
|
||||
logger: env.logger,
|
||||
schedule: env.scheduler.createScheduledTaskRunner({
|
||||
frequency: { minutes: 10 },
|
||||
timeout: { minutes: 50 },
|
||||
initialDelay: { seconds: 15 },
|
||||
}),
|
||||
transformer: customResourceTransformer,
|
||||
});
|
||||
```diff
|
||||
builder.addEntityProvider(
|
||||
PuppetDbEntityProvider.fromConfig(env.config, {
|
||||
logger: env.logger,
|
||||
+ transformer: customResourceTransformer,
|
||||
schedule: env.scheduler.createScheduledTaskRunner({
|
||||
frequency: { minutes: 10 },
|
||||
timeout: { minutes: 50 },
|
||||
initialDelay: { seconds: 15 }
|
||||
}),
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
ResourceEntity,
|
||||
} from '@backstage/catalog-model/';
|
||||
} from '@backstage/catalog-model';
|
||||
import { DEFAULT_ENTITY_OWNER, ENDPOINT_NODES } from '../puppet/constants';
|
||||
|
||||
jest.mock('../puppet/read', () => {
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
Entity,
|
||||
} from '@backstage/catalog-model/';
|
||||
} from '@backstage/catalog-model';
|
||||
import { merge } from 'lodash';
|
||||
import { readPuppetNodes } from '../puppet/read';
|
||||
import { ENDPOINT_NODES } from '../puppet/constants';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { PuppetDbEntityProviderConfig } from '../providers';
|
||||
import { PuppetNode, ResourceTransformer } from './types';
|
||||
import { ResourceEntity } from '@backstage/catalog-model/';
|
||||
import { ResourceEntity } from '@backstage/catalog-model';
|
||||
import { defaultResourceTransformer } from './transformers';
|
||||
import fetch from 'node-fetch';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
|
||||
Reference in New Issue
Block a user