Changes between Version 4 and Version 5 of Usage/UserDocumentation


Ignore:
Timestamp:
06/01/12 15:24:03 (12 years ago)
Author:
sil
Comment:

documented some non-crud options of cmt client

Legend:

Unmodified
Added
Removed
Modified
  • Usage/UserDocumentation

    v4 v5  
    7878
    7979
    80 == Add object: `-a, --add` ==
     80== CRUD options ==
     81
     82Just like the web-interface, the CLI can be used for CRUD-functionalities (Create, Read, Update, Delete) too. However, the implementation of the CLI is much more powerful, since it can be used to do things with multiple objects at once, and can be done from shell-scripts.
     83
     84=== Add object: `-a, --add` ===
    8185
    8286Use this option to add a new object of a given entity to the database. You have to specify the entity and assign values to its fields by providing assignments as extra arguments. The syntax is as follows:
     
    8690}}}
    8791
    88 === Use case ===
     92==== Use case ====
    8993
    9094'''You want to add a new server, and its interfaces'''
     
    107111}}}
    108112
    109 
    110 == Change object(s): `-c, --change` ==
     113=== List object(s): `-l, --list` ===
     114
     115Use this option to list existing objects in the database. You have to specify the entity, and filter objects you want to list by providing a query. The syntax is as follows:
     116
     117{{{
     118cmt_sara --list <entity> [get] <query>
     119}}}
     120
     121==== Use case ====
     122
     123'''If you need to figure out where a machine -- in this case `test3` -- is physically hosted:'''
     124
     125When an engineer has to fix a node you need to tell him the location of the node. This information shall be listed by issuing the following command:
     126
     127{{{
     128user@host$ cmt --list hardwareunit label=test3
     129}}}
     130
     131The output of this command looks like:
     132
     133{{{
     134 .---[  test3  ]---
     135 : cluster        : LDAP/CUA
     136 : address        : Amsterdam - Science Park 121
     137 : room           : S142A
     138 : rack           : rack AD38
     139 : first_slot     : 23
     140 : specifications : PowerEdge 1950 (Dell bv)
     141 : roles          : administration
     142 : in_support     : True
     143 '---
     144}}}
     145
     146=== Change object(s): `-c, --change` ===
    111147
    112148Use this option to change fields of one or more objects in the database. You have to specify the entity, filter objects you want to change by providing a query, and assign new values to their fields by providing assignments as extra arguments. The syntax is as follows:
     
    116152}}}
    117153
    118 === Use case ===
     154==== Use case ====
    119155'''You have to change an existing address:'''
    120156
     
    177213}}}
    178214
    179 
    180 == Generate a config-file: `-g, --generate` ==
     215=== Remove object(s): `-r, --remove` ===
     216
     217Use this option to remove objects from the database. You have to specify the entity, and filter objects you want to remove by providing a query. The syntax is as follows:
     218
     219{{{
     220sara_cmt --remove <entity> [get] <query>
     221}}}
     222
     223==== Use case ====
     224
     225'''You have removed a server from a rack:'''
     226
     227For example the first node in rack 2:
     228
     229{{{
     230user@host$ cmt --remove hardwareunit rack=2 first_slot=1
     231INFO     remove 233 :: Found 1 objects matching query: r2n1
     232Are you sure? [Yn]
     233}}}
     234
     235As you can see there will be asked for confirmation by default.
     236
     237
     238== Other options ==
     239
     240=== Dry-run: `-n, --dry-run ===
     241
     242Use this option to suppress (CRUD-)actions that make changes to the database. Please note, this option has to be given ''before'' CRUD-options. So, use it like:
     243
     244{{{
     245user@host$ cmt --dry-run --{add,list,change,remove} ENTITY ...
     246}}}
     247
     248This option can become handy when you first want to test a command that'll have a big impact.
     249
     250==== Use case ====
     251
     252You're replacing all compute-nodes in a couple of racks (2-5), and want to test your command to remove the old hardware from CMT:
     253
     254{{{
     255user@host$ cmt --dry-run --remove hardwareunit rack={2,3,4,5} role=computenode
     256}}}
     257
     258{{{#!comment
     259=== Non-interactive run: `--script ===
     260
     261Sometimes you don't want to interact with CMT, after issuing a command. For example, when CMT is executed unattended from scripts. Syntax is like:
     262
     263{{{
     264user@host$ cmt --script --{add,list,change,remove} ENTITY ...
     265}}}
     266
     267==== Use case ====
     268
     269{{{
     270
     271}}}
     272}}}
     273
     274=== Generate a config-file: `-g, --generate` ===
    181275
    182276Render a template to generate a config-file or a report. Use the following syntax:
     
    186280}}}
    187281
    188 === Use case ===
     282==== Use case ====
    189283
    190284'''When you want to generate the cfrun_hosts file of the Clearspeed cluster:'''
     
    230324gb-r51n8.irc.sara.nl
    231325}}}
    232 
    233 
    234 == List object(s): `-l, --list` ==
    235 
    236 Use this option to list existing objects in the database. You have to specify the entity, and filter objects you want to list by providing a query. The syntax is as follows:
    237 
    238 {{{
    239 cmt_sara --list <entity> [get] <query>
    240 }}}
    241 
    242 === Use case ===
    243 
    244 '''If you need to figure out where a machine -- in this case `test3` -- is physically hosted:'''
    245 
    246 When an engineer has to fix a node you need to tell him the location of the node. This information shall be listed by issuing the following command:
    247 
    248 {{{
    249 user@host$ cmt --list hardwareunit label=test3
    250 }}}
    251 
    252 The output of this command looks like:
    253 
    254 {{{
    255  .---[  test3  ]---
    256  : cluster        : LDAP/CUA
    257  : address        : Amsterdam - Science Park 121
    258  : room           : S142A
    259  : rack           : rack AD38
    260  : first_slot     : 23
    261  : specifications : PowerEdge 1950 (Dell bv)
    262  : roles          : administration
    263  : in_support     : True
    264  '---
    265 }}}