Skip to content

Commit

Permalink
fix: issue #59, unable to pass the RUNDECK_PROJECTS_FILTER
Browse files Browse the repository at this point in the history
  • Loading branch information
phsmith committed Sep 29, 2022
1 parent 0077676 commit b7884d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Optionally, it's possible to pass the following environment variables to the run
| RUNDECK_API_VERSION | Default: 31 | Rundeck API version. |
| RUNDECK_SKIP_SSL | <ul><li>True</li><li>False (default)</li></ul> | Skip SSL certificate check. |
| RUNDECK_PROJECTS_EXECUTIONS | <ul><li>True</li><li>False (default)</li></ul> | Get projects executions metrics. |
| RUNDECK_PROJECTS_FILTER | [] | Get executions only from listed projects. |
| RUNDECK_PROJECTS_FILTER | | Get executions only from listed projects e.g. "project-1 project-2 ..." |
| RUNDECK_PROJECTS_EXECUTIONS_LIMIT | Default: 20 | Projects executions max results per query |
| RUNDECK_PROJECTS_EXECUTIONS_CACHE | <ul><li>True</li><li>False (default)</li></ul> | Cache requests for project executions metrics query. |
| RUNDECK_CACHED_REQUESTS_TTL | Default: 120 | Rundeck cached requests expiration time. |
Expand Down
9 changes: 7 additions & 2 deletions rundeck_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,16 @@ def collect(self):
"""
Rundeck projects executions info
"""
rundeck_projects_filter = self.args.rundeck_projects_filter

if self.args.rundeck_projects_executions:
endpoint = '/projects'

if self.args.rundeck_projects_filter:
projects = [{"name": x} for x in self.args.rundeck_projects_filter]
if rundeck_projects_filter:
if isinstance(rundeck_projects_filter, str):
rundeck_projects_filter = rundeck_projects_filter.split()

projects = [{"name": x} for x in rundeck_projects_filter]
else:
if self.args.rundeck_projects_executions_cache:
projects = self.cached_request_data_from(endpoint)
Expand Down

0 comments on commit b7884d3

Please sign in to comment.