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

ceph: fix to support TLS enabled rgw-endpoint #6227

Merged
merged 1 commit into from Sep 14, 2020

Conversation

aruniiird
Copy link
Contributor

@aruniiird aruniiird commented Sep 10, 2020

Signed-off-by: Arun Kumar Mohan amohan@redhat.com

Description of your changes:
Enables the 'create-external-cluster-resources.py' script to check a given TLS (https) enabled rgw-endpoint.

Which issue is resolved by this Pull Request:
Resolves #

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the developer guide.
  • Skip Tests for Docs: Add the flag for skipping the build if this is only a documentation change. See here for the flag.
  • Skip Unrelated Tests: Add a flag to run tests for a specific storage provider. See test options.
  • Reviewed the developer guide on Submitting a Pull Request
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.
  • Pending release notes updated with breaking and/or notable changes, if necessary.
  • Upgrade from previous release is tested and upgrade user guide is updated, if necessary.
  • Code generation (make codegen) has been run to update object specifications, if necessary.

[skip ci]

@mergify mergify bot added the ceph main ceph tag label Sep 10, 2020
for prefix in protocols:
try:
ep = "{}://{}".format(prefix, endpoint_str)
r = requests.head(ep)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the timeout all ready for this? Can we shorten it to a few seconds? Like <5s?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added 3 second as per the following doc,

:param timeout: (optional) How many seconds to wait for the server to send data
        before giving up, as a float, or a :ref:`(connect timeout, read timeout) <timeouts>` tuple.
        :type timeout: float or tuple

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test your change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I have tested my change individually (by providing URLs like golang , youtube websites and other non-existing) on a separate python file. It works within the timeout.

import sys
import requests

class ExecutionFailureException(Exception):
    pass

def endpoint_check(endpoint_str, timeout=5):
    protocols = ["http", "https"]
    for prefix in protocols:
        try:
            ep = "{}://{}".format(prefix, endpoint_str)
            print("EP: {}".format(ep))
            r = requests.head(ep, timeout=timeout)
            if r.status_code == 200:
                return
            print("EP Status: {}".format(r.status_code))
        except:
            continue
    raise ExecutionFailureException(
        "unable to connect to endpoint: {}".format(endpoint_str))


def main():
    endpoint = "vlang.io"
    if len(sys.argv) > 1:
        endpoint = sys.argv[1]
    endpoint_check(endpoint, timeout=3)

if __name__ == "__main__":
    main()

Signed-off-by: Arun Kumar Mohan <amohan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ceph main ceph tag
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants