diff --git a/config/config.go b/config/config.go index 6cd1096b..a8e64937 100644 --- a/config/config.go +++ b/config/config.go @@ -85,7 +85,7 @@ func Merge(bytes []byte) error { func Export(private, full bool) (string, error) { rawCfg, err := LoadRawConfig(full) - if private { + if !private { rawCfg = filterPrivateKeys(rawCfg) } diff --git a/tests/integration/rostest/test_14_ros_config.py b/tests/integration/rostest/test_14_ros_config.py index 2079ced6..4a05f9f8 100644 --- a/tests/integration/rostest/test_14_ros_config.py +++ b/tests/integration/rostest/test_14_ros_config.py @@ -83,3 +83,21 @@ if [ "$(sudo ros config get rancher.network.dns.search)" == "[] exit 1 fi '''.strip()) + + +def test_ros_export(qemu): + SSH(qemu).check_call(''' +set -x -e + +if sudo ros config export | grep "PRIVATE KEY"; then + exit 1 +fi + +sudo ros config export --private | grep "PRIVATE KEY" + +sudo ros config export --full | grep "udev" +sudo ros config export --private --full | grep "ntp" +sudo ros config export --full | grep "labels" + +sudo ros config export --private --full | grep "PRIVATE KEY" + '''.strip())