Signed-off-by: Li Xiaoming <[email protected]>
---
 classes/fossology-rest.bbclass | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/classes/fossology-rest.bbclass b/classes/fossology-rest.bbclass
index 48e16f3..000eefe 100644
--- a/classes/fossology-rest.bbclass
+++ b/classes/fossology-rest.bbclass
@@ -25,6 +25,8 @@ HOSTTOOLS_NONFATAL += "curl"
 
 CREATOR_TOOL = "fossology-rest.bbclass in meta-spdxscanner"
 
+NO_PROXY = "localhost, 127.0.0.1"
+
 # If ${S} isn't actually the top-level source directory, set SPDX_S to point at
 # the real top-level directory.
 SPDX_S ?= "${S}"
@@ -159,7 +161,7 @@ def get_folder_id_by_name(d, folder_name):
 
     rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/folders" \
                    + " -H \"Authorization: Bearer " + token + "\"" \
-                   + " --noproxy 127.0.0.1"
+                   + " --noproxy " + NO_PROXY
     bb.note("Invoke rest_api_cmd = " + rest_api_cmd )
     try:
         all_folder = subprocess.check_output(rest_api_cmd, 
stderr=subprocess.STDOUT, shell=True)
@@ -200,7 +202,7 @@ def create_folder(d, folder_name):
                    + " -H \'parentFolder: 1\'" \
                    + " -H \'folderName: " + folder_name + "\'" \
                    + " -H \"Authorization: Bearer " + token + "\"" \
-                   + " --noproxy 127.0.0.1"
+                   + " --noproxy " + NO_PROXY
     bb.note("Invoke rest_api_cmd = " + rest_api_cmd)
     try:
         add_folder = subprocess.check_output(rest_api_cmd, 
stderr=subprocess.STDOUT, shell=True)
@@ -251,7 +253,7 @@ def has_upload(d, tar_file, folder_id):
 
     rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/uploads" \
                    + " -H \"Authorization: Bearer " + token + "\"" \
-                   + " --noproxy 127.0.0.1"
+                   + " --noproxy " + NO_PROXY
     bb.note("Invoke rest_api_cmd = " + rest_api_cmd )
         
     try:
@@ -302,7 +304,7 @@ def upload(d, tar_file, folder):
                     + " -H \'public: public\'"  \
                     + " -H \'Content-Type: multipart/form-data\'"  \
                     + " -F \'fileInput=@\"" + tar_file + 
"\";type=application/octet-stream\'" \
-                    + " --noproxy 127.0.0.1"
+                    + " --noproxy " + NO_PROXY
     bb.note("Upload : Invoke rest_api_cmd = " + rest_api_cmd )
     while i < 10:
         time.sleep(delaytime)
@@ -343,7 +345,7 @@ def analysis(d, folder_id, upload_id):
                     + " -H \"Authorization: Bearer " + token + "\"" \
                     + " -H \'Content-Type: application/json\'" \
                     + " --data \'{\"analysis\": {\"bucket\": 
true,\"copyright_email_author\": true,\"ecc\": true, \"keyword\": 
true,\"mime\": true,\"monk\": true,\"nomos\": true,\"package\": 
true},\"decider\": {\"nomos_monk\": true,\"bulk_reused\": true,\"new_scanner\": 
true}}\'" \
-                    + " --noproxy 127.0.0.1"
+                    + " --noproxy " + NO_PROXY
     bb.note("Analysis : Invoke rest_api_cmd = " + rest_api_cmd )
     while i < 10:
         try:
@@ -389,7 +391,7 @@ def trigger(d, folder_id, upload_id):
                     + " -H \"Authorization: Bearer " + token + "\"" \
                     + " -H \"uploadId: " + str(upload_id) + "\"" \
                     + " -H \'reportFormat: spdx2tv\'" \
-                    + " --noproxy 127.0.0.1"
+                    + " --noproxy " + NO_PROXY
     bb.note("trigger : Invoke rest_api_cmd = " + rest_api_cmd )
     while i < 10:
         time.sleep(delaytime)
@@ -431,7 +433,7 @@ def get_spdx(d, report_id, spdx_file):
     rest_api_cmd = "curl -k -s -S -X GET " + server_url + "/api/v1/report/" + 
report_id \
                     + " -H \'accept: text/plain\'" \
                     + " -H \"Authorization: Bearer " + token + "\"" \
-                    + " --noproxy 127.0.0.1"
+                    + " --noproxy " + NO_PROXY
     bb.note("get_spdx : Invoke rest_api_cmd = " + rest_api_cmd )
     while i < 10:
         time.sleep(delaytime)
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#48984): https://lists.yoctoproject.org/g/yocto/message/48984
Mute This Topic: https://lists.yoctoproject.org/mt/72646545/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to