eclipse-leda / leda-utils

Convenience scripts for Eclipse Leda quickstart tutorials
https://eclipse-leda.github.io/leda/
Apache License 2.0
5 stars 5 forks source link

sdv-kanto-ctl: How to set insecure_registries #45

Closed mikehaller closed 11 months ago

mikehaller commented 1 year ago

When controlling the configuration file of Eclipse Kanto Container Manager with sdv-kanto-ctl, there is an option to set a primitive value (set-value). However, some of the config entries are arrays, which cannot be set using this command line tool

Example:

sdv-kanto-ctl set-value containers.insecure_registries registry:5000

leads to the incorrect configuration:

{
  "manager": {
    "default_ctrs_stop_timeout": 5
  },
  "log": {
    "log_file": "/var/log/container-management/container-management.log"
  },
  "things": {
    "enable": true
  },
  "deployment": {
    "init_dir": "${KANTO_MANIFESTS_DIR}"
  },
  "containers": {
    "insecure_registries": "registry:5000"
  }
}

Note that the correct configuration would be:

  ...
  "containers": {
    "insecure_registries": [
        "registry:5000"
     ]
  }

Suggest to add a new command to sdv-kanto-ctl to add entries into an array, e.g.

sdv-kanto-ctl add-entry containers.insecure_registries registry:5000

The jq command could look like this:

cat /etc/container-management/config.json | jq '.containers.insecure_registries |= [ "registry:5000" ]' > new-config.json
d-s-e commented 11 months ago

fixed with ef7986894c9320cce4ac256f4d5eaf7fabbe25ca.