From a98a3ba6ec3f3c64e9a474c6e10d0c6212bf822d Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Thu, 31 May 2018 11:39:15 +0100 Subject: [PATCH 1/4] Added reclass v1.5.3 as a git submodule --- .gitmodules | 3 +++ kapitan/__init__.py | 6 ++++++ reclass | 1 + requirements.txt | 3 --- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 reclass diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..c53307dab --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "reclass"] + path = reclass + url = git://github.com/salt-formulas/reclass.git diff --git a/kapitan/__init__.py b/kapitan/__init__.py index b1cfe3ee4..f1296b0fa 100755 --- a/kapitan/__init__.py +++ b/kapitan/__init__.py @@ -13,3 +13,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +import os +import sys + +# Adding reclass to PYTHONPATH +sys.path.insert(0, os.path.dirname(__file__) + "/../reclass") diff --git a/reclass b/reclass new file mode 160000 index 000000000..2652216b7 --- /dev/null +++ b/reclass @@ -0,0 +1 @@ +Subproject commit 2652216b7c9c5963b64f419a58c9974e8ed70565 diff --git a/requirements.txt b/requirements.txt index 06448c333..d6302e70e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,6 @@ jsonnet==0.10.0 PyYAML==3.12 ujson==1.35 Jinja2>=2.10 -# Latest commit from salt-formulas/reclass - develop branch (python3 support) -# TODO: Change commit hash to release tag once develop is merged into master and release is cut -git+https://github.com/salt-formulas/reclass.git@13a2472f#egg=reclass jsonschema>=2.6.0 python-gnupg==0.4.2 six>=1.11.0 From d63df376c5b1c3a2a48f242b57020c9afd2fb687 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Thu, 31 May 2018 11:39:58 +0100 Subject: [PATCH 2/4] Removed deprecated flag from pip install --- README.md | 4 ++-- ci/Dockerfile | 2 +- kapitan/utils.py | 2 +- setup.py | 5 ----- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0466f4e15..d59db5604 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ Kapitan needs Python 3.6. User (`$HOME/.local/lib/python3.6/bin` on Linux or `$HOME/Library/Python/3.6/bin` on macOS): ``` -pip3 install --user --upgrade git+https://github.com/deepmind/kapitan.git --process-dependency-links +pip3 install --user --upgrade git+https://github.com/deepmind/kapitan.git ``` System-wide (not recommended): ``` -sudo pip3 install --upgrade git+https://github.com/deepmind/kapitan.git --process-dependency-links +sudo pip3 install --upgrade git+https://github.com/deepmind/kapitan.git ``` # Example diff --git a/ci/Dockerfile b/ci/Dockerfile index 0051b031b..dee6461e6 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -10,7 +10,7 @@ RUN apk add --no-cache python3-dev git g++ make libstdc++ gnupg musl-dev util-li if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \ rm -rf /root/.cache -RUN pip3 install --upgrade --no-cache-dir git+https://github.com/deepmind/kapitan.git --process-dependency-links +RUN pip3 install --upgrade --no-cache-dir git+https://github.com/deepmind/kapitan.git RUN gcloud components install kubectl diff --git a/kapitan/utils.py b/kapitan/utils.py index 54618d0d8..3c9b22fd2 100644 --- a/kapitan/utils.py +++ b/kapitan/utils.py @@ -291,7 +291,7 @@ def check_version(): print('Last used version (in .kapitan): {}{}\n'.format(dot_kapitan["version"], termcolor.ENDC)) print('Please upgrade kapitan to at least "{}" in order to keep results consistent:\n'.format(dot_kapitan["version"])) print('Docker: docker pull deepmind/kapitan') - print('Pip (user): pip3 install --user --upgrade git+https://github.com/deepmind/kapitan.git --process-dependency-links\n') + print('Pip (user): pip3 install --user --upgrade git+https://github.com/deepmind/kapitan.git\n') print('Check https://github.com/deepmind/kapitan#quickstart for more info.\n') print('If you know what you\'re doing, you can skip this check by adding \'--ignore-version-check\'.') sys.exit(1) diff --git a/setup.py b/setup.py index b741f91da..1a1be1994 100644 --- a/setup.py +++ b/setup.py @@ -35,11 +35,6 @@ def install_deps(): or something like that, so e.g. `-9231` works as well as `1.1.0`. This is ignored by the setuptools, but has to be there. - Warnings: - to make pip respect the links, you have to use - `--process-dependency-links` switch. So e.g.: - `pip install --process-dependency-links {git-url}` - Returns: list of packages and dependency links. """ From 55c5488d19877dd89772bf931c28962538f3eeff Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Thu, 31 May 2018 13:14:07 +0100 Subject: [PATCH 3/4] Cleanup --- .travis.yml | 2 +- requirements.txt | 2 ++ tests/test_compile.py | 2 +- tests/test_inventory.py | 2 ++ tests/test_jinja2.py | 3 +++ tests/test_jsonnet.py | 2 ++ tests/test_secrets.py | 3 +++ 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5f5d0139..6c02614fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ notifications: before_install: - sudo apt-get -qq update - - sudo apt-get install -y gnupg2 git + - sudo apt-get install -y gnupg2 # command to install dependencies install: diff --git a/requirements.txt b/requirements.txt index d6302e70e..35b49900b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,5 @@ python-gnupg==0.4.2 six>=1.11.0 cryptography==2.2.2 requests>=2.18.4 +# Reclass dependencies +pyparsing diff --git a/tests/test_compile.py b/tests/test_compile.py index be2e8ec49..6d5490642 100644 --- a/tests/test_compile.py +++ b/tests/test_compile.py @@ -19,10 +19,10 @@ import unittest import os import sys -import shutil from kapitan.cli import main from kapitan.utils import get_directory_hash + class CompileTest(unittest.TestCase): def setUp(self): os.chdir(os.getcwd() + '/examples/kubernetes/') diff --git a/tests/test_inventory.py b/tests/test_inventory.py index 64a4e6963..02495f8c5 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -15,9 +15,11 @@ # limitations under the License. "inventory tests" + import unittest from kapitan.resources import inventory + class InventoryTargetTest(unittest.TestCase): def test_inventory_target(self): inv = inventory("examples/kubernetes", "minikube-es") diff --git a/tests/test_jinja2.py b/tests/test_jinja2.py index 74a5b1074..144df827d 100644 --- a/tests/test_jinja2.py +++ b/tests/test_jinja2.py @@ -15,11 +15,13 @@ # limitations under the License. "jinja2 tests" + import unittest import tempfile from kapitan.utils import render_jinja2_file from kapitan.resources import inventory + class Jinja2FiltersTest(unittest.TestCase): def test_sha256(self): with tempfile.NamedTemporaryFile() as f: @@ -37,6 +39,7 @@ def test_yaml(self): yaml = '- this\n- that\n' self.assertEqual(render_jinja2_file(f.name, context), yaml) + class Jinja2ContextVars(unittest.TestCase): def test_inventory_context(self): with tempfile.NamedTemporaryFile() as f: diff --git a/tests/test_jsonnet.py b/tests/test_jsonnet.py index f216848c1..62bc29226 100644 --- a/tests/test_jsonnet.py +++ b/tests/test_jsonnet.py @@ -15,9 +15,11 @@ # limitations under the License. "jsonnet tests" + import unittest from kapitan.resources import yaml_dump + class JsonnetNativeFuncsTest(unittest.TestCase): def test_yaml_dump(self): "dump json string to yaml" diff --git a/tests/test_secrets.py b/tests/test_secrets.py index 6503dffbd..1659962a6 100644 --- a/tests/test_secrets.py +++ b/tests/test_secrets.py @@ -15,6 +15,7 @@ # limitations under the License. "secrets tests" + import os import unittest import re @@ -33,6 +34,8 @@ KEY2 = GPG_OBJ.gen_key(GPG_OBJ.gen_key_input(key_type="RSA", key_length=2048, passphrase="testphrase")) + + class SecretsTest(unittest.TestCase): "Test secrets" def test_secret_token_attributes(self): From 6537f76ee4b6d68013479a8c51c3695a5ac2a8d8 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Thu, 31 May 2018 13:34:11 +0100 Subject: [PATCH 4/4] Removed unsupported python versions --- setup.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.py b/setup.py index 1a1be1994..a2d4eadda 100644 --- a/setup.py +++ b/setup.py @@ -74,9 +74,6 @@ def install_deps(): 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6' ],