Skip to content

Commit

Permalink
fix: NoneType (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
shini4i authored Jul 4, 2022
1 parent d2fadb1 commit 19fe4d6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.1] - 2022-07-04
### Fixed
- TypeError: argument of type 'NoneType' is not iterable in _find_sealed_secrets_controller

## [0.3.0] - 2022-07-01
### Added
- Support for SealedSecrets controller encryption secret backup
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kubeseal-auto"
version = "0.3.0"
version = "0.3.1"
description = "An interactive wrapper for kubeseal binary"
authors = ["Vadim Gedz <[email protected]>"]
license = "MIT"
Expand Down
14 changes: 9 additions & 5 deletions src/kubeseal_auto/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,22 @@ def _find_sealed_secrets_controller() -> dict:

expected_label = "app.kubernetes.io/instance"

for deployment in client.AppsV1Api().list_deployment_for_all_namespaces().items:
if (
expected_label in deployment.metadata.labels
and deployment.metadata.labels[expected_label] == "sealed-secrets"
):
for deployment in (
client.AppsV1Api()
.list_deployment_for_all_namespaces(label_selector=expected_label)
.items
):
if deployment.metadata.labels[expected_label] == "sealed-secrets":
name = deployment.metadata.labels[expected_label]
namespace = deployment.metadata.namespace
click.echo(
f"===> Found the following controller: {Fore.CYAN}{namespace}/{name}"
)
return {"name": name, "namespace": namespace}

click.echo("===> No controller found")
exit(1)

def find_latest_sealed_secrets_controller_certificate(self) -> str:
res = client.CoreV1Api().list_namespaced_secret(
self.controller.get("namespace")
Expand Down

0 comments on commit 19fe4d6

Please sign in to comment.