djloude / cloudwatch_exporter_metrics_config_builder

CI/CD pipeline that generates aws cloudwatch metrics and dimensions then builds the cloudwatch.yml file.
2 stars 6 forks source link

Avoid errors when running script #5

Closed daniduhnev1 closed 1 year ago

daniduhnev1 commented 1 year ago

The first change is to avoid the set of errors when the directory does not exist:

pipeline.sh: line 2: cloudwatch_config_builder/files/cloudwatch_metrics/auto_scaling.json: No such file or directory
pipeline.sh: line 3: cloudwatch_config_builder/files/cloudwatch_metrics/billing.json: No such file or directory
pipeline.sh: line 4: cloudwatch_config_builder/files/cloudwatch_metrics/dynamo_db.json: No such file or directory
pipeline.sh: line 5: cloudwatch_config_builder/files/cloudwatch_metrics/ebs.json: No such file or directory
pipeline.sh: line 6: cloudwatch_config_builder/files/cloudwatch_metrics/ec2.json: No such file or directory
pipeline.sh: line 7: cloudwatch_config_builder/files/cloudwatch_metrics/elasti_cache.json: No such file or directory
pipeline.sh: line 8: cloudwatch_config_builder/files/cloudwatch_metrics/events.json: No such file or directory
pipeline.sh: line 9: cloudwatch_config_builder/files/cloudwatch_metrics/lambda.json: No such file or directory
pipeline.sh: line 10: cloudwatch_config_builder/files/cloudwatch_metrics/logs.json: No such file or directory
pipeline.sh: line 11: cloudwatch_config_builder/files/cloudwatch_metrics/network_elb.json: No such file or directory
pipeline.sh: line 12: cloudwatch_config_builder/files/cloudwatch_metrics/rds.json: No such file or directory
pipeline.sh: line 13: cloudwatch_config_builder/files/cloudwatch_metrics/s3.json: No such file or directory
pipeline.sh: line 14: cloudwatch_config_builder/files/cloudwatch_metrics/transit_gateway.json: No such file or directory
pipeline.sh: line 15: cloudwatch_config_builder/files/cloudwatch_metrics/trusted_advisor.json: No such file or directory
pipeline.sh: line 16: cloudwatch_config_builder/files/cloudwatch_metrics/usage.json: No such file or directory

This has been raised already in #3

The second one is to avoid an error if sudo requires a password to run. See error:

fatal: [localhost]: FAILED! => {
...
  "module_stderr": "sudo: a password is required\n",
...
}
"msg": "The following modules failed to execute: ansible.legacy.setup\n
djloude commented 1 year ago

Approved and thank you for the contribution!