Open
Description
Bashly Version
Latest Docker Image
Description
After upgrading to latest docker image 1.2.12, my commands using https://github.com/DannyBen/bashly/blob/444eea2e14e71eb8efa00c5b1f665f8c8dba5637/lib/bashly/libraries/validations/validate_not_empty.sh is no longer working, I think due to #629
I have a command with
- name: exec
group: Container
help: |-
🪄 Execute command in a container
flags:
- *container
- long: --command
required: true
validate: not_empty
arg: command
help: |-
📲 Command to execute
playground container exec --command "yum -y install libaio"
fails with error 1
with set -x I see:
+ declare -g version=1.0.0
+ set -e
+ run container exec --command 'yum -y install libaio'
+ declare -g long_usage=
+ args=()
+ declare -g -A args
+ other_args=()
+ declare -g -a other_args
+ deps=()
+ declare -g -A deps
+ env_var_names=()
+ declare -g -a env_var_names
+ input=()
+ declare -g -a input
+ unique_lookup=()
+ declare -g -A unique_lookup
+ normalize_input container exec --command 'yum -y install libaio'
+ local arg passthru flags
+ passthru=false
+ [[ 4 -gt 0 ]]
+ arg=container
+ [[ false == true ]]
+ [[ container =~ ^(--[a-zA-Z0-9_-]+)=(.+)$ ]]
+ [[ container =~ ^(-[a-zA-Z0-9])=(.+)$ ]]
+ [[ container =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]
+ [[ container == \-\- ]]
+ input+=("$arg")
+ shift
+ [[ 3 -gt 0 ]]
+ arg=exec
+ [[ false == true ]]
+ [[ exec =~ ^(--[a-zA-Z0-9_-]+)=(.+)$ ]]
+ [[ exec =~ ^(-[a-zA-Z0-9])=(.+)$ ]]
+ [[ exec =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]
+ [[ exec == \-\- ]]
+ input+=("$arg")
+ shift
+ [[ 2 -gt 0 ]]
+ arg=--command
+ [[ false == true ]]
+ [[ --command =~ ^(--[a-zA-Z0-9_-]+)=(.+)$ ]]
+ [[ --command =~ ^(-[a-zA-Z0-9])=(.+)$ ]]
+ [[ --command =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]
+ [[ --command == \-\- ]]
+ input+=("$arg")
+ shift
+ [[ 1 -gt 0 ]]
+ arg='yum -y install libaio'
+ [[ false == true ]]
+ [[ yum -y install libaio =~ ^(--[a-zA-Z0-9_-]+)=(.+)$ ]]
+ [[ yum -y install libaio =~ ^(-[a-zA-Z0-9])=(.+)$ ]]
+ [[ yum -y install libaio =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]
+ [[ yum -y install libaio == \-\- ]]
+ input+=("$arg")
+ shift
+ [[ 0 -gt 0 ]]
+ parse_requirements container exec --command 'yum -y install libaio'
+ [[ 4 -gt 0 ]]
+ key=container
+ case "$key" in
+ break
+ missing_deps=
+ command -v docker
++ command -v docker
++ head -n1
+ deps['docker']=/usr/local/bin/docker
+ [[ -n '' ]]
+ action=container
+ case $action in
+ action=container
+ shift
+ playground_container_parse_requirements exec --command 'yum -y install libaio'
+ [[ 3 -gt 0 ]]
+ key=exec
+ case "$key" in
+ break
+ action=exec
+ case $action in
+ action=exec
+ shift
+ playground_container_exec_parse_requirements --command 'yum -y install libaio'
+ [[ 2 -gt 0 ]]
+ key=--command
+ case "$key" in
+ break
+ action='container exec'
+ [[ 2 -gt 0 ]]
+ key=--command
+ case "$key" in
+ [[ -n x ]]
+ args['--command']='yum -y install libaio'
+ shift
+ shift
+ [[ 0 -gt 0 ]]
+ [[ -z x ]]
+ [[ -n '' ]]
+ args['--container']=connect
+ [[ -n '' ]]
+ args['--shell']=bash
+ [[ -v args[--command] ]]
++ validate_not_empty 'yum -y install libaio'
++ [[ -z yum -y install libaio ]]
+ validation_output=
Contents of bashly.yml
- name: exec
group: Container
help: |-
🪄 Execute command in a container
flags:
- *container
- long: --command
required: true
validate: not_empty
arg: command
help: |-
📲 Command to execute
Reproduction Steps
Use a flag with validate: not_empty
Actual Behavior
command exits with 1
Expected Behavior
command is executed, as before 1.2.12