Skip to content

pfcon get set internalvars

Rudolph Pienaar edited this page Feb 2, 2018 · 15 revisions

pfcon get/set internalvars

Abstract

This page describes how to directly set/get internal variables in pfcon. These variables are typically settings such as host service names, IP addresses, etc.

Preconditions

  • Make sure that pfcon has been started (see here for more info)
pfcon --forever --httpResponse

msg summary

The msg payload of the REST interaction with pfcon is:

'{  "action": "internalctl",
    "meta": {
                "var":          "storeAddress",
                "get":          "value"
            }
}'

get

pfurl calling syntax

Assuming satisfied preconditions, let's get some data in the internal tree dictionary of the process

./pfurl --verb POST --raw --http ${HOST_IP}:5015/api/v1/cmd --httpResponseBodyParse --jsonwrapper 'payload' --msg \
'{  "action": "internalctl",
    "meta": {
                "var":     "/service",
                "get":      "value"
            }
}'

set

pfurl calling syntax

Assuming satisfied preconditions, we can set an entire dictionary of values

./pfurl --verb POST --raw --http ${HOST_IP}:5015/api/v1/cmd --httpResponseBodyParse --jsonwrapper 'payload' --msg \
'{  "action": "internalctl",
    "meta": {
                "var":     "/service/megaldon",
                "set":     {
                    "compute": {
                        "addr": "10.195.149.43",
                        "baseURLpath": "api/v1/cmd/",
                        "status": "undefined"
                    },
                    "data": {
                        "addr": "10.195.149.43",
                        "baseURLpath": "api/v1/cmd/",
                        "status": "undefined"
                    }

            }
}'

return payload

--30--