From 76e4306d8b44572e000bfb6e82432fe7b65d0c0f Mon Sep 17 00:00:00 2001 From: Liubov Dmitrieva Date: Thu, 24 May 2018 17:37:40 -0700 Subject: [PATCH] commitcloud: improve naming and clean up unused code Reviewed By: singhsrb Differential Revision: D8154257 fbshipit-source-id: ee3f8652831a450c61c1eb1cdda184d80e24307d --- hgext/commitcloud/__init__.py | 16 +++++----------- hgext/commitcloud/httpsservice.py | 10 +++++----- hgext/commitcloud/service.py | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/hgext/commitcloud/__init__.py b/hgext/commitcloud/__init__.py index 4f649bd731..8298989a41 100644 --- a/hgext/commitcloud/__init__.py +++ b/hgext/commitcloud/__init__.py @@ -8,7 +8,7 @@ [commitcloud] # type of commit cloud service to connect to - # local or interngraph + # local or remote servicetype = local # location of the commit cloud service to connect to @@ -17,15 +17,8 @@ # hostname to use for the system hostname = myhost - # host of commitcloud proxy - host = interngraph.intern.facebook.com - - # user token - # private user token to access the commit cloud service - user_token = ***************************** - - # application id that identifies commit cloud in interngraph - app_id = 361121054385388 + # Http endpoint host serving Commit Cloud requests + remote_host = example.commitcloud.com # SSL certificates certs = /etc/pki/tls/certs/fb_certs.pem @@ -43,7 +36,8 @@ # update to a new revision if the current revision has been moved updateonmove = true - # option to print requests to Commit Cloud web endpoint (in debug level) + # option to print incoming and outgoing requests to + # Commit Cloud http endpoint in json format (with --debug option only) debugrequests = true """ diff --git a/hgext/commitcloud/httpsservice.py b/hgext/commitcloud/httpsservice.py index d04a139f5b..41301b1e12 100644 --- a/hgext/commitcloud/httpsservice.py +++ b/hgext/commitcloud/httpsservice.py @@ -43,7 +43,7 @@ DEFAULT_TIMEOUT = 60 MAX_CONNECT_RETRIES = 2 class HttpsCommitCloudService(baseservice.BaseService): - """Commit Cloud Client uses interngraph proxy to communicate with + """Commit Cloud Client uses http endpoint to communicate with Commit Cloud Service """ @@ -54,7 +54,7 @@ class HttpsCommitCloudService(baseservice.BaseService): raise commitcloudcommon.RegistrationError( ui, _('valid user token is required')) - self.host = ui.config('commitcloud', 'host') + self.remote_host = ui.config('commitcloud', 'remote_host') # optional, but needed for using a sandbox self.certs = ui.config('commitcloud', 'certs') @@ -72,15 +72,15 @@ class HttpsCommitCloudService(baseservice.BaseService): 'Authorization': 'OAuth %s' % token, } self.connection = httplib.HTTPSConnection( - self.host, + self.remote_host, context=ssl.create_default_context(cafile=self.certs) if self.certs else ssl.create_default_context(), timeout=DEFAULT_TIMEOUT ) - if not self.host: + if not self.remote_host: raise commitcloudcommon.ConfigurationError( - self.ui, _('host is required')) + self.ui, _('remote_host is required')) def requiresauthentication(self): return True diff --git a/hgext/commitcloud/service.py b/hgext/commitcloud/service.py index 94f6b9a103..4503d95b5e 100644 --- a/hgext/commitcloud/service.py +++ b/hgext/commitcloud/service.py @@ -17,7 +17,7 @@ def get(ui, token=None): servicetype = ui.config('commitcloud', 'servicetype') if servicetype == 'local': return localservice.LocalService(ui) - elif servicetype == 'interngraph': + elif servicetype == 'remote': return httpsservice.HttpsCommitCloudService(ui, token) else: msg = 'Unrecognized commitcloud.servicetype: %s' % servicetype