Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrage committed Aug 5, 2016
1 parent 91386b0 commit f0ff91c
Show file tree
Hide file tree
Showing 12 changed files with 782 additions and 923 deletions.
1 change: 1 addition & 0 deletions atomicapp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
PROVIDER_CA_KEY = "provider-cafile"

K8S_DEFAULT_API = "http://localhost:8080"
OC_DEFAULT_API = "http://localhost:8443"

# Persistent Storage Formats
PERSISTENT_STORAGE_FORMAT = ["ReadWriteOnce", "ReadOnlyMany", "ReadWriteMany"]
Expand Down
4 changes: 4 additions & 0 deletions atomicapp/providers/lib/kubeshift/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from atomicapp.providers.lib.kubeshift.kubernetes import KubeKubernetesClient
from atomicapp.providers.lib.kubeshift.openshift import KubeOpenshiftClient
from atomicapp.providers.lib.kubeshift.exceptions import KubeClientError
from atomicapp.constants import LOGGER_DEFAULT
import logging
Expand All @@ -41,6 +42,9 @@ def __init__(self, config, provider):
if provider is "kubernetes":
self.connection = KubeKubernetesClient(config)
logger.debug("Using Kubernetes Provider KubeClient library")
elif provider is "openshift":
self.connection = KubeOpenshiftClient(config)
logger.debug("Using OpenShift Provider KubeClient library")
else:
raise KubeClientError("No provider by that name.")

Expand Down
4 changes: 2 additions & 2 deletions atomicapp/providers/lib/kubeshift/kubebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get_resources(self, url):

def test_connection(self, url):
self.api.request("get", url)
logger.debug("Connection successfully tested")
logger.debug("Connection successfully tested on URL %s" % url)

@staticmethod
def cert_file(data, key):
Expand Down Expand Up @@ -337,7 +337,7 @@ def _request_method(self, method, url, data):
data (object): object of the data that is being passed (will be converted to json)
'''
if method.lower() == "get":
res = self.api.get(url)
res = self.api.get(url, json=data)
elif method.lower() == "post":
res = self.api.post(url, json=data)
elif method.lower() == "put":
Expand Down
3 changes: 3 additions & 0 deletions atomicapp/providers/lib/kubeshift/kubeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def from_params(api=None, auth=None, ca=None, verify=True):

if ca:
config['clusters'][0]['cluster']['certificate-authority'] = ca

if verify is False:
config['clusters'][0]['cluster']['insecure-skip-tls-verify'] = 'true'
return config

@staticmethod
Expand Down
Loading

0 comments on commit f0ff91c

Please sign in to comment.