Skip to content

Commit

Permalink
fix: Improve a few error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Jan 5, 2022
1 parent ca83023 commit de92008
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion kluctl/deployment/kustomize_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from kluctl.deployment.helm_chart import HelmChart
from kluctl.seal.deployment_sealer import SEALME_EXT
from kluctl.utils.dict_utils import merge_dict
from kluctl.utils.exceptions import CommandError
from kluctl.utils.exceptions import CommandError, InvalidKluctlProjectConfig
from kluctl.utils.external_tools import get_external_tool_hash
from kluctl.utils.k8s_object_utils import get_object_ref, should_remove_namespace
from kluctl.utils.kustomize import kustomize_build
Expand Down Expand Up @@ -34,6 +34,9 @@ def __init__(self, deployment_project, deployment_collection, config, dir, index
self.index = index
self.objects = []

if dir and not os.path.isdir(dir):
raise InvalidKluctlProjectConfig("kustomizeDir does not exist: %s" % dir)

def get_rel_kustomize_dir(self):
root_project = self.deployment_project.get_root_deployment()
return os.path.relpath(self.dir, root_project.dir)
Expand Down
2 changes: 1 addition & 1 deletion kluctl/utils/k8s_cluster_real.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, context, dry_run):
raise CommandError(str(e))

if self.context != "docker-desktop" and not self.config.api_key and not self.config.key_file:
raise CommandError("No authentication available. You might need to invoke kubectl first to perform a login")
raise CommandError("No authentication available for kubernetes context %s. You might need to invoke kubectl first to perform a login" % self.context)

self.api_client = ApiClient(configuration=self.config)
self.dynamic_client = DynamicClient(self.api_client, discoverer=MyDiscoverer)
Expand Down

0 comments on commit de92008

Please sign in to comment.