batch-shipyard icon indicating copy to clipboard operation
batch-shipyard copied to clipboard

AttributeError in list pools command

Open barborico opened this issue 6 years ago • 3 comments

Problem Description

When using the shipyard list pools command, I have been receiving the following error:

Traceback (most recent call last):
  File "/opt/batch-shipyard/shipyard.py", line 3134, in <module>
    cli()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/opt/batch-shipyard/shipyard.py", line 1571, in pool_list
    convoy.fleet.action_pool_list(ctx.batch_client, ctx.config)
  File "/opt/batch-shipyard/convoy/fleet.py", line 3387, in action_pool_list
    batch.list_pools(batch_client, config)
  File "/opt/batch-shipyard/convoy/batch.py", line 1286, in list_pools
    de.append('      * {}: {}'.format(de.name, de.value))
AttributeError: 'NameValuePair' object has no attribute 'append'

Looking at the source code, I see:

def list_pools(batch_client, config):
    # type: (azure.batch.batch_service_client.BatchServiceClient,
    #        config) -> None
    """List pools
    :param batch_client: The batch client to use.
    :type batch_client: `azure.batch.batch_service_client.BatchServiceClient`
    :param dict config: configuration dict
    """
    if settings.raw(config):
        util.print_raw_paged_output(batch_client.pool.list)
        return
    i = 0
    log = ['list of pools']
    pools = batch_client.pool.list()
    for pool in pools:
        if util.is_not_empty(pool.resize_errors):
            errors = ['  * resize errors:']
            for err in pool.resize_errors:
                errors.append('    * {}: {}'.format(err.code, err.message))
                if util.is_not_empty(err.values):
                    for de in err.values:
                        de.append('      * {}: {}'.format(de.name, de.value))

I believe that the last line has a typo and is intended to read errors.append(...).

Batch Shipyard Version

I am running 3.8.2, but the issue appears to exist in the current master branch as well.

Steps to Reproduce

Expected Results

Actual Results

Redacted Configuration

Additional Logs

Additonal Comments

barborico avatar Dec 17 '19 01:12 barborico

Thanks for the bug report, this will be fixed in the next release.

alfpark avatar Jan 06 '20 16:01 alfpark

Is there an ETA for that release?

barborico avatar Feb 05 '20 18:02 barborico

Sorry for the delay. I'm waiting on a some service-side support for the next release. Hopefully that will happen within the next few weeks. In the meantime, if you have installed via the script, you can switch your branch to develop, git pull, and re-run your install script to get the changes. Alternatively, you can use the develop-cli docker image.

alfpark avatar Feb 07 '20 15:02 alfpark