addUnits no longer attempts to send [None] for `placement`.
authorPete Vander Giessen <petevg@gmail.com>
Wed, 30 Nov 2016 13:11:24 +0000 (08:11 -0500)
committerPete Vander Giessen <petevg@gmail.com>
Wed, 30 Nov 2016 13:55:01 +0000 (08:55 -0500)
This happens when we attempt to parse_placement on a null or blank
directive, and it leads to a null pointer error in the API. Instead, we
pass a simple None for `placement` if we don't have a placement
directive.

juju/application.py

index 83c2275..74f9057 100644 (file)
@@ -88,7 +88,7 @@ class Application(model.ModelEntity):
 
         result = await app_facade.AddUnits(
             application=self.name,
-            placement=[parse_placement(to)],
+            placement=[parse_placement(to)] if to else None,
             num_units=count,
         )