Skip to content

Commit

Permalink
Merge pull request #112 from deepmind/reclass-import
Browse files Browse the repository at this point in the history
Reclass update and import as submodule
  • Loading branch information
adrianchifor authored May 31, 2018
2 parents c6f2437 + 6537f76 commit 179650d
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "reclass"]
path = reclass
url = git://github.com/salt-formulas/reclass.git
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions kapitan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 1 addition & 1 deletion kapitan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions reclass
Submodule reclass added at 265221
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ 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
cryptography==2.2.2
requests>=2.18.4
# Reclass dependencies
pyparsing
8 changes: 0 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -79,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'
],

Expand Down
2 changes: 1 addition & 1 deletion tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/')
Expand Down
2 changes: 2 additions & 0 deletions tests/test_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_jinja2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_jsonnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions tests/test_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.

"secrets tests"

import os
import unittest
import re
Expand All @@ -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):
Expand Down

0 comments on commit 179650d

Please sign in to comment.