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

ex_delete_keypair() spits UnkownError in the ec2 driver

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0-beta3
    • Component/s: None
    • Labels:
      None
    • Environment:

      0.14.0-beta2-tentative

      Description

      I have been testing list/add/delete keypairs using libcloud ec2 driver but I failed when I execute ex_delete_keypair().

      Here is the captured message:
      >>> conn.ex_delete_keypair('hrlee')
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "//apache-libcloud/libcloud/compute/drivers/ec2.py", line 886, in ex_delete_keypair
      result = self.connection.request(self.path, params=params).object
      File "//apache-libcloud/libcloud/common/base.py", line 622, in request
      connection=self)
      File "//apache-libcloud/libcloud/common/base.py", line 93, in _init_
      raise Exception(self.parse_error())
      Exception: UnknownError: An unknown error has occurred. Please try your request again.

      It might be caused by my private cloud's fault settings but I just try to get some tips and comments from here first.

      Thank you.

        Activity

        Hide
        hrlee Hyungro Lee added a comment - - edited

        I just tested and it seems working fine. Thanks for the quick patch!

        >>> conn.ex_delete_keypair('hrlee')

        1. -------- begin 48257936 request ----------
          curl -i -X GET -H 'Host: openstack.edu:8773' -H 'X-LC-Request-ID: 48257936' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-beta2 (Eucalyptus) ' --compress 'https://openstack.edu:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId= {...}&Version=2010-08-31&Timestamp=2013-10-23T19%3A11%3A08Z&SignatureMethod=HmacSHA256&KeyName=hrlee&Signature={...}

          &Action=DeleteKeyPair'

        2. -------- begin 48257936:48257720 response ----------
          HTTP/1.1 200 OK
          Content-Length: 174
          Content-Encoding: gzip
          Vary: Accept-Encoding
          Server: Apache/2.2.22 (Ubuntu)
          Date: Wed, 23 Oct 2013 19:11:57 GMT
          Content-Type: text/xml

        <?xml version="1.0" ?><DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2010-08-31/"><requestId>

        {...}

        </requestId><return>true</return></DeleteKeyPairResponse>

        1. -------- end 48257936:48257720 response ----------

        Thank you!

        Show
        hrlee Hyungro Lee added a comment - - edited I just tested and it seems working fine. Thanks for the quick patch! >>> conn.ex_delete_keypair('hrlee') -------- begin 48257936 request ---------- curl -i -X GET -H 'Host: openstack.edu:8773' -H 'X-LC-Request-ID: 48257936' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-beta2 (Eucalyptus) ' --compress 'https://openstack.edu:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId= {...}&Version=2010-08-31&Timestamp=2013-10-23T19%3A11%3A08Z&SignatureMethod=HmacSHA256&KeyName=hrlee&Signature={...} &Action=DeleteKeyPair' -------- begin 48257936:48257720 response ---------- HTTP/1.1 200 OK Content-Length: 174 Content-Encoding: gzip Vary: Accept-Encoding Server: Apache/2.2.22 (Ubuntu) Date: Wed, 23 Oct 2013 19:11:57 GMT Content-Type: text/xml <?xml version="1.0" ?><DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2010-08-31/"><requestId> {...} </requestId><return>true</return></DeleteKeyPairResponse> -------- end 48257936:48257720 response ---------- Thank you!
        Hide
        kami Tomaz Muraus added a comment - - edited

        I've removed extra blank lines and merged patch into trunk. Thanks.

        Hyungro Lee - can you please verify that changes in trunk fix your problem?

        Show
        kami Tomaz Muraus added a comment - - edited I've removed extra blank lines and merged patch into trunk. Thanks. Hyungro Lee - can you please verify that changes in trunk fix your problem?
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 7fc13a4a87e1c69c66d53c446ec963ef07fb8519 in branch refs/heads/trunk from Oleg Suharev
        [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=7fc13a4 ]

        LIBCLOUD-415 try fix keypair delete * add tests for delete keypair

        Signed-off-by: Tomaz Muraus <tomaz@apache.org>

        Show
        jira-bot ASF subversion and git services added a comment - Commit 7fc13a4a87e1c69c66d53c446ec963ef07fb8519 in branch refs/heads/trunk from Oleg Suharev [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=7fc13a4 ] LIBCLOUD-415 try fix keypair delete * add tests for delete keypair Signed-off-by: Tomaz Muraus <tomaz@apache.org>
        Hide
        gigimon Oleg Suharev added a comment - - edited

        I attached patch for this

        Show
        gigimon Oleg Suharev added a comment - - edited I attached patch for this
        Hide
        gigimon Oleg Suharev added a comment -

        Yes, I check today documentation too and find this, but KeyPair.1 work in amazon
        Please approve my patch in github

        Show
        gigimon Oleg Suharev added a comment - Yes, I check today documentation too and find this, but KeyPair.1 work in amazon Please approve my patch in github
        Hide
        kami Tomaz Muraus added a comment -

        Oleg Suharev thanks for looking into this!

        I just checked the API docs and it seems like the current implementation also shouldn't work with EC2 since it doesn't use a correct query parameter name (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteKeyPair.html).

        Show
        kami Tomaz Muraus added a comment - Oleg Suharev thanks for looking into this! I just checked the API docs and it seems like the current implementation also shouldn't work with EC2 since it doesn't use a correct query parameter name ( http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteKeyPair.html ).
        Hide
        gigimon Oleg Suharev added a comment -

        Can You try this patch? https://github.com/apache/libcloud/pull/161
        If it will work I create patch here and it will merged to trunk

        Show
        gigimon Oleg Suharev added a comment - Can You try this patch? https://github.com/apache/libcloud/pull/161 If it will work I create patch here and it will merged to trunk
        Hide
        hrlee Hyungro Lee added a comment -

        Hi,

        I tested euca2ools and it seems working fine. Here is the debug output that I captured:

        hrlee@:~$ euca-delete-keypair --debug hrlee
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Method: POST
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Path: /services/Cloud/
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Data:
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Headers: {}
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Host: openstack.edu:8773
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:establishing HTTPS connection: host=openstack.edu:8773, kwargs={}
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:Token: None
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:using _calc_signature_2
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:query string: AWSAccessKeyId=

        {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30
        2013-10-23 02:30:09,039 euca2ools [DEBUG]:string_to_sign: POST
        openstack.edu:8773
        /services/Cloud/
        AWSAccessKeyId={...}

        &Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30
        2013-10-23 02:30:09,040 euca2ools [DEBUG]:len(b64)=44
        2013-10-23 02:30:09,040 euca2ools [DEBUG]:base64 encoded digest:

        {..}

        2013-10-23 02:30:09,040 euca2ools [DEBUG]:query_string: AWSAccessKeyId=

        {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30 Signature: {...}

        send: 'POST /services/Cloud/ HTTP/1.1\r\nHost: openstack.edu:8773\r\nAccept-Encoding: identity\r\nContent-Length: 250\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nUser-Agent: Boto/2.4.1 (linux2)\r\n\r\nAWSAccessKeyId=

        {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30&Signature={...}

        '
        reply: 'HTTP/1.1 200 OK\r\n'
        header: Date: Wed, 23 Oct 2013 06:30:09 GMT
        header: Server: Apache/2.2.22 (Ubuntu)
        header: Content-Length: 202
        header: Vary: Accept-Encoding
        header: Content-Type: text/xml
        2013-10-23 02:30:09,311 euca2ools [DEBUG]:<?xml version="1.0" ?><DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"><requestId>req-...............</requestId><return>true</return></DeleteKeyPairResponse>
        KEYPAIR hrlee

        Show
        hrlee Hyungro Lee added a comment - Hi, I tested euca2ools and it seems working fine. Here is the debug output that I captured: hrlee@:~$ euca-delete-keypair --debug hrlee 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Method: POST 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Path: /services/Cloud/ 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Data: 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Headers: {} 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Host: openstack.edu:8773 2013-10-23 02:30:09,039 euca2ools [DEBUG] :establishing HTTPS connection: host=openstack.edu:8773, kwargs={} 2013-10-23 02:30:09,039 euca2ools [DEBUG] :Token: None 2013-10-23 02:30:09,039 euca2ools [DEBUG] :using _calc_signature_2 2013-10-23 02:30:09,039 euca2ools [DEBUG] :query string: AWSAccessKeyId= {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30 2013-10-23 02:30:09,039 euca2ools [DEBUG] :string_to_sign: POST openstack.edu:8773 /services/Cloud/ AWSAccessKeyId={...} &Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30 2013-10-23 02:30:09,040 euca2ools [DEBUG] :len(b64)=44 2013-10-23 02:30:09,040 euca2ools [DEBUG] :base64 encoded digest: {..} 2013-10-23 02:30:09,040 euca2ools [DEBUG] :query_string: AWSAccessKeyId= {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30 Signature: {...} send: 'POST /services/Cloud/ HTTP/1.1\r\nHost: openstack.edu:8773\r\nAccept-Encoding: identity\r\nContent-Length: 250\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nUser-Agent: Boto/2.4.1 (linux2)\r\n\r\nAWSAccessKeyId= {...}&Action=DeleteKeyPair&KeyName=hrlee&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2013-10-23T06%3A30%3A09Z&Version=2009-11-30&Signature={...} ' reply: 'HTTP/1.1 200 OK\r\n' header: Date: Wed, 23 Oct 2013 06:30:09 GMT header: Server: Apache/2.2.22 (Ubuntu) header: Content-Length: 202 header: Vary: Accept-Encoding header: Content-Type: text/xml 2013-10-23 02:30:09,311 euca2ools [DEBUG] :<?xml version="1.0" ?><DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"><requestId>req-... ... ... ... ...</requestId><return>true</return></DeleteKeyPairResponse> KEYPAIR hrlee
        Hide
        gigimon Oleg Suharev added a comment -

        Will be great if You try this via Euca2ools and show requests

        Show
        gigimon Oleg Suharev added a comment - Will be great if You try this via Euca2ools and show requests
        Hide
        gigimon Oleg Suharev added a comment - - edited

        Hello

        I'm checking this now and don't have any problem:

        # -------- begin 4481412776 request ----------
        curl -i -X GET -H 'Host: ec2.us-east-1.amazonaws.com' -H 'X-LC-Request-ID: 4481412776' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-dev (Amazon EC2) ' --compress 'https://ec2.us-east-1.amazonaws.com:443/?SignatureVersion=2&AWSAccessKeyId={...}&Timestamp=2013-10-23T06%3A04%3A08Z&KeyName.1=oleg&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature={...}%3D&Action=DeleteKeyPair'
        # -------- begin 4481412776:4481230248 response ----------
        HTTP/1.1 200 OK
        Content-Encoding: gzip
        Transfer-Encoding: chunked
        Vary: Accept-Encoding
        Server: AmazonEC2
        Date: Wed, 23 Oct 2013 06:04:09 GMT
        Content-Type: text/xml;charset=UTF-8
        
        e2
        <?xml version="1.0" encoding="UTF-8"?>
        <DeleteKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2010-08-31/">
            <requestId>2f36c66c-7eee-43f4-8dd4-c5517a0ea926</requestId>
            <return>true</return>
        </DeleteKeyPairResponse>
        0
        
        # -------- end 4481412776:4481230248 response ----------
        

        Maybe it's eucalyptus problem? I don't have any eucalyptus good installation and can't check on eucalyptus, on EC2 it work

        Show
        gigimon Oleg Suharev added a comment - - edited Hello I'm checking this now and don't have any problem: # -------- begin 4481412776 request ---------- curl -i -X GET -H 'Host: ec2.us-east-1.amazonaws.com' -H 'X-LC-Request-ID: 4481412776' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-dev (Amazon EC2) ' --compress 'https: //ec2.us-east-1.amazonaws.com:443/?SignatureVersion=2&AWSAccessKeyId={...}&Timestamp=2013-10-23T06%3A04%3A08Z&KeyName.1=oleg&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature={...}%3D&Action=DeleteKeyPair' # -------- begin 4481412776:4481230248 response ---------- HTTP/1.1 200 OK Content-Encoding: gzip Transfer-Encoding: chunked Vary: Accept-Encoding Server: AmazonEC2 Date: Wed, 23 Oct 2013 06:04:09 GMT Content-Type: text/xml;charset=UTF-8 e2 <?xml version= "1.0" encoding= "UTF-8" ?> <DeleteKeyPairResponse xmlns= "http: //ec2.amazonaws.com/doc/2010-08-31/" > <requestId>2f36c66c-7eee-43f4-8dd4-c5517a0ea926</requestId> < return > true </ return > </DeleteKeyPairResponse> 0 # -------- end 4481412776:4481230248 response ---------- Maybe it's eucalyptus problem? I don't have any eucalyptus good installation and can't check on eucalyptus, on EC2 it work
        Hide
        hrlee Hyungro Lee added a comment -

        Here is the debug output.

        >>> conn.ex_delete_keypair('hrlee')

        1. -------- begin 31062712 request ----------
          curl -i -X GET -H 'Host: openstack.edu:8773' -H 'X-LC-Request-ID: 31062712' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-beta2 (Eucalyptus) ' --compress 'https://openstack.edu:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId= {...}&Timestamp=2013-10-23T03%3A24%3A16Z&KeyName.1=hrlee&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature={...}

          &Action=DeleteKeyPair'

        2. -------- begin 31062712:31063576 response ----------
          HTTP/1.1 400 Bad Request
          Content-Length: 194
          Content-Encoding: gzip
          Vary: Accept-Encoding
          Server: Apache/2.2.22 (Ubuntu)
          Connection: close
          Date: Wed, 23 Oct 2013 03:25:04 GMT
          Content-Type: text/xml

        <?xml version="1.0"?>
        <Response><Errors><Error><Code>UnknownError</Code><Message>An unknown error has occurred. Please try your request again.</Message></Error></Errors><RequestID>req-...</RequestID></Response>

        1. -------- end 31062712:31063576 response ----------

        Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "//apache-libcloud/libcloud/compute/drivers/ec2.py", line 886, in ex_delete_keypair
        result = self.connection.request(self.path, params=params).object
        File "/apache-libcloud/libcloud/common/base.py", line 622, in request
        connection=self)
        File "/apache-libcloud/libcloud/common/base.py", line 93, in _init_
        raise Exception(self.parse_error())
        Exception: UnknownError: An unknown error has occurred. Please try your request again.

        Show
        hrlee Hyungro Lee added a comment - Here is the debug output. >>> conn.ex_delete_keypair('hrlee') -------- begin 31062712 request ---------- curl -i -X GET -H 'Host: openstack.edu:8773' -H 'X-LC-Request-ID: 31062712' -H 'Accept-Encoding: gzip,deflate' -H 'User-Agent: libcloud/0.14.0-beta2 (Eucalyptus) ' --compress 'https://openstack.edu:8773/services/Cloud?SignatureVersion=2&AWSAccessKeyId= {...}&Timestamp=2013-10-23T03%3A24%3A16Z&KeyName.1=hrlee&SignatureMethod=HmacSHA256&Version=2010-08-31&Signature={...} &Action=DeleteKeyPair' -------- begin 31062712:31063576 response ---------- HTTP/1.1 400 Bad Request Content-Length: 194 Content-Encoding: gzip Vary: Accept-Encoding Server: Apache/2.2.22 (Ubuntu) Connection: close Date: Wed, 23 Oct 2013 03:25:04 GMT Content-Type: text/xml <?xml version="1.0"?> <Response><Errors><Error><Code>UnknownError</Code><Message>An unknown error has occurred. Please try your request again.</Message></Error></Errors><RequestID>req-...</RequestID></Response> -------- end 31062712:31063576 response ---------- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "//apache-libcloud/libcloud/compute/drivers/ec2.py", line 886, in ex_delete_keypair result = self.connection.request(self.path, params=params).object File "/apache-libcloud/libcloud/common/base.py", line 622, in request connection=self) File "/apache-libcloud/libcloud/common/base.py", line 93, in _ init _ raise Exception(self.parse_error()) Exception: UnknownError: An unknown error has occurred. Please try your request again.
        Hide
        kami Tomaz Muraus added a comment -

        This functionality was added recently by Oleg Suharev. Oleg Suharev can you please have a look at this one?

        Hyungro Lee Including debug output (https://libcloud.readthedocs.org/en/latest/troubleshooting.html#debugging) will help us troubleshoot this issue.

        Show
        kami Tomaz Muraus added a comment - This functionality was added recently by Oleg Suharev . Oleg Suharev can you please have a look at this one? Hyungro Lee Including debug output ( https://libcloud.readthedocs.org/en/latest/troubleshooting.html#debugging ) will help us troubleshoot this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            hrlee Hyungro Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development