Skip to content

Commit

Permalink
Merge pull request #146 from bradmwilliams/ocp-2.0.0
Browse files Browse the repository at this point in the history
Preparing version 2.0.0
  • Loading branch information
openshift-merge-bot[bot] committed Jan 31, 2024
2 parents f523fd8 + 8b4218d commit f57420f
Show file tree
Hide file tree
Showing 36 changed files with 50 additions and 41 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Can you run `oc project` successfully from the command line? Then write your app

```python
#!/usr/bin/python
import openshift as oc
import openshift_client as oc
print('OpenShift client version: {}'.format(oc.get_client_version()))
print('OpenShift server version: {}'.format(oc.get_server_version()))
Expand Down Expand Up @@ -304,7 +304,7 @@ process -- it will consume memory for every oc invocation.*
```python
#!/usr/bin/python
import openshift as oc
import openshift_client as oc
with oc.tracking() as tracker:
try:
Expand Down Expand Up @@ -382,7 +382,7 @@ the current oc invocation will be killed.
```python
#!/usr/bin/python
import openshift as oc
import openshift_client as oc
def node_is_ready(node):
ready = node.model.status.conditions.can_match({
Expand Down Expand Up @@ -448,7 +448,7 @@ context. Before running this command, you will need to load your ssh agent up wi
appropriate to the target client host.
```python
with openshift.client_host(hostname="my.cluster.com", username="root", auto_add_host=True):
with openshift_client.client_host(hostname="my.cluster.com", username="root", auto_add_host=True):
# oc invocations will take place on my.cluster.com host as the root user.
print("Current project: " + oc.get_project_name())
```
Expand Down
2 changes: 1 addition & 1 deletion ansible/rebuild_module.digest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2800ec0e827b83a8423e15704e7699f -
e636ef96934d7b577b5cb42f65904f20 -
4 changes: 2 additions & 2 deletions ansible/rebuild_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ fi

pushd "$PACKAGES_DIR"
# Update module digest so that pr.groovy can ensure it is run after each module change
cat $(find openshift/ -name '*.py' | sort -d) | md5sum > $DIR/rebuild_module.digest
ENCODED_TGZ=$(tar c --owner=0 --numeric-owner --group=0 --mtime='UTC 2019-01-01' $(find openshift/ -name '*.py' | sort -d) | gzip -c -n | base64 --wrap=0)
cat $(find openshift_client/ -name '*.py' | sort -d) | md5sum > $DIR/rebuild_module.digest
ENCODED_TGZ=$(tar c --owner=0 --numeric-owner --group=0 --mtime='UTC 2019-01-01' $(find openshift_client/ -name '*.py' | sort -d) | gzip -c -n | base64 --wrap=0)
popd

echo "#!/usr/bin/env python" > $OUTPUT_FILE
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

# Allows modules to trigger errors
def error(msg, **kwargs):
import openshift as oc
import openshift_client as oc
raise oc.OpenShiftPythonException(msg, **kwargs)


def main():
import openshift as oc
import openshift_client as oc
script = module.params["script"]
time = module.params["timeout"]
oc.ansible.reset()
Expand Down Expand Up @@ -91,9 +91,9 @@ def main():
tf.extractall(client_python_extract_dir)
# Add the newly extacted directory to the python path to resolve the openshift package
sys.path.append(client_python_extract_dir)
# Import openshift as oc so that we can delete the extract directory. module.exit_ type methods
# Import openshift_client as oc so that we can delete the extract directory. module.exit_ type methods
# call sys.exit, so this is our only chance to leave no trace.
import openshift as oc
import openshift_client as oc
shutil.rmtree(client_python_extract_dir)
main()
finally:
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
import traceback

import openshift as oc
import openshift_client as oc
from contextlib import contextmanager


Expand Down
4 changes: 2 additions & 2 deletions examples/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import print_function
from __future__ import absolute_import

import openshift as oc
from openshift import null, Missing, OpenShiftPythonException
import openshift_client as oc
from openshift_client import null, Missing, OpenShiftPythonException

try:

Expand Down
4 changes: 2 additions & 2 deletions examples/custom_apiobjects.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import openshift as oc
from openshift import APIObject
import openshift_client as oc
from openshift_client import APIObject


class MyCustomPodClass(APIObject):
Expand Down
2 changes: 1 addition & 1 deletion examples/dump.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

from __future__ import absolute_import
import openshift as oc
import openshift_client as oc

if __name__ == '__main__':
with oc.client_host():
Expand Down
6 changes: 3 additions & 3 deletions examples/ephemeral_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import argparse
import logging
import traceback
import openshift as oc
from openshift import OpenShiftPythonException
from openshift.decorators import ephemeral_project
import openshift_client as oc
from openshift_client import OpenShiftPythonException
from openshift_client.decorators import ephemeral_project

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('EphemeralProject')
Expand Down
4 changes: 2 additions & 2 deletions examples/exception_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import argparse
import logging
import traceback
import openshift as oc
from openshift import OpenShiftPythonException
import openshift_client as oc
from openshift_client import OpenShiftPythonException

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('ExceptionTracking')
Expand Down
4 changes: 2 additions & 2 deletions examples/oc_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from __future__ import print_function
from __future__ import absolute_import

from openshift import Result
import openshift as oc
from openshift_client import Result
import openshift_client as oc

'''
This example illustrates how you can utilize the "oc_action" method to perform any "oc" operations that are not
Expand Down
2 changes: 1 addition & 1 deletion examples/report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

from __future__ import absolute_import
import openshift as oc
import openshift_client as oc

if __name__ == '__main__':
with oc.client_host():
Expand Down
2 changes: 1 addition & 1 deletion examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import print_function
from __future__ import absolute_import
import openshift as oc
import openshift_client as oc

if __name__ == '__main__':
with oc.tracking() as tracker:
Expand Down
2 changes: 1 addition & 1 deletion examples/templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

import openshift as oc
import openshift_client as oc

'''
This example will scan all the templates, on the cluster, and look specifically for the openshift/nginx-example
Expand Down
4 changes: 2 additions & 2 deletions packages/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import print_function
from __future__ import absolute_import
import openshift as oc
from openshift import Missing
import openshift_client as oc
from openshift_client import Missing
import traceback

with oc.tracking() as t:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .ansible import ansible

# Single source for module version
__VERSION__ = '1.0.20'
__VERSION__ = '2.0.0'

null = None # Allow scripts to specify null in object definitions

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

import openshift as oc
import openshift_client as oc
import base64
import json

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from openshift import Context
from openshift_client import Context
from .apiobject import APIObject


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 10 additions & 1 deletion run_unittests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,14 @@ SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]:-$0}")

export PYTHONPATH="${SCRIPT_ROOT}/packages"
cd ${SCRIPT_ROOT}/packages
python2 -m unittest discover

if command -v python2 > /dev/null
then
echo "python2: running unit tests"
python2 -m unittest discover
else
echo "python2 not detected. Skipping"
fi

echo "python3: running unit tests"
python3 -m unittest discover
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def read(rel_path):


def get_version(rel_path):
"""Returns the semantic version for the openshift-client module."""
"""Returns the semantic version for the openshift_client module."""
for line in read(rel_path).splitlines():
if line.startswith('__VERSION__'):
delim = '"' if '"' in line else "'"
Expand All @@ -35,7 +35,7 @@ def get_version(rel_path):

setup(
name="openshift-client",
version=get_version('packages/openshift/__init__.py'),
version=get_version('packages/openshift_client/__init__.py'),
author="Justin Pierce",
author_email="jupierce@redhat.com",
maintainer="Brad Williams",
Expand Down Expand Up @@ -63,6 +63,6 @@ def get_version(rel_path):
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.12",
],
)

0 comments on commit f57420f

Please sign in to comment.