Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: DELETE keypair with keypairname returns true even if the keypair with that keypairname does not exist. #37

Closed
jihoon-seo opened this issue Oct 23, 2019 · 2 comments
Assignees

Comments

@jihoon-seo
Copy link
Member

  1. HTTP req: GET {{spider_ip}}:{{spider_port}}/keypair/{{spider_keypairId}}?connection_name={{connection_name}}
  2. JSON res:
{
    "message": "InvalidKeyPair.NotFound: The key pair 'mcb-keypair' does not exist\n\tstatus code: 400, request id: 376a433a-b57f-4731-95da-5a9745d97231"
}

=> We can see that the keypair with that keypairname does not exist.


  1. HTTP req: DELETE {{spider_ip}}:{{spider_port}}/keypair/{{spider_keypairId}}?connection_name={{connection_name}}
  2. HTTP res:
    true
    (expected false or failed)
@powerkimhub
Copy link
Member

@dev4unet This is a test on AWS.

@dev4unet
Copy link
Member

  1. HTTP req: GET {{spider_ip}}:{{spider_port}}/keypair/{{spider_keypairId}}?connection_name={{connection_name}}
  2. JSON res:
{
    "message": "InvalidKeyPair.NotFound: The key pair 'mcb-keypair' does not exist\n\tstatus code: 400, request id: 376a433a-b57f-4731-95da-5a9745d97231"
}

=> We can see that the keypair with that keypairname does not exist.

  1. HTTP req: DELETE {{spider_ip}}:{{spider_port}}/keypair/{{spider_keypairId}}?connection_name={{connection_name}}
  2. HTTP res:
    true
    (expected false or failed)

AWS API에서 에러로 보지 않고 있어서 저도 True 처리를 했습니다.
보통 키페어 제거는 목록에서 제거할 키페어를 선택 후 삭제를 호출하며...
삭제 요청시 최종 희망사항은 해당 퍼블릭키가 서버에서 제거되는 것을 희망하기 때문에
서버에 요청한 퍼블릭키가 존재하지 않아도 별도의 에러 없이 true를 리턴하고 있는 것 같습니다.

참고로, AWS에서 제공하는 API 자체에서 삭제시 에러가 발생하지 않는...
삭제 요청의 성공 여부를 별도로 알려주지는 않습니다. (리턴 값이 항상 nil입니다.)
즉, 현재는 삭제시 AWS API에서 에러가 발생하지 않은 경우...
삭제 요청은 성공했다고 판단해서 true를 리턴하고 있습니다만...
(요청한 키파일이 서버에 없는 경우에도 삭제 성공으로 간주해서 별도의 에러는 발생하지 않습니다.)
사용자의 키파일의 삭제 요청 시 키파일의 존재를 먼저 체크해서 false를 리턴하도록 수정하겠습니다.

powerkimhub pushed a commit that referenced this issue Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants