Skip to content

Commit 899ecac

Browse files
committed
v0.9.1
1 parent 0ea0b32 commit 899ecac

File tree

4 files changed

+46
-29
lines changed

4 files changed

+46
-29
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
- [Changelog](#changelog)
4+
- [v0.9.1](#v091)
45
- [v0.9.0](#v090)
56
- [v0.8.0](#v080)
67
- [v0.7.0](#v070)
@@ -13,6 +14,15 @@
1314

1415
---
1516

17+
## [v0.9.1](https://github.com/DaemonDude23/helmizer/releases/tag/v0.9.1)
18+
19+
November 11 2021
20+
21+
**Bugfixes**
22+
23+
- Fixed `kustomization.yaml` not being written to disk... wtf?
24+
- Fixed config property `sort-keys` being unenforced.
25+
1626
## [v0.9.0](https://github.com/DaemonDude23/helmizer/releases/tag/v0.9.0)
1727

1828
November 7 2021

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The `sealed-secrets` **Helm** chart is used for examples for its small scope.
104104
For local installation/use of the raw script, I use a local virtual environment to isolate dependencies:
105105

106106
```bash
107-
git clone https://github.com/DaemonDude23/helmizer.git -b v0.9.0
107+
git clone https://github.com/DaemonDude23/helmizer.git -b v0.9.1
108108
cd helmizer
109109
```
110110

@@ -189,7 +189,7 @@ In this example (*Nix OS), we're redirecting program output to the (e.g. `kustom
189189
docker run --name helmizer \
190190
--rm \
191191
-v "$PWD"/examples:/tmp/helmizer -w /tmp/helmizer \
192-
docker.pkg.github.com/DaemonDude23/helmizer/helmizer:v0.9.0 /usr/src/app/helmizer.py \
192+
docker.pkg.github.com/DaemonDude23/helmizer/helmizer:v0.9.1 /usr/src/app/helmizer.py \
193193
./resources/ > ./examples/resources/kustomization.yaml
194194
```
195195

examples/generatorOptions/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ generatorOptions:
55
labels:
66
kustomize.generated.resources: bla-bla
77
kind: Kustomization
8-
namespace: default

src/helmizer.py

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ def __init__(self, helmizer_config, arguments):
6868
pass
6969

7070
def sort_keys(self):
71-
try:
72-
self.helmizer_config["helmizer"]["sort-keys"].get(bool)
73-
for array in ["crds", "components", "patchesStrategicMerge", "resources"]:
74-
self.yaml[array].sort()
75-
except KeyError:
76-
pass
71+
self.helmizer_config["helmizer"]["sort-keys"].get(bool)
72+
for key in ["crds", "components", "patchesStrategicMerge", "resources"]:
73+
try:
74+
self.yaml[key].sort()
75+
except KeyError:
76+
pass
77+
logging.debug("keys sorted")
78+
7779

7880
def print_kustomization(self):
7981
try:
@@ -83,29 +85,35 @@ def print_kustomization(self):
8385

8486
def write_kustomization(self, arguments):
8587
try:
86-
if self.helmizer_config["helmizer"]["dry-run"].get(bool) or arguments.dry_run:
88+
if arguments.dry_run:
89+
logging.debug("Performing dry-run, not writing to a file system")
90+
return 0
91+
elif self.helmizer_config["helmizer"]["dry-run"].get(bool):
8792
logging.debug("Performing dry-run, not writing to a file system")
93+
return 0
8894
except NotFoundError:
89-
# identify kustomization file's parent directory
90-
str_kustomization_directory = path.dirname(path.abspath(path.normpath(arguments.helmizer_config)))
95+
pass
9196

92-
# identify kustomization file name
93-
str_kustomization_file_name = str()
94-
try:
95-
str_kustomization_file_name = self.helmizer_config["helmizer"]["kustomization-file-name"].get(str)
96-
except NotFoundError:
97-
str_kustomization_file_name = "kustomization.yaml"
97+
# identify kustomization file's parent directory
98+
str_kustomization_directory = path.dirname(path.abspath(path.normpath(arguments.helmizer_config)))
9899

99-
# write to file
100-
try:
101-
kustomization_file_path = path.normpath(f"{str_kustomization_directory}/{str_kustomization_file_name}")
102-
with open(kustomization_file_path, "w") as file:
103-
file.write(yaml.dump(self.yaml))
104-
logging.debug(f"Successfully wrote to file: {path.abspath(kustomization_file_path)}")
105-
except IsADirectoryError as e:
106-
raise e
107-
except TypeError:
108-
pass
100+
# identify kustomization file name
101+
str_kustomization_file_name = str()
102+
try:
103+
str_kustomization_file_name = self.helmizer_config["helmizer"]["kustomization-file-name"].get(str)
104+
except NotFoundError:
105+
str_kustomization_file_name = "kustomization.yaml"
106+
107+
# write to file
108+
try:
109+
kustomization_file_path = path.normpath(f"{str_kustomization_directory}/{str_kustomization_file_name}")
110+
with open(kustomization_file_path, "w") as file:
111+
file.write(yaml.dump(self.yaml))
112+
logging.debug(f"Successfully wrote to file: {path.abspath(kustomization_file_path)}")
113+
except IsADirectoryError as e:
114+
raise e
115+
except TypeError:
116+
pass
109117

110118
def render_template(self, arguments):
111119
logging.debug("Rendering template")
@@ -318,7 +326,7 @@ def init_arg_parser():
318326
help="quiet output from subprocesses",
319327
default=False,
320328
)
321-
args.add_argument("--version", "-v", action="version", version="v0.9.0")
329+
args.add_argument("--version", "-v", action="version", version="v0.9.1")
322330
args.add_argument(
323331
"helmizer_config",
324332
action="store",

0 commit comments

Comments
 (0)