Coverage for appr/formats/appr/kubplain.py: 58%

# Coverage for appr/formats/appr/kubplain.py : 58%

## 19 statements 11 run 8 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 | from __future__ import absolute_import, division, print_function import re import yaml from appr.formats.appr.kub import Kub from appr.formats.appr.manifest import Manifest class KubPlain(Kub): media_type = 'kubernetes' platform = "kubernetes" @property def _create_manifest(self): return Manifest(self._deploy_name, self._deploy_version) def add_resources(self, k8s_resources): self.manifest[ 'resources'] = self.manifest.resources + self.create_kub_resources(k8s_resources) def parse_resources(self, concatenated_yaml): yaml_resources = re.split(re.compile(r"^---$", re.M), concatenated_yaml)[1:] resources = [] for yaml_resource in yaml_resources: resources.append(yaml.load(yaml_resource)) self.add_resources(resources) return resources