forked from tinova/one-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoneirb
executable file
·66 lines (50 loc) · 1.35 KB
/
oneirb
1
2
3
4
5
6
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
59
60
61
62
63
64
65
#!/usr/bin/ruby
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
VAR_LOCATION = "/var/lib/one"
TEMPLATE_LOCATION="/etc/one/occi_templates"
CONFIGURATION_FILE = "/etc/one/occi-server.conf"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
VAR_LOCATION = ONE_LOCATION+"/var"
TEMPLATE_LOCATION=ONE_LOCATION+"/etc/occi_templates"
CONFIGURATION_FILE = ONE_LOCATION+"/etc/occi-server.conf"
end
OCCI_AUTH = VAR_LOCATION + "/.one/occi_auth"
$: << RUBY_LIB_LOCATION
$: << RUBY_LIB_LOCATION+"/cloud/occi"
$: << RUBY_LIB_LOCATION+"/cloud" # For the Repository Manager
################################################
# Required libraries
################################################
require 'rubygems'
require 'yaml'
require 'erb'
require 'tempfile'
require 'fileutils'
require 'json'
require 'opennebula'
include OpenNebula
require 'pp'
if ENV['ONE_AUTH']
authfile = ENV['ONE_AUTH']
else
authfile = "#{ENV['HOME']}/.one/one_auth"
end
# OpenNebula credentials
CREDENTIALS = File.read(authfile).strip
# XML_RPC endpoint where OpenNebula is listening
ENDPOINT = "http://localhost:2633/RPC2"
@client = Client.new(CREDENTIALS, ENDPOINT)
require "irb"
if __FILE__ == $0
IRB.start(__FILE__)
else
# check -e option
if /^-e$/ =~ $0
IRB.start(__FILE__)
else
IRB.setup(__FILE__)
end
end