Repository: juju/python-libjuju

Issue:
Bundle deploy doesn't honor charm channels
The bundle handler's `AddCharmChange` implementation is [ignoring the channel](https://github.com/juju/python-libjuju/blob/d6fae9e/juju/bundle.py#L439) even though it [does have the channel available](https://github.com/juju/python-libjuju/blob/d6fae9e/juju/bundle.py#L447-L448).  E.g., a deploy logged this:

```
INFO     juju.bundle:bundle.py:166 Applying change: upload charm cs:~containers/kubernetes-worker for series focal from channel edge
```

But in fact deployed the charm rev from stable.

Discussion:

Patch:
diff --git a/juju/bundle.py b/juju/bundle.py
index ac9c0d1..611285a 100644
--- a/juju/bundle.py
+++ b/juju/bundle.py
@@ -434,9 +434,9 @@ class AddCharmChange(ChangeInfo):
         if self.charm.startswith('local:'):
             return self.charm
 
-        entity_id = await context.charmstore.entityId(self.charm)
+        entity_id = await context.charmstore.entityId(self.charm, channel=self.channel)
         log.debug('Adding %s', entity_id)
-        await context.client_facade.AddCharm(channel=None, url=entity_id, force=False)
+        await context.client_facade.AddCharm(channel=self.channel, url=entity_id, force=False)
         return entity_id
 
     def __str__(self):


Test patch:
diff --git a/tests/unit/test_bundle.py b/tests/unit/test_bundle.py
index 2fe2c23..f4945bc 100644
--- a/tests/unit/test_bundle.py
+++ b/tests/unit/test_bundle.py
@@ -303,10 +303,10 @@ class TestAddCharmChangeRun:
         assert result == "entity_id"
 
         charmstore.entityId.assert_called_once()
-        charmstore.entityId.assert_called_with("charm")
+        charmstore.entityId.assert_called_with("charm", channel="channel")
 
         client_facade.AddCharm.assert_called_once()
-        client_facade.AddCharm.assert_called_with(channel=None,
+        client_facade.AddCharm.assert_called_with(channel="channel",
                                                   url="entity_id",
                                                   force=False)