Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
16 changes: 9 additions & 7 deletions getdeck/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
os.environ["PYOXIDIZER"] = "1"

logger = logging.getLogger("deck")

ARGUMENT_DECKFILE_HELP = "the deck.yaml location (as file, git or https)"


parser = argparse.ArgumentParser(
prog="deck",
description="The Deck CLI. For more help please visit: https://getdeck.dev",
Expand All @@ -19,7 +23,7 @@
# list all decks of the given deck.yaml
list_parser = action.add_parser("list")
list_parser.add_argument(
"Deckfile", help="the deck.yaml location (as file, git or https)"
"Deckfile", help=ARGUMENT_DECKFILE_HELP, nargs="?", default="."
)

# rollout the cluster and install the deck from the given deck.yaml
Expand Down Expand Up @@ -59,9 +63,7 @@ def check_positive(value):
type=check_positive,
required=False,
)
get_parser.add_argument(
"Deckfile", help="the deck.yaml location (as file, git or https)"
)
get_parser.add_argument("Deckfile", help=ARGUMENT_DECKFILE_HELP, nargs="?", default=".")

remove_parser = action.add_parser("remove")
remove_parser.add_argument(
Expand All @@ -82,7 +84,7 @@ def check_positive(value):
required=False,
)
remove_parser.add_argument(
"Deckfile", help="the deck.yaml location (as file, git or https)"
"Deckfile", help=ARGUMENT_DECKFILE_HELP, nargs="?", default="."
)

stop_parser = action.add_parser("stop")
Expand All @@ -94,7 +96,7 @@ def check_positive(value):
required=False,
)
stop_parser.add_argument(
"Deckfile", help="the deck.yaml location (as file, git or https)"
"Deckfile", help=ARGUMENT_DECKFILE_HELP, nargs="?", default="."
)

version_parser = action.add_parser("version")
Expand All @@ -103,7 +105,7 @@ def check_positive(value):
hosts_parser = action.add_parser("hosts")
hosts_parser.add_argument("host_action", help="list/write/remove")
hosts_parser.add_argument(
"Deckfile", help="the deck.yaml location (as file, git or https)"
"Deckfile", help=ARGUMENT_DECKFILE_HELP, nargs="?", default="."
)
hosts_parser.add_argument(
"--name", help="the Deck whose hosts will be considered", required=False
Expand Down
2 changes: 1 addition & 1 deletion getdeck/api/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@stopwatch
def get_available_decks(deckfile_location: str) -> List:
data_aux = fetch_data(deckfile_location)
data_aux = fetch_data(deckfile_location, fetch_sources=False)
available_decks = data_aux.deckfile.get_decks()
del data_aux

Expand Down
2 changes: 1 addition & 1 deletion getdeck/fetch/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def fetch_data(
file = os.path.join(data_aux.deckfile_aux.path, data_aux.deckfile_aux.name)
if not os.path.isfile(file):
del data_aux
raise RuntimeError(f"Cannot identify {location} as Deckfile")
raise RuntimeError(f"Cannot identify Deckfile at location: '{location}'")

deckfile = deckfile_selector.get(file)
data_aux.deckfile = deckfile
Expand Down
40 changes: 40 additions & 0 deletions test/deckfile/deck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "1"

cluster:
provider: k3d
minVersion: 4.0.0
name: test-empty-file
nativeConfig:
apiVersion: k3d.io/v1alpha4
kind: Simple
servers: 1
agents: 1
image: rancher/k3s:v1.22.9-k3s1
options:
k3s:
extraArgs:
- arg: --disable=traefik
nodeFilters:
- server:*
ports:
- port: 61346:80
nodeFilters:
- loadbalancer
- port: 8443:443
nodeFilters:
- loadbalancer
- port: 31820:31820/UDP
nodeFilters:
- agent:0

decks:
- name: empty
namespace: default
sources:
- type: inline
content:
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": { "name": "content", "labels": { "name": "content" } },
}