Signed-off-by: Wu Zhende wuzhende666@163.com --- container/defconfig.rb | 5 ++++- container/defconfig.sh | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.rb b/container/defconfig.rb index 0a8e4d5..ba0e230 100755 --- a/container/defconfig.rb +++ b/container/defconfig.rb @@ -23,7 +23,10 @@ def relevant_defaults(names) end
def relevant_service_authentication(names) - hash = YAML.load_file('/etc/compass-ci/passwd.yaml') || {} + file_name = '/etc/compass-ci/passwd.yaml' + return {} unless File.exist?(file_name) + + hash = YAML.load_file(file_name) || {} hash.select { |k, _| names.include? k } end
diff --git a/container/defconfig.sh b/container/defconfig.sh index 64a434f..c217d5f 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -23,7 +23,9 @@ load_cci_defaults() load_service_authentication() { shopt -s nullglob - create_yaml_variables '/etc/compass-ci/passwd.yaml' + file_name='/etc/compass-ci/passwd.yaml' + [ -f $file_name ] || return + create_yaml_variables $file_name }
docker_rm()