Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shriganesh Shintre committed Jul 6, 2017
1 parent 0f50ef5 commit 94edd0d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/client/build_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BuildRunner(object):
build results.
Example usage pattern:
>>> runner = BuildRunner('http(s)://mymaster.net:123', {'type':'git', 'url':'https://github.com/box/StatusWolf.git'})
>>> runner = BuildRunner('https://mymaster.net:123', {'type':'git', 'url':'https://github.com/box/StatusWolf.git'})
>>> runner.run()
"""

Expand Down
4 changes: 2 additions & 2 deletions app/client/cluster_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from typing import Any, Callable, Dict, List, Optional

from app.master.build import BuildStatus
from app.util.conf.configuration import Configuration
from app.util import log, poll
from app.util.network import Network
from app.util.secret import Secret
from app.util.url_builder import UrlBuilder
from app.util.conf.configuration import Configuration


class ClusterAPIClient(object):
Expand All @@ -31,7 +31,7 @@ def _ensure_url_has_scheme(self, url):
"""
url = url.strip()
if not url.startswith('http'):
url = '{}://'.format(Configuration['protocol_scheme']) + url
url = '{}://{}'.format(Configuration['protocol_scheme'], url)
return url


Expand Down
6 changes: 3 additions & 3 deletions app/subcommands/service_subcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import tornado.ioloop
from tornado.httpserver import HTTPServer

from app.util.conf.configuration import Configuration
from app.subcommands.subcommand import Subcommand
from app.util import fs
from app.util.safe_thread import SafeThread
from app.util.unhandled_exception_handler import UnhandledExceptionHandler
from app.util.conf.configuration import Configuration


class ServiceSubcommand(Subcommand):
Expand Down Expand Up @@ -61,8 +61,8 @@ def remove_pid_file():
UnhandledExceptionHandler.singleton().add_teardown_callback(remove_pid_file)

def _get_https_options(self):
https_cert_file = Configuration['https_cert_file'] if 'https_cert_file' in Configuration else None
https_key_file = Configuration['https_key_file'] if 'https_key_file' in Configuration else None
https_cert_file = Configuration['https_cert_file']
https_key_file = Configuration['https_key_file']

if https_cert_file and https_key_file:
return {
Expand Down
5 changes: 5 additions & 0 deletions app/util/conf/base_config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil

from app.util import autoversioning, fs
from app.util.conf.configuration import Configuration
from app.util.conf.config_file import ConfigFile


Expand Down Expand Up @@ -116,6 +117,10 @@ def configure_postload(self, conf):
conf.set('log_file', join(log_dir, conf.get('log_filename')))
conf.set('eventlog_file', join(log_dir, conf.get('eventlog_filename')))

# Set protocol scheme (by default it is set to 'http')
if Configuration['https_cert_file'] and Configuration['https_key_file']:
conf.set('protocol_scheme', 'https')

def load_from_config_file(self, config, config_filename):
"""
:type config: Configuration
Expand Down
7 changes: 0 additions & 7 deletions app/util/conf/master_config_loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from os.path import join

from app.util.conf.base_config_loader import BaseConfigLoader
from app.util.conf.configuration import Configuration


class MasterConfigLoader(BaseConfigLoader):
Expand Down Expand Up @@ -39,9 +38,3 @@ def configure_postload(self, conf):
# where to store results on the master
conf.set('results_directory', join(base_directory, 'results', 'master'))
conf.set('timings_directory', join(base_directory, 'timings', 'master')) # timing data

# Set protocol scheme (by default its set to 'http')
https_cert_file = Configuration['https_cert_file']
https_key_file = Configuration['https_key_file']
if https_cert_file and https_key_file:
conf.set('protocol_scheme', 'https')
7 changes: 0 additions & 7 deletions app/util/conf/slave_config_loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from os.path import join

from app.util.conf.base_config_loader import BaseConfigLoader
from app.util.conf.configuration import Configuration


class SlaveConfigLoader(BaseConfigLoader):
Expand Down Expand Up @@ -41,9 +40,3 @@ def configure_postload(self, conf):
# where to store results on the slave
conf.set('results_directory', join(base_directory, 'results', 'slave'))
conf.set('timings_directory', join(base_directory, 'timings', 'master')) # timing data

# Set protocol scheme (by default its set to 'http')
https_cert_file = Configuration['https_cert_file']
https_key_file = Configuration['https_key_file']
if https_cert_file and https_key_file:
conf.set('protocol_scheme', 'https')

0 comments on commit 94edd0d

Please sign in to comment.