mirror of
https://github.com/containers/podman.git
synced 2025-06-02 02:26:52 +08:00
update container status with new results
a bug was being caused by the fact that the container network results were not being updated properly. given that jhon is on PTO, this PR will replace #8362 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -1144,8 +1144,8 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
|
|||||||
// build a list of network names so we can sort and
|
// build a list of network names so we can sort and
|
||||||
// get the new name's index
|
// get the new name's index
|
||||||
var networkNames []string
|
var networkNames []string
|
||||||
for netName := range networks {
|
for name := range networks {
|
||||||
networkNames = append(networkNames, netName)
|
networkNames = append(networkNames, name)
|
||||||
}
|
}
|
||||||
networkNames = append(networkNames, netName)
|
networkNames = append(networkNames, netName)
|
||||||
// sort
|
// sort
|
||||||
@ -1157,6 +1157,7 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
|
|||||||
// populate network status
|
// populate network status
|
||||||
copy(networkStatus[index+1:], networkStatus[index:])
|
copy(networkStatus[index+1:], networkStatus[index:])
|
||||||
networkStatus[index] = networkResults[0]
|
networkStatus[index] = networkResults[0]
|
||||||
|
c.state.NetworkStatus = networkStatus
|
||||||
}
|
}
|
||||||
c.newNetworkEvent(events.NetworkConnect, netName)
|
c.newNetworkEvent(events.NetworkConnect, netName)
|
||||||
return c.save()
|
return c.save()
|
||||||
|
@ -60,7 +60,7 @@ class Podman(object):
|
|||||||
"""
|
"""
|
||||||
{
|
{
|
||||||
"cniVersion": "0.3.0",
|
"cniVersion": "0.3.0",
|
||||||
"name": "podman",
|
"name": "default",
|
||||||
"plugins": [{
|
"plugins": [{
|
||||||
"type": "bridge",
|
"type": "bridge",
|
||||||
"bridge": "cni0",
|
"bridge": "cni0",
|
||||||
|
@ -87,7 +87,7 @@ class TestContainers(unittest.TestCase):
|
|||||||
self.assertEqual(len(containers), 2)
|
self.assertEqual(len(containers), 2)
|
||||||
|
|
||||||
def test_stop_container(self):
|
def test_stop_container(self):
|
||||||
top = self.client.containers.get("top")
|
top = self.client.containers.get(TestContainers.topContainerId)
|
||||||
self.assertEqual(top.status, "running")
|
self.assertEqual(top.status, "running")
|
||||||
|
|
||||||
# Stop a running container and validate the state
|
# Stop a running container and validate the state
|
||||||
|
Reference in New Issue
Block a user