Top Level Namespace
- Includes:
- CloudCLI, OpenNebula
Defined Under Namespace
Modules: CloudCLI, CloudClient, DriverExecHelper, OpenNebula, Role, Service, VCenterDriver Classes: ActionManager, GenericCommand, LocalCommand, OpenNebulaDriver, RemotesCommand, SSHCommand, Sample, TemplateDriver, VCenterConf, VirtualMachineDriver
Constant Summary collapse
- BIN_LOCATION =
ONE_LOCATION + '/bin'
- LIB_LOCATION =
ONE_LOCATION + '/lib'
- ETC_LOCATION =
ONE_LOCATION + '/etc/'
- VAR_LOCATION =
ONE_LOCATION+"/var/"
- GEMS_LOCATION =
ONE_LOCATION + '/share/gems'
- CHECK_REFS =
true
- ONE_LOCATION =
ENV["ONE_LOCATION"]
Constants included from OpenNebula
OpenNebula::DEFAULT_POOL_PAGE_SIZE, OpenNebula::VERSION
Instance Method Summary collapse
- #check_item(item, target_class) ⇒ Object
- #check_valid(parameter, label) ⇒ Object
-
#error_message(message) ⇒ Object
—————————————————————————- # Helper functions # —————————————————————————- #.
- #get_server_order(opts, user) ⇒ Object
-
#to_array(name) ⇒ Object
—————————————————————————- # Helper functions to parse ldap_auth.conf server entries —————————————————————————- #.
Methods included from CloudCLI
#cmd_name, #print_xml, #version_text
Methods included from OpenNebula
decrypt, encrypt, handle_driver_exception, is_error?, pool_page_size, process_monitoring
Instance Method Details
#check_item(item, target_class) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/vcenter_driver.rb', line 152 def check_item(item, target_class) item.name if CHECK_REFS if target_class if !item.instance_of?(target_class) raise "Expecting type 'RbVmomi::VIM::#{target_class}'. " \ "Got '#{item.class} instead." end end rescue RbVmomi::Fault => e raise "Reference \"#{item._ref}\" error [#{e.}]. \ The reference does not exist" end |
#check_valid(parameter, label) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/vcenter_driver.rb', line 144 def check_valid(parameter, label) return unless parameter.nil? || parameter.empty? STDERR.puts ("The parameter '#{label}'\ is required for this action.") exit(-1) end |
#error_message(message) ⇒ Object
—————————————————————————- # Helper functions # —————————————————————————- #
136 137 138 139 140 141 142 |
# File 'lib/vcenter_driver.rb', line 136 def () error_str = "ERROR MESSAGE --8<------\n" error_str << error_str << "\nERROR MESSAGE ------>8--" error_str end |
#get_server_order(opts, user) ⇒ Object
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/opennebula/ldap_auth.rb', line 245 def get_server_order(opts, user) order = [] if opts[:order] && opts[:match_user_regex] STDERR.puts ":order and :match_user_regex are mutually exclusive" exit(-1) end if opts[:order] if opts[:order].class != Array STDERR.puts ":order value malformed, must be an Array" exit(-1) end opts[:order].each do |name| order << to_array(name) end elsif opts[:match_user_regex] if opts[:match_user_regex].class != Hash || opts[:match_user_regex].empty? STDERR.puts ":match_user_regex value malformed, must be an Hash" exit(-1) end opts[:match_user_regex].each do |regex, server| if m = user.match(/#{regex}/i) # update user with the capture user = m[1] if m[1] order << to_array(server) end end if order.empty? STDERR.puts "User #{user} does not mach any regex" end else STDERR.puts "missing either :order or :match_user_regex in configuration" exit(-1) end return [order, user] end |
#to_array(name) ⇒ Object
—————————————————————————- # Helper functions to parse ldap_auth.conf server entries —————————————————————————- #
230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/opennebula/ldap_auth.rb', line 230 def to_array(name) if name.is_a? Array name elsif name.is_a? Hash if name.keys.size == 1 [name.values].flatten else STDERR.puts "invalid group configuration: #{name}" exit(-1) end else [name] end end |