inconsistent positional arguments in InternalClient

Bug #1712927 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Confirmed
Low
Unassigned

Bug Description

The signature for InternalClient get_object and a few others is reasonable:

    def get_object(self, account, container, obj, headers,
                   acceptable_statuses=(2,)):

    def iter_object_lines(
            self, account, container, obj, headers=None,
            acceptable_statuses=(2,)):

    def create_container(
            self, account, container, headers=None, acceptable_statuses=(2,)):

the pattern is (self, *aco, headers, acceptable_statuses)

the set_*_metadata method introduces a new concept of questionable utility:

    def set_container_metadata(
            self, account, container, metadata, metadata_prefix='',
            acceptable_statuses=(2,)):

    def set_object_metadata(
            self, account, container, obj, metadata,
            metadata_prefix='', acceptable_statuses=(2,)):

But still, with the default metadata_prefix='', the implementation ends up following the "normal" signature (i.e. the metadata arg ends up being just headers sent along with the request)

This IMHO makes get_object_metadata stick out like a sore thumb:

    def get_object_metadata(
            self, account, container, obj, metadata_prefix='',
            acceptable_statuses=(2,), headers=None):

And indeed calling it like get_object, i.e.

  my_internal_client.get_object_metadata('a', 'c', 'o', {'my-headers-are-important': True})

Does in fact smash your thumb with hammer.

Changed in swift:
status: New → Confirmed
importance: Undecided → Low
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.