Class: Hieracles::Options::Hc

Inherits:
Hieracles::Optparse show all
Defined in:
lib/hieracles/options/hc.rb

Instance Attribute Summary

Attributes inherited from Hieracles::Optparse

#options, #payload

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hieracles::Optparse

#initialize, #optionkeys

Constructor Details

This class inherits a constructor from Hieracles::Optparse

Class Method Details

.usageObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/hieracles/options/hc.rb', line 60

def self.usage
  return <<-END

Usage: hc <fqdn> <command> [extra_args]

Available commands:
  info        provides the farm, datacenter, country
        associated to the given fqdn
        An extra param can be added for filtering
        eg. hc <fqdn> info timestamp
        eg. hc <fqdn> info farm
  facts       lists facts, either provided as a fact file
        or grabbed from puppetdb.
        An extra param can be added for filtering
        eg. hc <fqdn> facts architecture
        eg. hc <fqdn> facts 'memory.*mb'
  files       list all files containing params affecting this fqdn
        (in more than commons)
  paths       list all file paths for files with params
  modules     list modules included in the farm where the node is
  params      list params for the node matching the fqdn
        An extra filter string can be added to limit the list
        use ruby regexp without the enclosing slashes
        eg. hc <fqdn> params postfix.*version
        eg. hc <fqdn> params '^postfix'
        eg. hc <fqdn> params 'version$'
  allparams   same as params but including the common.yaml params (huge)
        Also accepts a search string

Extra args:
  -f <plain|console|csv|yaml|rawyaml|json> default console
  -p extraparam=what;anotherparam=this 
  -c <configfile>
  -h <hierafile>
  -b <basepath> default ./
  -e <encdir>
  -y <fact_file> - facts in yaml format
  -j <fact_file> - facts in json format
  -v just displays the version of Hieracles
  -i - interactive mode
  -db - query puppetdb
  -nodb - do not query puppetdb
  END
end

Instance Method Details

#available_optionsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hieracles/options/hc.rb', line 7

def available_options
  {
    config: {
      has_arg: true,
      aliases: ['c', 'conf', 'config']
    },
    format: {
      has_arg: true,
      aliases: ['f', 'format']
    },
    params: {
      has_arg: true,
      aliases: ['p', 'params']
    },
    hierafile: {
      has_arg: true,
      aliases: ['h', 'hierafile']
    },
    basepath: {
      has_arg: true,
      aliases: ['b', 'basepath']
    },
    encpath: {
      has_arg: true,
      aliases: ['e', 'encpath']
    },
    version: {
      has_arg: false,
      aliases: ['v', 'version']
    },
    yaml_facts: {
      has_arg: true,
      aliases: ['y', 'yaml']
    },
    json_facts: {
      has_arg: true,
      aliases: ['j', 'json']
    },
    interactive: {
      has_arg: false,
      aliases: ['i', 'interactive']
    },
    db: {
      has_arg: false,
      aliases: ['db']
    },
    nodb: {
      has_arg: false,
      aliases: ['nodb', 'no-db', 'no']
    }
  }
end