0

I am using run commands to execute bash scripts via the Azure CLI bash scripts in RHEL 7 VM.

I am getting an error when there is a snippet of the run command:

   az vm run-command invoke --name ${THIS_VM_NAME} \
            --command-id RunShellScript \
            --resource-group ${RSC_GRP_NAME} \
            --query "output[].message | join('\n\n', @)" \
            --scripts "
cat > /etc/init.d/parity <<'EOF'
${INIT_D_PARITY}
exit 0
EOF

chmod +x /etc/init.d/parity

service parity restart

sleep 5

ls -la /var/log/parity.err
ls -la /var/log/parity.log
ls -la /var/log/parity.node.log

echo '_____________________________________________'
echo 'Parity Error Log:'
tail -n 5 /var/log/parity.err
echo '_____________________________________________'

ls -la /usr/libs/libssl*

parity -v

cat /var/log/parity.node.log | grep -oEi '(enode.*@)' | tail -n 1 | sed 's/enode:\/\///' | sed 's/@.*//' > /etc/parity/enode.pub

ls -la /etc/init.d/parity
ls -la /etc/parity/enode.pub

cat /etc/parity/enode.pub
echo 'Parity is Up an running \o/'
" 

Here is the error message:

In function join(), invalid type for value: None, expected one of: ['array-string'], received: "null" Traceback (most recent call last):

Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48
0xsegfault
  • 2,899
  • 6
  • 28
  • 58

1 Answers1

0

The join() is a function of JMESPath that a query language for JSON. Here is an easy example:

Array:

{
  "locations": [
    {"name": "Seattle", "state": "WA"},
    {"name": "New York", "state": "NY"},
    {"name": "Bellevue", "state": "WA"},
    {"name": "Olympia", "state": "WA"}
  ]
}

Query code:

locations[?state == 'WA'].name | sort(@) | {WashingtonCities: join(', ', @)}

Result:

{
  "WashingtonCities": "Bellevue, Olympia, Seattle"
}

For your issue, you can get the details from this link. I think if the output is an array then the function join() will work well. If not, the error as same as you got will come.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Charles Xu
  • 29,862
  • 2
  • 22
  • 39