After killing the agent, we need to make sure it has successfully unregistered from the master before proceeding.
(self, timeout=TIMEOUT)
| 289 | |
| 290 | # pylint: disable=arguments-differ |
| 291 | def kill(self, timeout=TIMEOUT): |
| 292 | """ |
| 293 | After killing the agent, we need to make sure it has |
| 294 | successfully unregistered from the master before proceeding. |
| 295 | """ |
| 296 | super(Agent, self).kill() |
| 297 | |
| 298 | try: |
| 299 | # pylint: disable=missing-docstring |
| 300 | def one_inactive_slave(data): |
| 301 | slaves = data["slaves"] |
| 302 | return len(slaves) == 1 and not slaves[0]["active"] |
| 303 | |
| 304 | http.get_json( |
| 305 | self.flags["master"], "slaves", one_inactive_slave, timeout) |
| 306 | except Exception as exception: |
| 307 | raise CLIException("Could not get '/slaves' endpoint as" |
| 308 | " JSON with 0 agents in it: {error}" |
| 309 | .format(error=exception)) |
| 310 | |
| 311 | Agent.count -= 1 |
| 312 | |
| 313 | |
| 314 | class Task(Executable): |