Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-154

Parameters For All Drivers and Base Connection Do Not Support Tuple Lists

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Core

    Description

      Currently the parameters argument to the base connection's request method is required to be a dict.

      This prevents passing multiple query-string arguments with the same key.

      The code sometimes works 'as is' because urlencode supports either dicts/tuple lists, but throughout the libcloud codebase there is code like:

      EC2Connection:

      def add_default_params(self, params):
      params['SignatureVersion'] = '2'
      params['SignatureMethod'] = 'HmacSHA256'
      params['AWSAccessKeyId'] = self.user_id
      params['Version'] = API_VERSION
      params['Timestamp'] = time.strftime('%Y-%m-%dT%H:%M:%SZ',
      time.gmtime())
      params['Signature'] = self._get_aws_auth_param(params, self.key,
      self.action)
      return params

      This prevents tuple lists being used for EC2 drivers, for example.

      A solution here would be to add a _extend_parameters to the base connection object, make it work whether the parameters were a dict or a list, and then update all the parameter mutating parts of the codebase to use it.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tildedave Dave King
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: