Skip to content

Commit f9efdbb

Browse files
author
kkuzmin
authored
Call azcollect register to check input collector id (#37)
* Call azcollect register to check input collector id * Fix publish makefile target * Bump package version
1 parent e7730f2 commit f9efdbb

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test: compile
1414
npm run test
1515

1616
publish:
17-
npm run publish
17+
npm run rel
1818

1919
clean:
2020
rm -rf node_modules

al_aws_collector.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class AlAwsCollector {
131131
region : this._region,
132132
functionName : this._name,
133133
version : this._version,
134-
dataType : this._ingestType
134+
dataType : this._ingestType,
135+
collectorId : this._collectorId
135136
};
136137
}
137138

@@ -198,18 +199,14 @@ class AlAwsCollector {
198199
}
199200
},
200201
(asyncCallback) => {
201-
if (!process.env.collector_id || process.env.collector_id === 'none') {
202-
this._azcollectc.register(regValues)
203-
.then(resp => {
204-
const newCollectorId = resp.collector ? resp.collector.id : 'none';
205-
return m_alAws.setEnv({ collector_id: newCollectorId }, asyncCallback);
206-
})
207-
.catch(exception => {
208-
return asyncCallback('AWSC0003 registration error: ' + exception);
209-
});
210-
} else {
211-
return asyncCallback(null);
212-
}
202+
this._azcollectc.register(regValues)
203+
.then(resp => {
204+
const newCollectorId = resp.collector ? resp.collector.id : 'none';
205+
return m_alAws.setEnv({ collector_id: newCollectorId }, asyncCallback);
206+
})
207+
.catch(exception => {
208+
return asyncCallback('AWSC0003 registration error: ' + exception);
209+
});
213210
}
214211
],
215212
(err)=> {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alertlogic/al-aws-collector-js",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"license": "MIT",
55
"description": "Alert Logic AWS Collector Common Library",
66
"repository": {
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"lint": "jshint --exclude \"./node_modules/*\" **/*.js",
1313
"test": "JUNIT_REPORT_PATH=./test/report.xml nyc --reporter=cobertura mocha --colors --reporter mocha-jenkins-reporter",
14-
"publish": "npm publish --access=public"
14+
"rel": "npm publish --access=public"
1515
},
1616
"main": "index.js",
1717
"maintainers": [

test/collector_mock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ process.env.aws_lambda_s3_bucket = S3_BUCKET;
1515
process.env.stack_name = STACK_NAME;
1616
process.env.aws_lambda_zipfile_name = S3_ZIPFILE;
1717
process.env.aws_lambda_update_config_name = S3_CONFIGURATION_FILE_NAME;
18+
process.env.collector_id = 'collector-id';
1819

1920

2021
const AIMS_TEST_CREDS = {

0 commit comments

Comments
 (0)