Closed davidferlay closed 1 month ago
to test: 1) add to %binary_name config.yaml some vars, like
actions:
test:
deep:
string: str
int: 100
bool: true
update your action arg or opt to have new launchr value processor
process:
- processor: launchr.GetConfigValue
options:
path: actions.test.deep.string
Tried with these:
action.yaml:
working_directory: "{{ .current_working_dir }}"
action:
title: SSH Config
descriptions: >
This action generates an SSH configuration file based on the platform nodes available in the Ansible cache file.
The configuration output can be customized using various options such as the SSH user, port, host prefix,
and identity file. This allows for streamlined SSH access to the specified hosts.
options:
- name: user
description: The SSH user to be used for connecting to the nodes (default is root).
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.user
- name: port
description: The SSH port for connections (default is 22).
- name: host-prefix
description: A prefix filter to limit the hosts included in the config to those matching the specified prefix.
- name: identity-file
description: The path to the SSH identity file (default is `~/.ssh/id_rsa`).
image: platform-actions-sshconfig:1.0.0
build:
context: ./
command:
- echo
- "{{.user}}"
- .plasmactl/config.yaml
sshconfig: port: 1337 user: skilld
Renders as:
➜ ./plasmactl platform:sshconfig skilld
➜ ./plasmactl platform:sshconfig --user uservaluefromoption uservaluefromoption
Tested OK with int and string option types
However with bool, when option is not passed to command, default value from action.yaml seem to override the value from config for now:
action.yaml
working_directory: "{{ .current_working_dir }}"
action:
title: SSH Config
descriptions: >
This action generates an SSH configuration file based on the platform nodes available in the Ansible cache file.
The configuration output can be customized using various options such as the SSH user, port, host prefix,
and identity file. This allows for streamlined SSH access to the specified hosts.
options:
- name: user
description: The SSH user to be used for connecting to the nodes (default is root).
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.user
- name: port
description: The SSH port for connections (default is 22).
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.port
- name: secondoption
title: Second option
description: Option to do something
type: boolean
default: false <-------------------- that value overrides the one from config
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.booltest
- name: host-prefix
description: A prefix filter to limit the hosts included in the config to those matching the specified prefix.
- name: identity-file
description: The path to the SSH identity file (default is `~/.ssh/id_rsa`).
image: platform-actions-sshconfig:1.0.0
build:
context: ./
command:
- echo
- "{{.secondoption}}"
.plasmactl/config.yaml
sshconfig:
port: 1337
user: skilld
booltest: true
Renders as :
./plasmactl platform:sshconfig
false
In the same time, when option is passed to command, computed value seem to always be true
:
title: Second option
description: Option to do something
type: boolean
default: false
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.booltest
- name: host-prefix
description: A prefix filter to limit the hosts included in the config to those matching the specified prefix.
- name: identity-file
description: The path to the SSH identity file (default is `~/.ssh/id_rsa`).
image: platform-actions-sshconfig:1.0.0
build:
context: ./
command:
- echo
- "{{.secondoption}}"
- .plasmactl/config.yaml
sshconfig: port: 1337 user: skilld booltest: true
Renders as:
./plasmactl platform:sshconfig --secondoption true true
./plasmactl platform:sshconfig --secondoption false true
Something not ok yet:
I think logic should be : cli option > should override config > should override default
Meaning:
with
action.yaml
working_directory: "{{ .current_working_dir }}"
action:
title: SSH Config
descriptions: >
This action generates an SSH configuration file based on the platform nodes available in the Ansible cache file.
The configuration output can be customized using various options such as the SSH user, port, host prefix,
and identity file. This allows for streamlined SSH access to the specified hosts.
options:
- name: user
description: The SSH user to be used for connecting to the nodes (default is root).
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.user
- name: port
description: The SSH port for connections (default is 22).
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.port
- name: secondoption
title: Second option
description: Option to do something
type: boolean
default: false
process:
- processor: launchr.GetConfigValue
options:
path: sshconfig.booltest
- name: host-prefix
description: A prefix filter to limit the hosts included in the config to those matching the specified prefix.
- name: identity-file
description: The path to the SSH identity file (default is `~/.ssh/id_rsa`).
image: platform-actions-sshconfig:1.0.0
build:
context: ./
command:
- echo
- "{{.secondoption}}"
.plasmactl/config.yaml
sshconfig:
port: 1337
user: skilld
booltest: false
then
➜ ./plasmactl platform:sshconfig
false <----- expected
➜ ./plasmactl platform:sshconfig --secondoption=true
true
➜ ./plasmactl platform:sshconfig --secondoption=false
false
working as expected
Current
.launchrctl/config.yaml
is used to store default values for commandsExpected