Skip to content

Commit

Permalink
Removed a logical error in the checking of the existing of the enviro…
Browse files Browse the repository at this point in the history
…nment variables
  • Loading branch information
Jochem Berends committed Sep 15, 2017
1 parent ce27ba1 commit 1a5e288
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Change Log

pykechain changelog

1.12.2 (15SEP17)
----------------
* Removed a logical error in the checking of the existing of the environment variables

1.12.1 (15SEP17)
----------------
* Added the ability to enforce the use of environment variables when the KECHAIN_FORCE_ENV_USE is set to a true value in the environment. Altered documentation and altered tests for that (#193)
Expand Down
2 changes: 1 addition & 1 deletion pykechain/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = 'pykechain'
description = 'KE-chain Python SDK'

version = '1.12.1'
version = '1.12.2'

author = 'KE-works BV'
email = 'support+pykechain@ke-works.com'
9 changes: 5 additions & 4 deletions pykechain/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from envparse import env

from pykechain.client import Client
Expand Down Expand Up @@ -72,14 +73,14 @@ def get_project(url=None, username=None, password=None, token=None, scope=None,
Bike Project
"""
if env.bool(kecenv.KECHAIN_FORCE_ENV_USE, default=False):
if not env(kecenv.KECHAIN_URL):
if not os.getenv(kecenv.KECHAIN_URL):
raise ClientError(
"Error: KECHAIN_URL should be provided as environment variable (use of env vars is enforced)")
if not env(kecenv.KECHAIN_TOKEN, None) or \
not (env(kecenv.KECHAIN_PASSWORD, None) and (env(kecenv.KECHAIN_PASSWORD, None))):
if not (os.getenv(kecenv.KECHAIN_TOKEN) or
(os.getenv(kecenv.KECHAIN_PASSWORD) and os.getenv(kecenv.KECHAIN_PASSWORD))):
raise ClientError("Error: KECHAIN_TOKEN or KECHAIN_USERNAME and KECHAIN_PASSWORD should be provided as "
"environment variable(s) (use of env vars is enforced)")
if not env(kecenv.KECHAIN_SCOPE, None) or not env(kecenv.KECHAIN_SCOPE_ID, None):
if not (os.getenv(kecenv.KECHAIN_SCOPE) or os.getenv(kecenv.KECHAIN_SCOPE_ID)):
raise ClientError("Error: KECHAIN_SCOPE or KECHAIN_SCOPE_ID should be provided as environment variable "
"(use of env vars is enforced)")

Expand Down

0 comments on commit 1a5e288

Please sign in to comment.