Docker example: fixed scripts to run multiple instances
Fixed parenthesis typo in purge code
This commit is contained in:
parent
8f7ae33262
commit
7868cf0a0d
6 changed files with 30 additions and 31 deletions
|
|
@ -520,7 +520,6 @@ from_client_edit_config(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cant do this earlier since we dont have a yang spec to
|
/* Cant do this earlier since we dont have a yang spec to
|
||||||
* the upper part of the tree, until we get the "config" tree.
|
* the upper part of the tree, until we get the "config" tree.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Start the container:
|
||||||
If you want to install your pre-existing pub rsa key in the container, and change the name:
|
If you want to install your pre-existing pub rsa key in the container, and change the name:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ SSHKEY=true NAME=clixon-example22 ./start.sh
|
$ SSHKEY=/home/user/.ssh/id_rsa.pub NAME=clixon-example22 ./start.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
You can combine make and start by:
|
You can combine make and start by:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Name of container
|
||||||
|
: ${NAME:=clixon-example}
|
||||||
|
|
||||||
# Kill all controller containers (optionally do `make clean`)
|
# Kill all controller containers (optionally do `make clean`)
|
||||||
sudo docker kill clixon-example 2> /dev/null # ignore errors
|
sudo docker kill $NAME 2> /dev/null # ignore errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
# the terms of any one of the Apache License version 2 or the GPL.
|
# the terms of any one of the Apache License version 2 or the GPL.
|
||||||
#
|
#
|
||||||
# ***** END LICENSE BLOCK *****
|
# ***** END LICENSE BLOCK *****
|
||||||
|
set -eux
|
||||||
# Usage: ./startup.sh
|
# Usage: ./startup.sh
|
||||||
# Debug: DBG=1 ./startup.sh
|
# Debug: DBG=1 ./startup.sh
|
||||||
# See also cleanup.sh
|
# See also cleanup.sh
|
||||||
|
|
@ -38,23 +38,23 @@
|
||||||
# Name of container
|
# Name of container
|
||||||
: ${NAME:=clixon-example}
|
: ${NAME:=clixon-example}
|
||||||
|
|
||||||
# If true also install your users pubkey
|
# If set to filename also install your users pubkey
|
||||||
: ${SSHKEY:=false}
|
: ${SSHKEY:=}
|
||||||
|
|
||||||
>&2 echo "Running script: $0"
|
>&2 echo "Running script: $0"
|
||||||
|
|
||||||
sudo docker kill clixon-example 2> /dev/null # ignore errors
|
sudo docker kill $NAME || true 2> /dev/null # ignore errors
|
||||||
|
|
||||||
# Start clixon-example backend
|
# Start clixon-example backend
|
||||||
sudo docker run --name ${NAME} --rm -td clixon/clixon-example #|| err "Error starting clixon-example"
|
sudo docker run --name ${NAME} --rm -td clixon/clixon-example #|| err "Error starting clixon-example"
|
||||||
|
|
||||||
# Copy rsa pubkey
|
# Copy rsa pubkey
|
||||||
if $SSHKEY; then
|
if [ -n "$SSHKEY" ]; then
|
||||||
# install user pub key
|
# install user pub key
|
||||||
sudo docker exec -it clixon-example mkdir -m 700 /root/.ssh
|
sudo docker exec -it $NAME mkdir -m 700 /root/.ssh
|
||||||
sudo docker cp ~/.ssh/id_rsa.pub clixon-example:/root/.ssh/authorized_keys
|
sudo docker cp $SSHKEY $NAME:/root/.ssh/authorized_keys
|
||||||
sudo docker exec -it clixon-example chown root /root/.ssh/authorized_keys
|
sudo docker exec -it $NAME chown root /root/.ssh/authorized_keys
|
||||||
sudo docker exec -it clixon-example chgrp root /root/.ssh/authorized_keys
|
sudo docker exec -it $NAME chgrp root /root/.ssh/authorized_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
>&2 echo "clixon-example started"
|
>&2 echo "$NAME started"
|
||||||
|
|
|
||||||
|
|
@ -350,8 +350,8 @@ xml_name(cxobj *xn)
|
||||||
/*! Set name of xnode, name is copied
|
/*! Set name of xnode, name is copied
|
||||||
* @param[in] xn xml node
|
* @param[in] xn xml node
|
||||||
* @param[in] name new name, null-terminated string, copied by function
|
* @param[in] name new name, null-terminated string, copied by function
|
||||||
* @retval -1 on error with clicon-err set
|
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
|
* @retval -1 on error with clicon-err set
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_name_set(cxobj *xn,
|
xml_name_set(cxobj *xn,
|
||||||
|
|
@ -383,8 +383,8 @@ xml_prefix(cxobj *xn)
|
||||||
/*! Set prefix of xnode, prefix is copied
|
/*! Set prefix of xnode, prefix is copied
|
||||||
* @param[in] xn XML node
|
* @param[in] xn XML node
|
||||||
* @param[in] prefix New prefix, null-terminated string, copied by function
|
* @param[in] prefix New prefix, null-terminated string, copied by function
|
||||||
* @retval -1 Error with clicon-err set
|
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
|
* @retval -1 Error with clicon-err set
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_prefix_set(cxobj *xn,
|
xml_prefix_set(cxobj *xn,
|
||||||
|
|
@ -425,8 +425,8 @@ nscache_get(cxobj *x,
|
||||||
* @param[in] x XML node
|
* @param[in] x XML node
|
||||||
* @param[in] namespace
|
* @param[in] namespace
|
||||||
* @param[out] prefix
|
* @param[out] prefix
|
||||||
* @retval 0 No prefix found
|
|
||||||
* @retval 1 Prefix found
|
* @retval 1 Prefix found
|
||||||
|
* @retval 0 No prefix found
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
nscache_get_prefix(cxobj *x,
|
nscache_get_prefix(cxobj *x,
|
||||||
|
|
@ -632,8 +632,8 @@ xml_value(cxobj *xn)
|
||||||
/*! Set value of xml node, value is copied
|
/*! Set value of xml node, value is copied
|
||||||
* @param[in] xn xml node
|
* @param[in] xn xml node
|
||||||
* @param[in] val new value, null-terminated string, copied by function
|
* @param[in] val new value, null-terminated string, copied by function
|
||||||
* @retval -1 on error with clicon-err set
|
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
|
* @retval -1 on error with clicon-err set
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_value_set(cxobj *xn,
|
xml_value_set(cxobj *xn,
|
||||||
|
|
@ -666,8 +666,8 @@ xml_value_set(cxobj *xn,
|
||||||
/*! Append value of xnode, value is copied
|
/*! Append value of xnode, value is copied
|
||||||
* @param[in] xn xml node
|
* @param[in] xn xml node
|
||||||
* @param[in] val appended value, null-terminated string, copied by function
|
* @param[in] val appended value, null-terminated string, copied by function
|
||||||
* @retval NULL on error with clicon-err set, or if value is set to NULL
|
|
||||||
* @retval new value
|
* @retval new value
|
||||||
|
* @retval NULL on error with clicon-err set, or if value is set to NULL
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_value_append(cxobj *xn,
|
xml_value_append(cxobj *xn,
|
||||||
|
|
@ -854,7 +854,6 @@ xml_child_i_set(cxobj *xt,
|
||||||
/*! Get the order of child
|
/*! Get the order of child
|
||||||
* @param[in] xp xml parent node
|
* @param[in] xp xml parent node
|
||||||
* @param[in] xc the xml child to look for
|
* @param[in] xc the xml child to look for
|
||||||
* @retval xml The child xml node
|
|
||||||
* @retval i The order of the child
|
* @retval i The order of the child
|
||||||
* @retval -1 if no such child, or empty child
|
* @retval -1 if no such child, or empty child
|
||||||
* @see xml_child_i
|
* @see xml_child_i
|
||||||
|
|
@ -1342,8 +1341,8 @@ xml_wrap_all(cxobj *xp,
|
||||||
* After: xp --> xt(tag) --> xc
|
* After: xp --> xt(tag) --> xc
|
||||||
* @param[in] xp Parent xml node
|
* @param[in] xp Parent xml node
|
||||||
* @param[in] tag Name of new xml child
|
* @param[in] tag Name of new xml child
|
||||||
* @retval NULL Error
|
|
||||||
* @retval xc Return the new child (xc)
|
* @retval xc Return the new child (xc)
|
||||||
|
* @retval NULL Error
|
||||||
* @see xml_addsub (give the parent)
|
* @see xml_addsub (give the parent)
|
||||||
* @see xml_wrap_all (wrap all children of a node, not just one)
|
* @see xml_wrap_all (wrap all children of a node, not just one)
|
||||||
*/
|
*/
|
||||||
|
|
@ -2079,9 +2078,9 @@ cxvec_prepend(cxobj *x,
|
||||||
* @param[in] type Matching type or -1 for any
|
* @param[in] type Matching type or -1 for any
|
||||||
* @param[in] fn Callback
|
* @param[in] fn Callback
|
||||||
* @param[in] arg Argument
|
* @param[in] arg Argument
|
||||||
* @retval -1 Error, aborted at first error encounter
|
|
||||||
* @retval 0 OK, all nodes traversed (subparts may have been skipped)
|
|
||||||
* @retval 1 OK, aborted on first fn returned 1
|
* @retval 1 OK, aborted on first fn returned 1
|
||||||
|
* @retval 0 OK, all nodes traversed (subparts may have been skipped)
|
||||||
|
* @retval -1 Error, aborted at first error encounter
|
||||||
*
|
*
|
||||||
* @code
|
* @code
|
||||||
* int x_fn(cxobj *x, void *arg)
|
* int x_fn(cxobj *x, void *arg)
|
||||||
|
|
@ -2134,9 +2133,9 @@ xml_apply(cxobj *xn,
|
||||||
* @param[in] type Matching type or -1 for any
|
* @param[in] type Matching type or -1 for any
|
||||||
* @param[in] fn Callback
|
* @param[in] fn Callback
|
||||||
* @param[in] arg Argument
|
* @param[in] arg Argument
|
||||||
* @retval -1 Error, aborted at first error encounter
|
|
||||||
* @retval 0 OK, all nodes traversed (subparts may have been skipped)
|
|
||||||
* @retval 1 OK, aborted on first fn returned 1
|
* @retval 1 OK, aborted on first fn returned 1
|
||||||
|
* @retval 0 OK, all nodes traversed (subparts may have been skipped)
|
||||||
|
* @retval -1 Error, aborted at first error encounter
|
||||||
* @see xml_apply not including top object
|
* @see xml_apply not including top object
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
|
@ -2167,9 +2166,9 @@ xml_apply0(cxobj *xn,
|
||||||
* @param[in] xn XML node
|
* @param[in] xn XML node
|
||||||
* @param[in] fn Callback
|
* @param[in] fn Callback
|
||||||
* @param[in] arg Argument
|
* @param[in] arg Argument
|
||||||
* @retval -1 Error, aborted at first error encounter
|
|
||||||
* @retval 0 OK, all nodes traversed
|
|
||||||
* @retval n OK, aborted at first encounter of first match
|
* @retval n OK, aborted at first encounter of first match
|
||||||
|
* @retval 0 OK, all nodes traversed
|
||||||
|
* @retval -1 Error, aborted at first error encounter
|
||||||
* @code
|
* @code
|
||||||
* int x_fn(cxobj *x, void *arg)
|
* int x_fn(cxobj *x, void *arg)
|
||||||
* {
|
* {
|
||||||
|
|
@ -2207,8 +2206,8 @@ xml_apply_ancestor(cxobj *xn,
|
||||||
/*! Is xpp ancestor of x?
|
/*! Is xpp ancestor of x?
|
||||||
* @param[in] x XML node
|
* @param[in] x XML node
|
||||||
* @param[in] xpp Potential ancestor of x in XML tree
|
* @param[in] xpp Potential ancestor of x in XML tree
|
||||||
* @retval 0 No, xpp is not ancestor of x
|
|
||||||
* @retval 1 Yes, xpp is ancestor of x
|
* @retval 1 Yes, xpp is ancestor of x
|
||||||
|
* @retval 0 No, xpp is not ancestor of x
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_isancestor(cxobj *x,
|
xml_isancestor(cxobj *x,
|
||||||
|
|
@ -2304,6 +2303,7 @@ xml_operation2str(enum operation_type op)
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Map xml insert attribute from string to enumeration
|
/*! Map xml insert attribute from string to enumeration
|
||||||
* @param[in] instr String, eg "first"
|
* @param[in] instr String, eg "first"
|
||||||
* @param[out] ins Enumeration, eg INS_FIRST
|
* @param[out] ins Enumeration, eg INS_FIRST
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ xml_tree_prune_flagged_sub(cxobj *xt,
|
||||||
x = NULL;
|
x = NULL;
|
||||||
xprev = x = NULL;
|
xprev = x = NULL;
|
||||||
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
|
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
|
||||||
if (xml_flag(x, flag) == test?flag:0){
|
if (xml_flag(x, flag) == (test?flag:0)){
|
||||||
/* Pass test */
|
/* Pass test */
|
||||||
mark++;
|
mark++;
|
||||||
xprev = x;
|
xprev = x;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue