Revision a6620629 src/vnm_mad/remotes/lib/vnm_driver.rb

View differences:

src/vnm_mad/remotes/lib/vnm_driver.rb
72 72
        def process(&block)
73 73
            blk = lambda do |nic|
74 74
                add_nic_conf(nic)
75
                add_bridge_conf(nic)
75 76

  
76 77
                block.call(nic)
77 78
            end
......
100 101
            nic[:conf] = default_conf.merge(nic_conf)
101 102
        end
102 103

  
104
        def add_bridge_conf(nic)
105
            add_command_conf(nic, :bridge_conf)
106
        end
107

  
108
        def add_command_conf(nic, conf_name)
109
            default_conf = CONF[conf_name] || {}
110
            nic_conf = {}
111

  
112
            # sanitize
113
            default_conf.each do |key, value|
114
                option  = Shellwords.escape(key.to_s.strip.downcase)
115
                if value.class == String
116
                    value   = Shellwords.escape(value.strip)
117
                end
118

  
119
                nic_conf[option] = value
120
            end
121

  
122
            if nic[conf_name]
123
                parse_options(nic[conf_name]).each do |option, value|
124
                    if value == '__delete__'
125
                        nic_conf.delete(option.strip.downcase)
126
                    else
127
                        option  = Shellwords.escape(option.strip.downcase)
128
                        value   = Shellwords.escape(value)
129

  
130
                        nic_conf[option] = value
131
                    end
132
                end
133
            end
134

  
135
            nic[conf_name] = nic_conf
136
        end
137

  
103 138
        # Returns a filter object based on the contents of the template
104 139
        #
105 140
        # @return SGDriver object

Also available in: Unified diff