← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:fix-d-a-r-bug into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix-d-a-r-bug into autopkgtest-cloud:master.

Commit message:
fix: web: fix download-all-results TypeError

When running download-all-results for noble recently, the following
traceback was encountered:
```
DEBUG:__main__:Fetched test result for noble/armhf/python-keycloak/3.9.0+dfsg-1 20240326_084914_e13af@ (triggers: python3-defaults/3.12.2-0ubuntu1): exit code 8
Traceback (most recent call last):
  File "./download-all-results", line 264, in <module>
    fetch_container(
  File "./download-all-results", line 203, in fetch_container
    fetch_one_result(
  File "./download-all-results", line 144, in fetch_one_result
    env_vars.append("=".join([env, value]))
TypeError: sequence item 1: expected str instance, int found
```

This is because of the all_proposed environment variable being
set to 1, which is then read as an integer rather than a string.

This commit amends the issue by explicitly casting the type of the value
in the env_vars to be a string.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/469110

This MP just fixes a small TypeError bug in download-all-results.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix-d-a-r-bug into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/download-all-results b/charms/focal/autopkgtest-web/webcontrol/download-all-results
index 157c052..0798695 100755
--- a/charms/focal/autopkgtest-web/webcontrol/download-all-results
+++ b/charms/focal/autopkgtest-web/webcontrol/download-all-results
@@ -139,7 +139,7 @@ def fetch_one_result(container_name, object_name, swift_conn):
     env_vars = []
     env_spec = ["all-proposed"]
     for env in env_spec:
-        value = testinfo.get(env)
+        value = str(testinfo.get(env))
         if value is not None:
             env_vars.append("=".join([env, value]))