AbsaOSS / enceladus

Dynamic Conformance Engine
Apache License 2.0
29 stars 14 forks source link

Import of data into Menas fails on Windows 10 #2129

Closed miroslavpojer closed 1 year ago

miroslavpojer commented 1 year ago

Describe the bug

Upload of json data files failing on curl command when opening json file. Used prepared script import_all.sh Problem in curl parameter -d when defined path to file using @<path>.

Command:

curl -v -X POST 
  "http://localhost:8080/rest_api_war/api/schema/importItem" 
  -H "@/tmp/headers.txt.G7pBq7" 
  -H "Content-Type:application/json" 
  --data @/cygdrive/ .... /data/e2e_tests/data/exports/schemas/std_nf_dy.json

Output:

Warning: Couldn't read data from file
Warning: "/cygdrive/c/Users/ab024LL/absa/git/enceladus/examples/data/e2e_tests/
Warning: data/exports/datasets/uppercaseConfrormanceRule.json", this makes an
Warning: empty POST.
...
Required request body is missing: ....

To Reproduce

Steps to reproduce the behavior OR commands run:

  1. Expected Enceladus app built and running
  2. Run script import_all.sh in your bash environment. (Clink, Cygwin)
  3. Problem occurs, no data imported.

Expected behavior

No error message visible. All data files imported in Menas DB.

Desktop (please complete the following information):

Additional context

Proposal to repair:

    for var in `ls -d ${PWD}/${1}/*`; do
        canonicalPath=$(realpath "${var}")
        fileContent=`cat ${canonicalPath}`                -- new variable
        curl -v \
            -H "@${HEADERS_FILE}" \
            -H 'Content-Type:application/json' \
            --data "${fileContent}" \                -- usage of variable, no @ used
            "${URL}/api/${2}/importItem"
miroslavpojer commented 1 year ago

Release notes:

2129 - Added new variable to store file content before send by curl command to solved an error in windows.