Skip to content

Commit

Permalink
Added support for using etcdctl instead of curl in etcd_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarl committed Oct 28, 2014
1 parent 21e0f55 commit f672d28
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions files/etcd_functions 100644 → 100755
Expand Up @@ -16,12 +16,30 @@ function get_etcd_value
{
local bridge_ip
bridge_ip=`get_bridge_ip`
curl -s -L http://$bridge_ip:4001/v2/keys$1 | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["node"]["value"];'
etcdctl --peers="http://$bridge_ip:4001" get $1
}

# $1 is key, for instance "/message"
# $2 is value, for instance "hello"
function set_etcd_value
{
local bridge_ip
bridge_ip=`get_bridge_ip`
etcdctl --peers="http://$bridge_ip:4001" set $1 $2
}

#
# $1 is key, for instance "/message"
function get_etcd_value_curl
{
local bridge_ip
bridge_ip=`get_bridge_ip`
curl -s -L http://$bridge_ip:4001/v2/keys$1 | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["node"]["value"];'
}

# $1 is key, for instance "/message"
# $2 is value, for instance "hello"
function set_etcd_value_curl
{
local bridge_ip
bridge_ip=`get_bridge_ip`
Expand All @@ -46,4 +64,4 @@ function replace_ip_in_hosts
cp $tmphosts /etc/hosts
rm $tmphosts

}
}

0 comments on commit f672d28

Please sign in to comment.