Top Level Namespace

Defined Under Namespace

Classes: I2Cssh

Instance Method Summary collapse

Instance Method Details

#get_hosts(c) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'bin/i2cssh', line 11

def get_hosts(c)
    c.each do |clus|

        if clus =~ /(.+)@(.+)/
             = $1
            clus = $2
        end

        cluster = @clusters[clus]
        if cluster
            set_options(cluster, )

            if @i2_options.last[:login]
                @servers << cluster["hosts"].map{|h| "#{@i2_options.last[:login]}@#{h}"}
            else
                @servers << cluster["hosts"]
            end
        else
            puts "ERROR: unknown cluster #{c}. Check your #{@config_file}"
            exit 1
        end
    end

end

#set_options(config_hash, login_override = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'bin/i2cssh', line 36

def set_options(config_hash, =nil)
    if config_hash["columns"] and config_hash["rows"]
        puts "CONFIG ERROR: rows and columns can't be used at the same time"
        exit 1
    end

    if @i2_options.size == 0
        @i2_options << {}
    else
        # The first member includes the default options from the conf file
        @i2_options << @i2_options.first.clone
    end

    [:broadcast, :profile, :rank, :iterm2, :login, :columns, :rows, :sleep, :direction, :itermname].each do |p|
        @i2_options.last[p] = config_hash[p.to_s].nil? ? @i2_options.last[p] : config_hash[p.to_s]
    end

    @i2_options.last[:login] =  if 
    @i2_options.last[:direction] ||= :column
    @i2_options.last[:direction] = @i2_options.last[:direction].to_sym
    if config_hash["environment"]
        if @ssh_environment.empty?
            @ssh_environment << {}
        else
            # We have some global env so copy it
            @ssh_environment << @ssh_environment.first.clone
        end

        @ssh_environment.last.merge!(config_hash["environment"].inject({}){|m, v| m.merge(v)})
    else
        @ssh_environment << {}
    end

end