← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/lpbuildbot-worker:lxd-snap into lpbuildbot-worker:main

 

Colin Watson has proposed merging ~cjwatson/lpbuildbot-worker:lxd-snap into lpbuildbot-worker:main.

Commit message:
Work around xenial's pylxd not understanding the lxd snap

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lpbuildbot-worker/+git/lpbuildbot-worker/+merge/390683
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lpbuildbot-worker:lxd-snap into lpbuildbot-worker:main.
diff --git a/create-lp-tests-lxd b/create-lp-tests-lxd
index 7100a79..8564bcb 100755
--- a/create-lp-tests-lxd
+++ b/create-lp-tests-lxd
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import os
 from os.path import expanduser
 from pathlib import Path
 from pwd import getpwnam
@@ -248,6 +249,9 @@ if __name__ == "__main__":
     if not Path(code_directory).exists():
         parser.error("Directory mount does not exist.")
 
+    # Work around xenial's pylxd not understanding the lxd snap.
+    os.environ.setdefault("LXD_DIR", "/var/snap/lxd/common/lxd")
+
     client = Client()
 
     delete_old_image(client, image_name)
diff --git a/lp-setup-lxd-build b/lp-setup-lxd-build
index 37ca836..8d48d17 100755
--- a/lp-setup-lxd-build
+++ b/lp-setup-lxd-build
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import os
 from os.path import expanduser
 import pathlib
 import shlex
@@ -114,6 +115,9 @@ if __name__ == "__main__":
     )
     args = parser.parse_args()
 
+    # Work around xenial's pylxd not understanding the lxd snap.
+    os.environ.setdefault("LXD_DIR", "/var/snap/lxd/common/lxd")
+
     client = Client()
 
     container = start_new_container(client, args.name, args.work_dir)
diff --git a/lp-setup-lxd-cleanup b/lp-setup-lxd-cleanup
index b5d722f..660a29e 100755
--- a/lp-setup-lxd-cleanup
+++ b/lp-setup-lxd-cleanup
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import os
 
 from pylxd import Client
 from pylxd.exceptions import LXDAPIException
@@ -30,6 +31,9 @@ if __name__ == "__main__":
     parser.add_argument("name", type=str, help="Base name of containers to clean up")
     args = parser.parse_args()
 
+    # Work around xenial's pylxd not understanding the lxd snap.
+    os.environ.setdefault("LXD_DIR", "/var/snap/lxd/common/lxd")
+
     client = Client()
 
     clean_up_containers(client, args.name)
diff --git a/lp-setup-lxd-test b/lp-setup-lxd-test
index 7c29311..f7e8603 100755
--- a/lp-setup-lxd-test
+++ b/lp-setup-lxd-test
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 
 import argparse
+import os
 from os.path import expanduser
 import random
 import shlex
@@ -129,6 +130,9 @@ if __name__ == "__main__":
     parser.add_argument("--load-list", type=str, help="Run tests from file")
     args = parser.parse_args()
 
+    # Work around xenial's pylxd not understanding the lxd snap.
+    os.environ.setdefault("LXD_DIR", "/var/snap/lxd/common/lxd")
+
     client = Client()
 
     if not (args.list or args.load_list):