Coverage for appr/formats/helm/chart.py: 38%

# Coverage for appr/formats/helm/chart.py : 38%

## 52 statements 20 run 32 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | from __future__ import absolute_import, division, print_function import tempfile import appr.pack as packager from appr.formats.base import FormatBase from appr.formats.helm.manifest_chart import MANIFEST_FILES, ManifestChart from appr.plugins.helm import Helm import appr.utils as utils class Chart(FormatBase): media_type = "helm" platform = "helm" manifest_file = MANIFEST_FILES def __init__(self, name, version=None, endpoint=None, ssl_verify=True, namespace=None, value_file=None, variables=None, release_name=None, **kwargs): super(Chart, self).__init__(name=name, version=version, endpoint=endpoint, ssl_verify=ssl_verify, **kwargs) self._resources = None helm_opts = [] if namespace: helm_opts += ["--namespace", namespace] if value_file: helm_opts += ["--valueFile", value_file] if variables: for key, var in variables.items(): helm_opts += ["--set", "%s=%s" % (key, var)] if release_name: helm_opts += ['--release', release_name] self.template_opts = helm_opts self._parsed_name = utils.split_package_name(name) self._deploy_name = "%s/%s" % (self._parsed_name['namespace'], self._parsed_name['package']) def deploy(self): pass @property def package(self): if self._package is None: result = self._fetch_package() self._package = packager.ApprPackage(result, b64_encoded=True, skip_prefix="%s/" % self._parsed_name['package']) return self._package def _create_manifest(self): import pdb pdb.set_trace() return ManifestChart(self.package) @property def author(self): return self.manifest['author'] @property def version(self): return self.manifest['version'] @property def description(self): return self.manifest['description'] @property def name(self): return self.manifest['name'] @property def resources(self): if self._resources is None: tmpdir = tempfile.mkdtemp self.package.extract(dest=tmpdir) self._resources = Helm().template(tmpdir, self.template_opts) return self._resources