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

Place all the OpenShift related logic at one place #56

Merged
merged 5 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
438 changes: 0 additions & 438 deletions Pipfile.lock

This file was deleted.

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