[Error] can't load such file "../lib/mq_client"
[How] use absolute path
Signed-off-by: Wu Zhende wuzhende666@163.com --- providers/docker/docker.rb | 4 +++- providers/multi-qemu | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/providers/docker/docker.rb b/providers/docker/docker.rb index 9d6854f..b372a11 100755 --- a/providers/docker/docker.rb +++ b/providers/docker/docker.rb @@ -3,12 +3,14 @@ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # frozen_string_literal: true
+CCI_SRC = ENV['CCI_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME))) + require 'open-uri' require 'json' require 'set' require 'fileutils'
-require '../lib/mq_client' +require "#{CCI_SRC}/lib/mq_client" require_relative '../../container/defconfig'
BASE_DIR = '/srv/dc' diff --git a/providers/multi-qemu b/providers/multi-qemu index d3f8406..70675d1 100755 --- a/providers/multi-qemu +++ b/providers/multi-qemu @@ -3,11 +3,13 @@ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # frozen_string_literal: true
+CCI_SRC = ENV['CCI_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME))) + require 'fileutils' require 'optparse' require 'json'
-require '../lib/mq_client' +require "#{CCI_SRC}/lib/mq_client"
opt = {} options = OptionParser.new do |opts|
On Wed, Mar 24, 2021 at 10:42:14AM +0800, Wu Zhende wrote:
[Error] can't load such file "../lib/mq_client"
[How] use absolute path
Signed-off-by: Wu Zhende wuzhende666@163.com
providers/docker/docker.rb | 4 +++- providers/multi-qemu | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/providers/docker/docker.rb b/providers/docker/docker.rb index 9d6854f..b372a11 100755 --- a/providers/docker/docker.rb +++ b/providers/docker/docker.rb @@ -3,12 +3,14 @@ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. # frozen_string_literal: true
+CCI_SRC = ENV['CCI_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))
require 'open-uri' require 'json' require 'set' require 'fileutils'
-require '../lib/mq_client' +require "#{CCI_SRC}/lib/mq_client" require_relative '../../container/defconfig'
If you use absolute path, why not change all above to absolute path? One is absolute path, another is relative, that's strange.
Thanks, Yuanchao