Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken validation of boolean env vars #102

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.8.2] - 2024-09-11
### Fixed

- Issue [#101](https://github.com/phsmith/rundeck_exporter/issues/101), fix broken validation of boolean environment variables.

## [2.8.1] - 2024-09-01
### Fixed

Expand Down Expand Up @@ -303,7 +308,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release

[unreleased]: https://github.com/phsmith/rundeck_exporter/compare/v2.8.1...HEAD
[unreleased]: https://github.com/phsmith/rundeck_exporter/compare/v2.8.2...HEAD
[2.8.1]: https://github.com/phsmith/rundeck_exporter/compare/v2.8.1...v2.8.2
[2.8.1]: https://github.com/phsmith/rundeck_exporter/compare/v2.8.0...v2.8.1
[2.8.0]: https://github.com/phsmith/rundeck_exporter/compare/v2.7.1...v2.8.0
[2.7.1]: https://github.com/phsmith/rundeck_exporter/compare/v2.7.0...v2.7.1
Expand Down
18 changes: 9 additions & 9 deletions rundeck_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
__author__ = 'Phillipe Smith'
__author_email__ = '[email protected]'
__app__ = 'rundeck_exporter'
__version__ = '2.8.1'
__version__ = '2.8.2'

# Disable InsecureRequestWarning
requests.urllib3.disable_warnings()
Expand Down Expand Up @@ -69,7 +69,7 @@ class RundeckMetricsCollector(object):
)
args_parser.add_argument('--debug',
help='Enable debug mode',
default=getenv('RUNDECK_EXPORTER_DEBUG', False),
default=literal_eval(getenv('RUNDECK_EXPORTER_DEBUG', 'False')),
action='store_true'
)
args_parser.add_argument('-v', '--version',
Expand All @@ -91,7 +91,7 @@ class RundeckMetricsCollector(object):
dest='no_checks_in_passive_mode',
help='The rundeck_exporter will not perform any checks while the Rundeck host is in passive execution mode',
action='store_true',
default=getenv('RUNDECK_EXPORTER_NO_CHECKS_IN_PASSIVE_MODE', False)
default=literal_eval(getenv('RUNDECK_EXPORTER_NO_CHECKS_IN_PASSIVE_MODE', 'False'))
)
args_parser.add_argument('--threadpool_max_workers',
help='The maximum number of workers in the threadpool to run rundeck_exporter asynchronous checks. Defaults to (number of CPUs) + 4',
Expand All @@ -114,7 +114,7 @@ class RundeckMetricsCollector(object):
args_parser.add_argument('--rundeck.skip_ssl',
dest='rundeck_skip_ssl',
help='Rundeck Skip SSL Cert Validate',
default=literal_eval(getenv('RUNDECK_SKIP_SSL', 'False').capitalize()),
default=literal_eval(getenv('RUNDECK_SKIP_SSL', 'False')),
action='store_true'
)
args_parser.add_argument('--rundeck.api.version',
Expand All @@ -132,7 +132,7 @@ class RundeckMetricsCollector(object):
args_parser.add_argument('--rundeck.projects.executions',
dest='rundeck_projects_executions',
help='Get projects executions metrics',
default=literal_eval(getenv('RUNDECK_PROJECTS_EXECUTIONS', 'False').capitalize()),
default=literal_eval(getenv('RUNDECK_PROJECTS_EXECUTIONS', 'False')),
action='store_true'
)
args_parser.add_argument('--rundeck.projects.executions.filter',
Expand All @@ -153,7 +153,7 @@ class RundeckMetricsCollector(object):
args_parser.add_argument('--rundeck.projects.executions.cache',
dest='rundeck_projects_executions_cache',
help='Cache requests for project executions metrics query',
default=literal_eval(getenv('RUNDECK_PROJECTS_EXECUTIONS_CACHE', 'False').capitalize()),
default=literal_eval(getenv('RUNDECK_PROJECTS_EXECUTIONS_CACHE', 'False')),
action='store_true'
)
args_parser.add_argument('--rundeck.projects.filter',
Expand All @@ -167,7 +167,7 @@ class RundeckMetricsCollector(object):
dest='rundeck_projects_nodes_info',
help='Display Rundeck projects nodes info metrics, currently only the `rundeck_project_nodes_total` metric is available. May cause high CPU load depending on the number of projects',
action='store_true',
default=getenv('RUNDECK_PROJECTS_NODES_INFO', False)
default=literal_eval(getenv('RUNDECK_PROJECTS_NODES_INFO', 'False'))
)
args_parser.add_argument('--rundeck.cached.requests.ttl',
dest='rundeck_cached_requests_ttl',
Expand All @@ -179,13 +179,13 @@ class RundeckMetricsCollector(object):
dest='rundeck_cpu_stats',
help='Show Rundeck CPU usage stats',
action='store_true',
default=getenv('RUNDECK_CPU_STATS', False)
default=literal_eval(getenv('RUNDECK_CPU_STATS', 'False'))
)
args_parser.add_argument('--rundeck.memory.stats',
dest='rundeck_memory_stats',
help='Show Rundeck memory usage stats',
action='store_true',
default=getenv('RUNDECK_MEMORY_STATS', False)
default=literal_eval(getenv('RUNDECK_MEMORY_STATS', 'False'))
)

args = args_parser.parse_args()
Expand Down