okorach / sonar-tools

Additional command line based tools to help in SonarQube administration tasks
GNU Lesser General Public License v3.0
47 stars 18 forks source link

sonar-housekeeper stacktrace when running with token of insufficient permissions #1492

Closed okorach closed 1 week ago

okorach commented 1 week ago
2024-11-06 13:01:56,776 | sonar-housekeeper | INFO    | MainThread      | Set logging level to INFO
2024-11-06 13:01:56,776 | sonar-housekeeper | INFO    | MainThread      | sonar-tools version 3.7
2024-11-06 13:01:56,776 | sonar-housekeeper | INFO    | MainThread      | Connecting to http://localhost:10000
2024-11-06 13:01:56,792 | sonar-housekeeper | INFO    | MainThread      | Loading config file /Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/audit/sonar-audit.properties
2024-11-06 13:01:56,794 | sonar-housekeeper | INFO    | MainThread      | Loading config file /Users/olivier.korach/.sonar-audit.properties
2024-11-06 13:01:56,796 | sonar-housekeeper | INFO    | MainThread      | --- Auditing projects ---
2024-11-06 13:01:56,796 | sonar-housekeeper | INFO    | MainThread      | Listing projects
2024-11-06 13:01:56,811 | sonar-housekeeper | ERROR   | MainThread      | URL http://localhost:10000/api/projects/search?qualifiers=TRK&ps=500&p=1: HTTP error 403 - Insufficient permissions to perform operation: Insufficient privileges ( request)
Traceback (most recent call last):
  File "/Users/olivier.korach/venv/oko/bin/sonar-housekeeper", line 8, in <module>
    sys.exit(main())
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/cli/housekeeper.py", line 222, in main
    problems = get_project_problems(proj_age, branch_age, pr_age, kwargs[options.NBR_THREADS], sq)
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/cli/housekeeper.py", line 64, in get_project_problems
    problems = projects.audit(endpoint=endpoint, audit_settings=settings)
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/projects.py", line 1488, in audit
    plist = get_list(endpoint, kwargs.get("key_list", None))
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/projects.py", line 1418, in get_list
    return dict(sorted(search(endpoint=endpoint).items()))
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/projects.py", line 1404, in search
    return sqobject.search_objects(endpoint=endpoint, object_class=Project, params=new_params)
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/sqobject.py", line 178, in search_objects
    data = json.loads(endpoint.get(api, params=new_params).text)
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/platform.py", line 184, in get
    return self.__run_request(requests.get, api, params, **kwargs)
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/platform.py", line 252, in __run_request
    raise e
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/sonar/platform.py", line 248, in __run_request
    r.raise_for_status()
  File "/Users/olivier.korach/venv/oko/lib/python3.9/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error:  for url: http://localhost:10000/api/projects/search?qualifiers=TRK&ps=500&p=1