mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	Fix cv_test_manager.py's Grafana call and correct spacing
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
		| @@ -27,7 +27,7 @@ class GrafanaRequest: | |||||||
|         self.debug = debug_ |         self.debug = debug_ | ||||||
|         self.die_on_error = die_on_error_ |         self.die_on_error = die_on_error_ | ||||||
|         self.headers = _headers |         self.headers = _headers | ||||||
|         self.headers['Authorization'] = 'Bearer '+_api_token |         self.headers['Authorization'] = 'Bearer ' + _api_token | ||||||
|         self.headers['Content-Type'] = 'application/json' |         self.headers['Content-Type'] = 'application/json' | ||||||
|         self.grafanajson_url = "http://%s:%s" % (_grafanajson_host, _grafanajson_port) |         self.grafanajson_url = "http://%s:%s" % (_grafanajson_host, _grafanajson_port) | ||||||
|         self.data = dict() |         self.data = dict() | ||||||
| @@ -40,7 +40,7 @@ class GrafanaRequest: | |||||||
|             pass |             pass | ||||||
|  |  | ||||||
|     def list_dashboards(self): |     def list_dashboards(self): | ||||||
|         url=self.grafanajson_url + '/api/search?folderIds=0&query=&starred=false' |         url = self.grafanajson_url + '/api/search?folderIds=0&query=&starred=false' | ||||||
|         return requests.get(url).text |         return requests.get(url).text | ||||||
|  |  | ||||||
|     def create_dashboard(self, |     def create_dashboard(self, | ||||||
| @@ -48,7 +48,8 @@ class GrafanaRequest: | |||||||
|                          ): |                          ): | ||||||
|         self.grafanajson_url = self.grafanajson_url + "/api/dashboards/db" |         self.grafanajson_url = self.grafanajson_url + "/api/dashboards/db" | ||||||
|  |  | ||||||
|         data = ('{ "dashboard": { "id": null, "title": "%s" , "tags": [ "templated" ], "timezone": "browser", "schemaVersion": 6, "version": 0 }, "overwrite": false }' % dashboard_name) |         data = ( | ||||||
|  |                     '{ "dashboard": { "id": null, "title": "%s" , "tags": [ "templated" ], "timezone": "browser", "schemaVersion": 6, "version": 0 }, "overwrite": false }' % dashboard_name) | ||||||
|         return requests.get(self.grafanajson_url, headers=self.headers, data=data, verify=False) |         return requests.get(self.grafanajson_url, headers=self.headers, data=data, verify=False) | ||||||
|  |  | ||||||
|     def delete_dashboard(self, |     def delete_dashboard(self, | ||||||
| @@ -58,3 +59,4 @@ class GrafanaRequest: | |||||||
|  |  | ||||||
|     def create_dashboard_from_data(self, |     def create_dashboard_from_data(self, | ||||||
|                                    json_file=None): |                                    json_file=None): | ||||||
|  |         pass | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ def cv_base_adjust_parser(args): | |||||||
|         # TODO:  In future, can use TestRig once that GUI update has propagated |         # TODO:  In future, can use TestRig once that GUI update has propagated | ||||||
|         args.set.append(["Test Rig ID:", args.test_rig]) |         args.set.append(["Test Rig ID:", args.test_rig]) | ||||||
|  |  | ||||||
|     if args.influx_host != "": |     if args.influx_host is not None: | ||||||
|         if (not args.pull_report): |         if (not args.pull_report): | ||||||
|             print("Specified influx host without pull_report, will enabled pull_request.") |             print("Specified influx host without pull_report, will enabled pull_request.") | ||||||
|             args.pull_report = True |             args.pull_report = True | ||||||
| @@ -358,7 +358,7 @@ class cv_test(Realm): | |||||||
|             print("Not submitting to influx, no report-dir.\n") |             print("Not submitting to influx, no report-dir.\n") | ||||||
|             return |             return | ||||||
|  |  | ||||||
|         if args.influx_host == "": |         if args.influx_host is None: | ||||||
|             # No influx configured, return. |             # No influx configured, return. | ||||||
|             print("Not submitting to influx, influx_host not configured.\n") |             print("Not submitting to influx, influx_host not configured.\n") | ||||||
|             return |             return | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham