TypeError: archive_deleted_rows got multiple values for keyword arguments 'max_rows'

Bug #1732593 reported by Neha Alhat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Neha Alhat
Ocata
New
Undecided
Unassigned
Pike
Fix Committed
Undecided
Matt Riedemann

Bug Description

If you run archive_deleted_rows subcommand with following parameters, it raises TypeError exception.

$nova-manage db archive_deleted_rows 1000 1000

Output

An error has occurred:
Traceback (most recent call last):
  File "/opt/stack/nova/nova/cmd/manage.py", line 1924, in main
    ret = fn(*fn_args, **fn_kwargs)
TypeError: archive_deleted_rows() got multiple values for argument 'max_rows'

Environment details:

<devstack>:

commit 91f62818c3ab5f7f7cee11df7a7b7d3ce290ecb8
Merge: a6280e5 c09eaf8
Author: Jenkins <email address hidden>
Date: Sun Sep 10 18:31:13 2017 +0000

    Merge "Update OS_AUTH_URL in Configuration.rst"

nova:

commit b7f53a33faf6187ad0b16e45cb14ece07892f7bc
Merge: e48db05 a9d9255
Author: Zuul <email address hidden>
Date: Wed Nov 8 07:16:14 2017 +0000

    Merge "Fix return type in FilterScheduler._legacy_find_hosts"

Reason:

In fn_kwargs for max_rows parameter it is assigning default value of max_rows which is 1000, and not the value which we are passing through command.
So it is giving above mentioned TypeError.

Tags: nova-manage
Changed in nova:
assignee: nobody → Belmiro Moreira (moreira-belmiro-email-lists)
Matt Riedemann (mriedem)
tags: added: nova-manage
Revision history for this message
Matt Riedemann (mriedem) wrote :

Looks like this fixes it:

user@ubuntu:~/git/nova$ git diff
diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py
index 2c867ec..4a4097d 100644
--- a/nova/cmd/manage.py
+++ b/nova/cmd/manage.py
@@ -743,7 +743,7 @@ Error: %s""") % six.text_type(e))
         """Print the current database version."""
         print(migration.db_version())

- @args('--max_rows', type=int, metavar='<number>', default=1000,
+ @args('--max_rows', type=int, metavar='<number>', dest='max_rows',
           help='Maximum number of deleted rows to archive')
     @args('--verbose', action='store_true', dest='verbose', default=False,
           help='Print how many rows were archived per table.')
user@ubuntu:~/git/nova$

Changed in nova:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/520765

Changed in nova:
assignee: Belmiro Moreira (moreira-belmiro-email-lists) → Matt Riedemann (mriedem)
status: Confirmed → In Progress
Neha Alhat (nehaalhat)
Changed in nova:
assignee: Matt Riedemann (mriedem) → Neha Alhat (nehaalhat)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/520765
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0f464e55a856477a5b77ce8ce7efacf9bc139735
Submitter: Zuul
Branch: master

commit 0f464e55a856477a5b77ce8ce7efacf9bc139735
Author: Matt Riedemann <email address hidden>
Date: Thu Nov 16 15:34:32 2017 -0500

    Fix TypeError in nova-manage db archive_deleted_rows

    If you run the archive_deleted_rows command without the
    --max_rows option name but just pass in a value, it will
    fail with a TypeError:

    venv runtests: commands[0] | nova-manage db archive_deleted_rows 1000
    An error has occurred:
    Traceback (most recent call last):
      File "/home/user/git/nova/nova/cmd/manage.py", line 1924, in main
        ret = fn(*fn_args, **fn_kwargs)
    TypeError: archive_deleted_rows() got multiple values for \
               keyword argument 'max_rows'

    This fixes it by setting a dest and moving the default to the kwarg.

    Change-Id: I1e60c571a8e9b875f89af6695f5427c801c8c53b
    Closes-Bug: #1732593

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/525629

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0b2

This issue was fixed in the openstack/nova 17.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/pike)

Reviewed: https://review.openstack.org/525629
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=761b15fd00d77d5e2fd6d163ba677b3c3105f9d7
Submitter: Zuul
Branch: stable/pike

commit 761b15fd00d77d5e2fd6d163ba677b3c3105f9d7
Author: Matt Riedemann <email address hidden>
Date: Thu Nov 16 15:34:32 2017 -0500

    Fix TypeError in nova-manage db archive_deleted_rows

    If you run the archive_deleted_rows command without the
    --max_rows option name but just pass in a value, it will
    fail with a TypeError:

    venv runtests: commands[0] | nova-manage db archive_deleted_rows 1000
    An error has occurred:
    Traceback (most recent call last):
      File "/home/user/git/nova/nova/cmd/manage.py", line 1924, in main
        ret = fn(*fn_args, **fn_kwargs)
    TypeError: archive_deleted_rows() got multiple values for \
               keyword argument 'max_rows'

    This fixes it by setting a dest and moving the default to the kwarg.

    Change-Id: I1e60c571a8e9b875f89af6695f5427c801c8c53b
    Closes-Bug: #1732593
    (cherry picked from commit 0f464e55a856477a5b77ce8ce7efacf9bc139735)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 16.1.0

This issue was fixed in the openstack/nova 16.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.