Coder Social home page Coder Social logo

pyc8's People

Contributors

darighost avatar davidlubomirov avatar dependabot[bot] avatar diana-macrometa avatar dlozina-macrometa avatar durgagokina avatar edgargarciamacrometa avatar georgikiriloff avatar grainier-macrometa avatar hp-kulkarni avatar kartikeya-macrometa avatar koshy-thomas avatar pnarode avatar pnarodemacrometa avatar poorvamacrometa avatar praminda-macrometa avatar ricardo-macrometa avatar shahpratikr avatar sulommacrometa avatar vipulmacrometa avatar warchiefx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyc8's Issues

Restart of ambassador caused tenants to become "syncing"

Description

Updating C8 with latest SSL certificates caused Ambassador to restart and break replication for "demo" tenant.

https://app.circleci.com/pipelines/github/Macrometacorp/C8Operator/13482/workflows/76e4393a-73df-4976-817a-be4286f2ec25/jobs/24662

Ambassador restarted after update

    Host Ports:     0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP
    State:          Running
      Started:      Mon, 12 Apr 2021 15:53:24 +0000
    Last State:     Terminated
      Reason:       Error
      Exit Code:    137
      Started:      Mon, 12 Apr 2021 15:52:00 +0000
      Finished:     Mon, 12 Apr 2021 15:53:22 +0000
    Ready:          True
    Restart Count:  6

Why does C8Client default to HTTP instead of HTTPS?

Just wondering. I noticed that in the class constructor, the default protocol is plain http. Seems like the saner behavior (now days) would be to default to HTTPS and allow the user to specify HTTP.

Here's the constructor I'm referring to:

def __init__(self, protocol="http", host='127.0.0.1', port=80,

Of course, this would break things for users who are leaving this unspecified, so maybe it's not an option now anyway for backwards compatibility.

Also, while I'm nitpicking about minor details, we make HTTP the default protocol and make 80 the default port, right? But if a user specifies HTTPS and then doesn't specify a port, then the port will stay at the default, right? Which is 80. So anytime you change the protocol, you almost certainly have to specify a port now. The more convenient way to do this would be to make the default port None, then (if it's still None in the constructor, meaning the user didn't specify a port), we set it to either 80 or 443 depending on the value of protocol. Like so:

    def __init__(self, protocol="https", host='127.0.0.1', port=None,
                 geofabric="_system", stream_port=constants.STREAM_PORT,
                 email=None, password=None,  http_client=None, token=None, apikey=None):
        if port is None: # only force the port to default if user didn't supply an explicit port
            if protocol == 'http':
               port = 80
           elif protocol == 'https':
               port = 443
           else:
               raise Exception(f'Unsupported protocol: {protocol}')

The current system handles this by just forcing the port to 443 if the protocol is 'https', no matter what the user supplies as port. This is actually a bug - what if the user is running HTTPS on a port other than 443? After all, that consideration is the whole reason this parameter exists for the user to supply!

pyC8/c8/client.py

Lines 38 to 39 in c4288ec

if self._protocol == 'https':
self._port = 443

Just some thoughts! I'd be happy to submit a patch for this myself if that would be helpful. By the way, thanks for making an awesome product!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.