@click.pass_context
def cluster_get_kubeconfig(ctx, name, **kwargs):
"""Alias for the cluster-get-credentials command"""
- ctx.invoke(cluster_get_credentials, name=name)
+ logger.debug("")
+ ctx.forward(cluster_get_credentials)
@click.command(name="cluster-register", short_help="registers a K8s cluster to OSM")
logger.debug("")
hostname = ctx.parent.params.get("hostname") if ctx.parent else None
if not hostname:
- raise click.UsageError(
- "This command requires --hostname or OSM_HOSTNAME to be set."
+ # Also check the parent of the parent in case of nested commands
+ # e.g., in 'osm cluster-get-kubeconfig'
+ hostname2 = (
+ ctx.parent.parent.params.get("hostname") if ctx.parent.parent else None
)
+ if not hostname2:
+ raise click.UsageError(
+ "This command requires --hostname or OSM_HOSTNAME to be set."
+ )
return ctx.invoke(command, *args, **kwargs)
return wrapper