Skip to content

Commit

Permalink
Place all the OpenShift related logic at one place
Browse files Browse the repository at this point in the history
  • Loading branch information
fridex committed Aug 8, 2018
1 parent 81fcacb commit 321dec1
Show file tree
Hide file tree
Showing 9 changed files with 424 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.eggs/
thoth_common.egg-info/

1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "pypi"
[packages]
"rfc5424-logging-handler" = "*"
daiquiri = "*"
requests = "*"

[dev-packages]
pytest = "*"
Expand Down
50 changes: 44 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rfc5424-logging-handler
daiquiri
requests
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def get_version():
packages=[
'thoth.common',
],
extras_require={
'openshift': ['openshift', 'kubernetes']
},
zip_safe=False,
install_requires=get_install_requires()
)
1 change: 1 addition & 0 deletions thoth/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .json import SafeJSONEncoder
from .logging import init_logging
from .logging import logger_setup
from .openshift import OpenShift

__name__ = 'thoth-common'
__version__ = "0.2.2"
29 changes: 29 additions & 0 deletions thoth/common/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# thoth-common
# Copyright(C) 2018 Fridolin Pokorny
#
# This program is free software: you can redistribute it and / or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Exceptions used within thoth-common package."""


class ThothCommonException(Exception):
"""A base class for Thoth-common exception hierarchy."""


class NotFoundException(ThothCommonException):
"""Raised if the given resource cannot be found."""


class ConfigurationError(ThothCommonException):
"""Raised on miss-configuration issues."""
3 changes: 1 addition & 2 deletions thoth/common/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def _init_log_levels(logging_configuration: dict) -> None:
}

for logger, level in env_logging_conf.items():
logger = 'thoth.' + \
logger[len(_LOGGING_CONF_START):].lower().replace('__', '.')
logger = 'thoth.' + logger[len(_LOGGING_CONF_START):].lower().replace('__', '.')
level = getattr(logging, level)
logging.getLogger(logger).setLevel(level)

Expand Down
Loading

0 comments on commit 321dec1

Please sign in to comment.