Remove alien_list command

This command has lost its usefulness in v3. Leaked instances
are automatically cleaned up by the CleanupWorker thread.

Change-Id: I99dced6c655fe865012d0d54f39bfc16b789d1a2
This commit is contained in:
David Shrewsbury 2017-12-04 07:56:58 -05:00
parent dffe198564
commit a466e560da
3 changed files with 1 additions and 49 deletions

View File

@ -207,11 +207,6 @@ If Nodepool's database gets out of sync with reality, the following
commands can help identify compute instances or images that are
unknown to Nodepool:
alien-list
^^^^^^^^^^
.. program-output:: nodepool alien-list --help
:nostderr:
alien-image-list
^^^^^^^^^^^^^^^^
.. program-output:: nodepool alien-image-list --help

View File

@ -68,13 +68,6 @@ class NodePoolCmd(NodepoolApp):
cmd_image_build.add_argument('image', help='image name')
cmd_image_build.set_defaults(func=self.image_build)
cmd_alien_list = subparsers.add_parser(
'alien-list',
help='list nodes not accounted for by nodepool')
cmd_alien_list.set_defaults(func=self.alien_list)
cmd_alien_list.add_argument('provider', help='provider name',
nargs='?')
cmd_alien_image_list = subparsers.add_parser(
'alien-image-list',
help='list images not accounted for by nodepool')
@ -172,31 +165,6 @@ class NodePoolCmd(NodepoolApp):
self.zk.submitBuildRequest(diskimage)
def alien_list(self):
self.pool.updateConfig()
t = PrettyTable(["Provider", "Hostname", "Server ID", "IP"])
t.align = 'l'
for provider in self.pool.config.providers.values():
if (self.args.provider and
provider.name != self.args.provider):
continue
manager = self.pool.getProviderManager(provider)
try:
servers = manager.listNodes()
known = set([n.external_id for n in self.zk.nodeIterator()
if n.provider == provider.name])
for server in servers:
if server.id not in known:
t.add_row([provider.name, server.name,
server.id, server.public_v4])
except Exception as e:
log.warning("Exception listing aliens for %s: %s"
% (provider.name, str(e)))
print(t)
def alien_image_list(self):
self.pool.updateConfig()
@ -350,7 +318,7 @@ class NodePoolCmd(NodepoolApp):
if self.args.command in ('image-build', 'dib-image-list',
'image-list', 'dib-image-delete',
'image-delete', 'alien-image-list',
'alien-list', 'list', 'hold', 'delete',
'list', 'hold', 'delete',
'request-list'):
self.zk = zk.ZooKeeper()
self.zk.connect(list(config.zookeeper_servers.values()))

View File

@ -97,17 +97,6 @@ class TestNodepoolCMD(tests.DBTestCase):
self.waitForUploadRecordDeletion('fake-provider', 'fake-image',
image.build_id, image.id)
def test_alien_list_fail(self):
def fail_list(self):
raise RuntimeError('Fake list error')
self.useFixture(fixtures.MonkeyPatch(
'nodepool.driver.fake.provider.FakeOpenStackCloud.list_servers',
fail_list))
configfile = self.setup_config("node_cmd.yaml")
self.patch_argv("-c", configfile, "alien-list", "fakeprovider")
nodepoolcmd.main()
def test_alien_image_list_empty(self):
configfile = self.setup_config("node.yaml")
self._useBuilder(configfile)