Skip to content

Commit

Permalink
Update entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
msftsettiy authored Jul 11, 2023
1 parent e935bc8 commit f865eea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@ perl -p -i -e 's/__MEMBER_CERTIFICATE__/$ENV{MEMBER_CERT}/g' set_member.json

# Add the member
echo "Adding the member."
content=$(ccf_cose_sign1 --ccf-gov-msg-type proposal --ccf-gov-msg-created_at `date -Is` --signing-key key --signing-cert cert --content set_member.json | curl ${CCF_URL}/gov/proposals -k -H "content-type: application/cose" --data-binary @-)
echo "Add member response content: ${content}"
proposal_id=$(echo "${content}" | jq '.proposal_id')
id=$(ccf_cose_sign1 --ccf-gov-msg-type proposal --ccf-gov-msg-created_at `date -Is` --signing-key key --signing-cert cert --content set_member.json | curl ${CCF_URL}/gov/proposals -k -H "content-type: application/cose" --data-binary @-| jq '.proposal_id')
proposal_id=$(eval echo $id)
echo "Proposal id: ${proposal_id}"

# Vote on the proposal
content=$(ccf_cose_sign1 --ccf-gov-msg-type ballot --ccf-gov-msg-created_at `date -Is` --signing-key key --signing-cert cert --content accept.json --ccf-gov-msg-proposal_id ${proposal_id}| curl ${CCF_URL}/gov/proposals/${proposal_id}/ballots -k -H "content-type: application/cose" --data-binary @-)
status=$(echo "${content}" | jq '.state')
echo "Vote proposal status: ${status}"
status=$(ccf_cose_sign1 --ccf-gov-msg-type ballot --ccf-gov-msg-created_at `date -Is` --signing-key key --signing-cert cert --content accept.json --ccf-gov-msg-proposal_id ${proposal_id}| curl ${CCF_URL}/gov/proposals/${proposal_id}/ballots -k -H "content-type: application/cose" --data-binary @-| jq '.state')
state=$(eval echo $status)
echo "Vote proposal state: ${state}"

[[ $status="Accepted" ]] || ( echo "Member could not be added."; exit 1 )
[[ $state=Accepted ]] || ( echo "Member could not be added."; exit 1 )

# Activate the member
echo "Activating the member."
Expand Down

0 comments on commit f865eea

Please sign in to comment.