ganeti
Safe HaskellNone

Ganeti.HTools.CLI

Description

Implementation of command-line functions.

This module holds the common command-line related functions for the binaries, separated into this module since Ganeti.Utils is used in many other places and this is more IO oriented.

Synopsis

Data types

data Options Source #

Command line options structure.

Constructors

Options 

Fields

Instances

Instances details
Show Options # 
Instance details

Defined in Ganeti.HTools.CLI

Methods

showsPrec :: Int -> Options -> ShowS

show :: Options -> String

showList :: [Options] -> ShowS

StandardOptions Options # 
Instance details

Defined in Ganeti.HTools.CLI

defaultOptions :: Options Source #

Default values for the command line options.

type OptType = GenericOptType Options Source #

Abbreviation for the option type.

Helper functions

parseISpecString :: String -> String -> Result RSpec Source #

optComplDiskTemplate :: OptCompletion Source #

Disk template choices.

Command line options

Functions

parseOpts Source #

Arguments

:: [String]

The command line arguments

-> String

The program name

-> [OptType]

The supported command line options

-> [ArgCompletion]

The supported command line arguments

-> IO (Options, [String])

The resulting options and leftover arguments

Wrapper over parseOpts with our custom options.

shTemplate :: String Source #

A shell script template for autogenerated scripts.

maybeSaveCommands Source #

Arguments

:: String

Informal description

-> Options 
-> String

commands

-> IO () 

Optionally show or save a list of commands

maybePrintNodes Source #

Arguments

:: Maybe [String]

The field list

-> String

Informational message

-> ([String] -> String)

Function to generate the listing

-> IO () 

Optionally print the node list.

maybePrintInsts Source #

Arguments

:: Bool

Whether to print the instance list

-> String

Type of the instance map (e.g. initial)

-> String

The instance data

-> IO () 

Optionally print the instance list.

maybeShowWarnings Source #

Arguments

:: [String]

The warning messages

-> IO () 

Function to display warning messages from parsing the cluster state.

printKeys Source #

Arguments

:: String

Prefix to printed variables

-> [(String, String)]

List of (key, value) pairs to be printed

-> IO () 

Format a list of key, value as a shell fragment.

printFinal Source #

Arguments

:: String

Prefix to printed variable

-> Bool

Whether output should be machine readable; note: if not, there is nothing to print

-> IO () 

Prints the final OK marker in machine readable output.

setNodeOffline :: [Ndx] -> Node -> Node Source #

Potentially set the node as offline based on passed offline list.

setNodeStatus :: Options -> List -> IO List Source #

Set node properties based on command line options.