Skip to content

Commit c73f6d3

Browse files
author
Ian Oliver
committed
Fixed rima
1 parent 8c0ff0f commit c73f6d3

File tree

6 files changed

+421
-15
lines changed

6 files changed

+421
-15
lines changed

etc/experimental/rima/rima

0 Bytes
Binary file not shown.

etc/experimental/rima/rima.db

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,1,script1.sh
2-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,2,script1.sh
3-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,3,script1.sh
4-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,4,script1.sh
5-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,5,script1.sh
6-
d1b09fae-c996-4b4c-9678-0724cf15fc8c,6,script1.sh
1+
d1b09fae-c996-4b4c-9678-0724cf15fc8c,quick,script1.sh
2+
d1b09fae-c996-4b4c-9678-0724cf15fc8c,pain,script2.sh

etc/experimental/rima/rima.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func pcallHandler(w http.ResponseWriter, r *http.Request) {
9191

9292
sid, out, err := callScript(janeURL, data.EID, data.Pol, data.Msg)
9393

94-
fmt.Printf("sid, out, err: %v,%v,%v\n", sid, out, err)
94+
fmt.Printf("sid: %v\nout: %v\n err: %v\n", sid, out, err)
9595

9696
if err != nil {
9797
eresponse := pcallErrorResponse{Error: err.Error(), Out: out}
@@ -148,7 +148,8 @@ func setupSDB(fn string) {
148148

149149
// Format of DB is ElementItemID, Policy identifier, script name
150150
func populateSDB(data [][]string) {
151-
for _, line := range data {
151+
for j, line := range data {
152+
fmt.Printf(" Entry #%v is %v %v %v\n", j, line[0], line[1], line[2])
152153
SDB[sdbKey{line[0], line[1]}] = line[2]
153154
}
154155
}
@@ -165,15 +166,20 @@ func getEntry(eid string, pol string) (string, bool) {
165166
//**************************************************************************
166167

167168
func callScript(url string, eid string, pol string, msg string) (string, string, error) {
168-
fmt.Printf("Call string %v, %v, %v", eid, pol, msg)
169+
fmt.Printf("Call string %v, %v, %v\n", eid, pol, msg)
169170

170171
dbe, ok := getEntry(eid, pol)
171-
fmt.Printf(", entry %v, %v\n\n", dbe, ok)
172+
fmt.Printf(" ---> entry %v, %v\n", dbe, ok)
172173

173-
cmd := exec.Command(dbe, url, eid, pol, msg)
174+
scriptlocation := fmt.Sprintf("%v/%v", scriptDir, dbe)
175+
fmt.Printf(" ---> script %v\n\n", scriptlocation)
176+
177+
cmd := exec.Command(scriptlocation, url, eid, pol, msg)
174178
out, err := cmd.Output()
175179
if err != nil {
176180
fmt.Printf("\n\nerror is %v\n", err.Error())
177181
}
182+
183+
//instead of alice we should be taking the contents of the last line - which according to convention should just be a sessionid
178184
return "alice", string(out), nil
179185
}

etc/experimental/rima/script2.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ INTENT1=std::intent::sys::info
2525

2626
echo Intent1 is $INTENT1
2727

28-
cjson=$( jq --null-input --arg eid "$EID" --arg iid "$INTENT1" --arg sid "$SESSION" '{"eid":$eid,"epn":"a01rest", pid":$iid, "sid":$sid}' )
28+
cjson=$( jq --null-input --arg eid "$EID" --arg iid "$INTENT1" --arg sid "$SESSION" '{"eid":$eid,"epn":"a01rest", "pid":$iid, "sid":$sid}' )
2929
echo cjson $cjson
3030
CLAIMID1="$(curl -s -X POST $JANE/attest -H "Content-Type: application/json" --data "${cjson}" | jq -r .itemid)"
3131

0 commit comments

Comments
 (0)