Some python versions require '==' instead of 'is' operator, otherwise we get
TypeError: Field 'http_headers' has type 'typing.List[osc.conf.HttpHeader]'. Cannot assign a value with type 'str'.
Fix these by adding a default empty assignment:
osc/commandline.py:3382:62: E0606: Possibly using variable 'filter_pattern' before assignment (possibly-used-before-assignment)
osc/commandline.py:6692:18: E0606: Possibly using variable 'msg' before assignment (possibly-used-before-assignment)
osc/core.py:2051:23: E0606: Possibly using variable 'file_changed' before assignment (possibly-used-before-assignment)
These could probably be fixed by making the code easier to follow. By
silencing them for now and making the CI pass, it is easier to not
regress.
osc/commandline.py:3269:55: E0601: Using variable 'incident' before assignment (used-before-assignment)
osc/commandline.py:3276:55: E0601: Using variable 'priority' before assignment (used-before-assignment)
This is pylint not understanding that the try is for catching this case
and only importing when available:
osc/conf.py:77:4: E0401: Unable to import 'keyring' (import-error)
Options for apiurls can be set via OSC_HOST_<ALIAS>_<OPTION>=...
This requires a configured alias in the config file.
Setting the default apiurl via OSC_APIURL=... was working already.
Also OSC_CONFIG= / --config= was already implemented to skip loading configuration entirely.
Options for the default apiurl can be now set via:
OSC_USERNAME=...
OSC_CREDENTIALS_MGR_CLASS=...
OSC_PASSWORD=...
This, for example, makes running osc in containers with
credentials stored in environmental variables possible:
OSC_CONFIG= OSC_APIURL=<url> OSC_USERNAME=<user> OSC_PASSWORD=<password> osc ...
Plugins seem to be using oscrc and osc.conf.config to store their config options.
All fields that are not known to osc are now stored in the 'extra_fields' dictionary
and handled in __getitem__() and __setitem__() as they were regular fields.
Such values are not checked for their types and the dictionary simply holds
strings obtained from oscrc or anything the plugins set through the python API.
To avoid filesystem permission collisions with the builds using su_wrapper,
use an alternative buildroot path that appends username to '/var/tmp/build-root' for the rootless builds.
The current conf.get_config() function already handles loading from ENV.
Also, always use osc.build.calculate_build_root() instead of making a custom variable substitution.