-
Notifications
You must be signed in to change notification settings - Fork 1
rerun module
The "yana" rerun module acts as a basic client to the Yana server and provides a set of commands allowing users to create and manipulate Nodes.
For the most part, the commands are simple wrappers around the Yana API. You can find the module source here.
-
import
: import yana model - Reads a model definition. -
node
: manipulate a node - Provides actions for getting information about a node, creating and deleting them. -
nodes
: list nodes - Lists all nodes or limit results by node name or type. -
type
: manipulate a node type - Provides actions for listing, creating or deleting a node type. -
types
: list the node types - Lists all the types.
To list all commands and their options use rerun's command listing feature:
$ rerun yana
The yana module uses a configuration file that contains data about how to connect to the yana server.
Data:
-
YANA_URL
: URL to the Yana server -
YANA_USER
: Login name -
YANA_PASSWORD
: Password
Example data:
$ cat ~/.yanarc
YANA_URL=http://localhost:8080
YANA_USER=admin
YANA_PASSWORD=admin
By default, the yana module looks for a file called $HOME/.yanarc
but this can be overridden using the "--cfg" option.
Global options exist for many of the yana commands.
Specify a configuration file via command line option:
rerun yana: <command> -C|--cfg <$HOME/.yanarc>
Example:
rerun yana:nodes --cfg $HOME/.yanarc
Specify a format option:
rerun yana: <command> -F|--format <>
Example:
rerun yana:nodes --format '${NAME}:${TYPE}'
See the command's usage statement for the default format string.
The following sections provide usage summary and examples for each command.
Import a model from a file. See the XML definition format here: https://github.com/dtolabs/yana2/blob/master/docs/yana.xsd
Usage:
rerun yana:import --file <>
Example:
$ rerun yana:import --file yana_import2.xml
Lists all Nodes defined in the model. The --type <>
option allows a sub filtering of nodes by their NodeType.
rerun yana:nodes [--type <>]
Example
List all the nodes:
$ rerun yana:nodes
1:ubuntu:Node:tomcat,simpleapp,qa:The ubuntu server
2:tomcat:Service:QA:The tomcat service
3:qa:Site:QA:The QA site
4:apache-tomcat-5.5.31:Package:tomcat:the tomcat container
5:simple-1.0.0.war:Package:tomcat:the simple webapp
List just the nodes of type, Package:
$ rerun yana:nodes --type Package
4:apache-tomcat-5.5.31:Package:tomcat:the tomcat container
5:simple-1.0.0.war:Package:tomcat:the simple webapp
Manipulate a node.
Actions:
The node command provides a set of actions via the --action <>
option.
-
create
: Create a new node -
delete
: Delete the node -
get
: Get node info (default)
The get
action prints node info. Since the default action is "get", the --action option is left out in the examples.
Usage:
rerun yana:node --id <id>
Example:
$ rerun yana:node --id 1
name:ubuntu
type:Node
description:The ubuntu server
tags:tomcat,simpleapp,qa
appname:simpleapp
arch:i386
basedir:/tmp/demo/tomcat
environment:qa
hostname:ubuntu
osFamily:unix
osName:Linux
osVersion:2.6.32-28-generic
port:18080
service:tomcat
username:alexh
Usage:
rerun yana:node --action create --typeid <> --name <> --tags <> --description <> --attributes <> --status <>
Example:
$ rerun yana:node --action create \
--typeid 4 --name fooboo --tags tagA \
--description 'my foo boo' \
--attributes "startuprank:1"
Output:
7:fooboo:Site
To create a node that has more than one attribute, separate the attribute/value pairs with a comma.
$ rerun yana:node --action create \
--typeid 3 --name my_service --tags tagA \
--description 'my service instance' \
--attributes "basedir:/usr/myservice,port:8088,startuprank:1"
Attributes are defined by NodeType. To see the list of attributes for a given type use the yana:type
command below.
Usage:
rerun yana:node --action delete --id <>
Example:
$ rerun yana:node --action delete --id 7
List the types.
Usage:
rerun yana:types
Example:
$ rerun yana:types
1:Node:An application host
2:Package:A software package
3:Service:A software service
4:Site:A service site
Manipulate a type.
Actions:
The node command provides a set of actions via the --action <>
option.
-
create
: Create a type -
get
: Get type info (default) -
delete
: Delete a type
Print information about the type specified by its ID.
Usage:
rerun yana:type --id <>
Example:
$ rerun yana:type --id 1
name:Node
description:An application host
id:1
attributes:hostname,arch,osFamily,osName,osVersion,username,port,basedir,appname,service,environment
relationships:environment,service
The --type <>
option is an alternative means to specify a type using its name:
$ rerun yana:type --type Service
name:Service
description:A software service
id:3
attributes:basedir,startuprank,controller,port
relationships:service,package
Usage:
rerun yana:type --action delete --id <>
Example:
$ rerun yana:type --action delete --id 5