Class: FissherConf::Misc

Inherits:
Object
  • Object
show all
Defined in:
lib/fissher_conf.rb

Overview

Misc methods for doing dirty work within the app.

Instance Method Summary collapse

Instance Method Details

#getpass(prompt = "Enter remote password: ") ⇒ String

A wrapper function used to request the password from stdin.

Parameters:

  • prompt (String) (defaults to: "Enter remote password: ")

    The banner displayed to the user.

Returns:

  • (String)

    The password, as entered by the user.



20
21
22
# File 'lib/fissher_conf.rb', line 20

def getpass(prompt="Enter remote password: ")
  ask(prompt) {|q| q.echo = false}
end

#group_hosts(grp, conf, conf_file) ⇒ Array

Method for returning hosts from hostgroup.

Parameters:

  • grp (String)

    The hostgroup, contained within the config.

  • conf (Hash)

    The parsed configuration file

  • conf_file (String)

    The configuration file, with path.

Returns:

  • (Array)

    An array of the hosts contained in the hostgroup within the config file.



30
31
32
33
34
35
36
# File 'lib/fissher_conf.rb', line 30

def group_hosts( grp,conf,conf_file )
  if conf[:hostgroups][:"#{grp}"] 
    conf[:hostgroups][:"#{grp}"][:hosts]
  else
    abort "Fatal: hostgroup #{grp} not defined in #{conf_file}!\n"
  end
end