foreman_ovirt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.2.2"
12
+ gem "jeweler", "~> 1.8.4"
13
+ # gem "rcov", ">= 0"
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.9)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ git (1.2.5)
8
+ i18n (0.6.1)
9
+ jeweler (1.8.4)
10
+ bundler (~> 1.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ rdoc
14
+ json (1.7.5)
15
+ multi_json (1.3.7)
16
+ rake (10.0.2)
17
+ rdoc (3.12)
18
+ json (~> 1.4)
19
+ shoulda (3.3.2)
20
+ shoulda-context (~> 1.0.1)
21
+ shoulda-matchers (~> 1.4.1)
22
+ shoulda-context (1.0.1)
23
+ shoulda-matchers (1.4.1)
24
+ activesupport (>= 3.0.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ bundler (~> 1.2.2)
31
+ jeweler (~> 1.8.4)
32
+ rdoc (~> 3.12)
33
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Oved Ourfali
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,23 @@
1
+ = foreman_ovirt
2
+
3
+ Test engine for ovirt-foreman integration
4
+
5
+ = Install
6
+
7
+ Add to gemfile
8
+
9
+ gem 'foreman_ovirt', :git => "https://github.com/isratrade/foreman_ovirt"
10
+
11
+ Currently, you must use the branch "test_engine" under "https://github.com/isratrade/foreman" since this version removes the catchall in routes.rb and v1.rb and adds a forward slash to :controller => '/unattended' in hosts_helper.rb.
12
+
13
+ = Usage
14
+
15
+ Go to view host and add /ovirt to the path
16
+
17
+ Example: localhost/hosts/foreman-test.sat.lab.tlv.redhat.com/ovirt
18
+
19
+ == Copyright
20
+
21
+ Copyright (c) 2012 Oved Ourfali. See LICENSE.txt for
22
+ further details.
23
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "foreman_ovirt"
18
+ gem.homepage = "http://github.com/oourfali/foreman_ovirt"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Plugin engine for Foreman-Ovirt integration}
21
+ gem.description = %Q{Foreman oVirt plugin}
22
+ gem.email = "ovedo@redhat.com"
23
+ gem.authors = ["Oved Ourfali"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ #Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ # require 'rcov/rcovtask'
36
+ # Rcov::RcovTask.new do |test|
37
+ # test.libs << 'test'
38
+ # test.pattern = 'test/**/test_*.rb'
39
+ # test.verbose = true
40
+ # test.rcov_opts << '--exclude "gems/*"'
41
+ # end
42
+
43
+ task :default => :test
44
+
45
+ require 'rdoc/task'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "foreman_ovirt #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,57 @@
1
+ module ForemanOvirt
2
+ class AuthSourceOvirtsController < ApplicationController
3
+ layout 'layouts/application_ovirt'
4
+ skip_before_filter :verify_authenticity_token
5
+ def index
6
+ @auth_source_ovirts = AuthSourceOvirt.all
7
+ respond_to do |format|
8
+ format.html { }
9
+ format.json { render :json => @auth_source_ovirts }
10
+ end
11
+ end
12
+
13
+ def show
14
+ @auth_source_ovirt = AuthSourceOvirt.find(params[:id])
15
+ respond_to do |format|
16
+ format.html { }
17
+ format.json { render :json => @auth_source_ovirt }
18
+ end
19
+ end
20
+
21
+ def new
22
+ @auth_source_ovirt = AuthSourceOvirt.new
23
+ end
24
+
25
+ def create
26
+ @auth_source_ovirt = AuthSourceOvirt.new(params[:foreman_ovirt_auth_source_ovirt])
27
+ if @auth_source_ovirt.save
28
+ process_success
29
+ else
30
+ process_error
31
+ end
32
+ end
33
+
34
+ def edit
35
+ @auth_source_ovirt = AuthSourceOvirt.find(params[:id])
36
+ end
37
+
38
+ def update
39
+ @auth_source_ovirt = AuthSourceOvirt.find(params[:id])
40
+ if @auth_source_ovirt.update_attributes(params[:foreman_ovirt_auth_source_ovirt])
41
+ process_success
42
+ else
43
+ process_error
44
+ end
45
+ end
46
+
47
+ def destroy
48
+ @auth_source_ovirt = AuthSourceOvirt.find(params[:id])
49
+ if @auth_source_ovirt.destroy
50
+ process_success
51
+ else
52
+ process_error
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,10 @@
1
+ module ForemanOvirt
2
+ class DashboardController < ::DashboardController
3
+
4
+ layout 'layouts/application_ovirt'
5
+
6
+ def index
7
+ render :action => 'dashboard/index'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ module ForemanOvirt
2
+ class HostsController < ::HostsController
3
+
4
+ skip_before_filter :verify_authenticity_token
5
+ layout 'layouts/application_ovirt'
6
+
7
+ def show
8
+ super
9
+ end
10
+
11
+ def show_graphs
12
+ @host = ::Host.find_by_name(params[:id])
13
+ show
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,78 @@
1
+ module ForemanOvirt
2
+ class AuthSourceOvirt < AuthSource
3
+ validates_presence_of :host, :port
4
+ validates_length_of :host, :port, :maximum => 60, :allow_nil => false
5
+ validates_numericality_of :port, :only_integer => true
6
+
7
+ def authenticate(login, password)
8
+
9
+ # oVirt passes the username with "ovirt_" prefix. We remove it in this function.
10
+ # The login name in Foreman will include the "ovirt_" prefix, but all the other user details won't
11
+ # The reason for this prefix is that the login source of this user will always be the oVirt Authentication source
12
+ login = login.sub("ovirt_","")
13
+
14
+ userDetails = get_user_details(login, password)
15
+
16
+ return nil unless !userDetails.nil?
17
+
18
+ # In case a field is empty, we put the login as the value
19
+ # The oVirt login must be in the form of user@domain, so it is also valid as
20
+ # E-mail value
21
+ attrs = {:firstname => userDetails.has_key?('name') ? userDetails['name'] : login.split("@")[0],
22
+ :lastname => userDetails['surname'],
23
+ :mail => userDetails.has_key?('email') ? userDetails['email'] : login,
24
+ :auth_source_id => self.id }
25
+ attrs
26
+ end
27
+
28
+ def auth_method_name
29
+ "OVIRT"
30
+ end
31
+ alias_method :to_label, :auth_method_name
32
+
33
+ def can_set_password?
34
+ false
35
+ end
36
+
37
+ private
38
+
39
+ def get_user_details(login, password)
40
+ response = get_user_from_ovirt(login, password)
41
+ userDetails = !response.nil? ? JSON.parse(response) : nil
42
+ userDetails
43
+ end
44
+
45
+ def get_user_from_ovirt(login, password)
46
+ logger.debug "oVirt-Auth with User " + login
47
+ logger.debug "oVirt host name is " + host
48
+ logger.debug "oVirt port number is " + port.to_s()
49
+
50
+ prefix = tls ? 'https' : 'http'
51
+ url=prefix + '://' + host + ':' + port.to_s()
52
+
53
+ logger.debug "oVirt URL is " + url
54
+
55
+ # password contains the oVirt engine session ID followed by the
56
+ # guid of the user
57
+ user_id_location = password.rindex(';')
58
+ user_id = password[user_id_location + 1 .. password.length()]
59
+ session_id = password[0 .. user_id_location - 1]
60
+
61
+ session_id_escaped = Rack::Utils.escape(session_id)
62
+
63
+ # The password we get is the REST session ID
64
+ # We set it in the cookie, using the "Prefer" header
65
+ # to keep the session alive
66
+ session_id = ({ :JSESSIONID => session_id_escaped })
67
+ headers = ({ :content_type => 'application/json',
68
+ :accept => 'application/json',
69
+ :Prefer => "persistent-auth",
70
+ :cookies => ( session_id )
71
+ })
72
+
73
+ # We query for the user, to get its details
74
+ response = RestClient::Resource.new(url)['/api/users/' + user_id].get(headers)
75
+ response
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,25 @@
1
+ module ForemanOvirt
2
+ module UserExtensions
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ after_save :add_role_to_user
6
+ end
7
+
8
+ module InstanceMethods
9
+ def add_role_to_user
10
+ user_auth_source = AuthSource.find(auth_source)
11
+ if (user_auth_source && user_auth_source.type == "AuthSourceOvirt")
12
+ #if auth_source is ovirt
13
+ ovirt_role_id = Role.find_by_name("Ovirt").id
14
+ if (!user_roles.find_by_role_id(ovirt_role_id))
15
+ puts ovirt_role_id
16
+ user_roles.create(:role_id => ovirt_role_id)
17
+ puts "add_role_to_user"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ # Add Ovirt role to ovirt user
25
+ User.send :include, ForemanOvirt::UserExtensions
@@ -0,0 +1,17 @@
1
+ <% title_actions link_to(icon_text("question-sign", "Documentation", :class => "icon-white"), "http://theforeman.org/projects/foreman/wiki/LDAP_Authentication", :rel => "external", :class => "btn-info") %>
2
+
3
+ <%= form_for @auth_source_ovirt, :url => auth_source_ovirts_path do |f| %>
4
+ <%= base_errors_for @auth_source_ovirt %>
5
+
6
+ <%= text_f f, :name %>
7
+ <%= text_f f, :host %>
8
+ <%= text_f f, :port %>
9
+ <%= checkbox_f f, :tls, :label => "HTTPS", :checked => true %>
10
+ <%#= text_f f, :account, :help_inline =>"Use this account to authenticate,<i>optional</i>".html_safe %>
11
+ <%#= password_f f, :account_password, :onfocus => "this.value='';", :help_inline => "Use this account to authenticate, <i>optional</i>".html_safe %>
12
+ <%#= text_f f, :base_dn, :label => "basedn", :class => "input-xxlarge" %>
13
+ <%= checkbox_f f, :onthefly_register, :label => "On-the-fly user creation",
14
+ :help_inline => "oVirt user will have his Foreman account automatically created the first time he logs into Foreman", :checked => true %>
15
+
16
+ <%= submit_or_cancel f %>
17
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <% title "Edit Auth Source oVirt" %>
2
+
3
+ <%= render :partial => 'form' %>
@@ -0,0 +1,22 @@
1
+ <% title "oVirt Authentication" %>
2
+
3
+ <% title_actions link_to("New oVirt Authentication Source", new_auth_source_ovirt_path) %>
4
+
5
+ <table class="table table-bordered table-striped">
6
+ <tr>
7
+ <th>Name</th>
8
+ <th>Host</th>
9
+ <th>On the fly Register</th>
10
+ <th>HTTPS</th>
11
+ <th></th>
12
+ </tr>
13
+ <% for auth_source_ovirt in @auth_source_ovirts %>
14
+ <tr>
15
+ <td><%=h auth_source_ovirt.name %></td>
16
+ <td><%=h auth_source_ovirt.host %></td>
17
+ <td><%=checked_icon auth_source_ovirt.onthefly_register %></td>
18
+ <td><%=checked_icon auth_source_ovirt.tls %></td>
19
+ <td><%=link_to ("Delete", auth_source_ovirt_path(auth_source_ovirt.id), :method => :delete, :confirm => "Delete #{auth_source_ovirt.name}?") %></td>
20
+ </tr>
21
+ <% end %>
22
+ </table>
@@ -0,0 +1,3 @@
1
+ <% title "New Auth Source oVirt" %>
2
+
3
+ <%= render :partial => 'form' %>
@@ -0,0 +1,8 @@
1
+ <% title_actions link_to("New authentication source", new_auth_source_ovirt) %>
2
+ <% title "Authentication source configuration" %>
3
+ <div id="welcome">
4
+ <p> Foreman can use oVirt based service for user information and authentication.<p>
5
+
6
+ <p> The authentication process currently requires an oVirt engine.</p>
7
+ </div>
8
+
@@ -0,0 +1,27 @@
1
+ <table class="table table-bordered table-striped">
2
+ <%# CHANGED HERE %>
3
+
4
+ <!-- <tr>
5
+ <th>Details</th>
6
+ </tr>
7
+ <tr>
8
+ <td>
9
+ <%#= link_to_if_authorized("Audits", hash_for_host_audits_path(:host_id => @host), :title => "Host audit entries" , :class => 'btn btn-small') %>
10
+ <%#= link_to_if_authorized("Facts", hash_for_host_facts_path(:host_id => @host), :title => "Browse host facts" , :class => 'btn btn-small') %>
11
+ <%#= link_to_if_authorized("Reports", hash_for_host_reports_path(:host_id => @host), :title => "Browse host reports" , :class => 'btn btn-small') %>
12
+ <%#= link_to("YAML", externalNodes_host_path(:name => @host), :title => "Puppet external nodes YAML dump" , :class => 'btn btn-small') %>
13
+ </td>
14
+ </tr> -->
15
+ </table>
16
+ <table class="table table-bordered table-striped">
17
+ <tr>
18
+ <th>Properties</th>
19
+ <th></th>
20
+ </tr>
21
+ <% overview_fields(host).each do |name, value| -%>
22
+ <tr>
23
+ <td><%= name %></td>
24
+ <td><%= value %></td>
25
+ </tr>
26
+ <% end -%>
27
+ </table>
@@ -0,0 +1,48 @@
1
+ <% javascript 'charts' %>
2
+ <% title @host.to_label, icon(@host.os) + @host.to_label %>
3
+
4
+ <% @vm = @host.compute_resource.find_vm_by_uuid(@host.uuid) rescue nil %>
5
+ <%#= host_title_actions(@host, @vm) %>
6
+ <% content_for(:search_bar) {reports_show} %>
7
+
8
+ <div class="row-fluid">
9
+ <div class="span4">
10
+ <ul id="myTab" class="nav nav-tabs">
11
+ <li class="active"><a href="#properties" data-toggle="tab">Properties</a></li>
12
+ <li><a href="#metrics" data-toggle="tab">Metrics</a></li>
13
+ <% if SETTINGS[:unattended] %>
14
+ <li><a href="#template" data-toggle="tab">Templates</a></li>
15
+ <% end %>
16
+ <% if @vm %>
17
+ <li><a href="#vm" data-toggle="tab">Virtual Machine</a></li>
18
+ <% end %>
19
+ </ul>
20
+ <div id="myTabContent" class="tab-content">
21
+ <div class="tab-pane active in" id="properties">
22
+ <%# CHANGED HERE %>
23
+ <%= render :partial => "foreman_ovirt/hosts/overview", :locals => { :host => @host } %>
24
+ </div>
25
+ <div class="tab-pane" id="metrics">
26
+ <% if @report_summary.size == 0 -%>
27
+ <p>No puppet activity for this host in the last <%= @range %> days</p>
28
+ <% else -%>
29
+ <%= render :partial => "hosts/metrics", :locals => { :report_summary => @report_summary[@host.name][:metrics] } %>
30
+ <% end -%>
31
+ </div>
32
+ <div class="tab-pane" id="template">
33
+ <%= show_templates -%>
34
+ </div>
35
+ <div class="tab-pane" id="vm">
36
+ <% if @vm %>
37
+ <% @compute_resource = @host.compute_resource %>
38
+ <%= render("compute_resources_vms/show/#{@host.compute_resource.provider.downcase}") rescue nil %>
39
+ <% end %>
40
+ </div>
41
+
42
+ </div>
43
+ </div>
44
+ <div class="span8">
45
+ <%= runtime_chart 'runtime_graph', 'Runtime', "last #{@range} days", @host.runtime_chart(@range.days.ago) %>
46
+ <%= report_status_chart 'resource_graph', 'Resources', "last #{@range} days", @host.resources_chart(@range.days.ago) %>
47
+ </div>
48
+ </div>
@@ -0,0 +1,13 @@
1
+ <% javascript 'charts' %>
2
+ <% title @host.to_label, icon(@host.os) + @host.to_label %>
3
+
4
+ <% @vm = @host.compute_resource.find_vm_by_uuid(@host.uuid) rescue nil %>
5
+ <%#= host_title_actions(@host, @vm) %>
6
+ <% content_for(:search_bar) {reports_show} %>
7
+
8
+ <div class="row-fluid">
9
+ <div class="span8">
10
+ <%= runtime_chart 'runtime_graph', 'Runtime', "last #{@range} days", @host.runtime_chart(@range.days.ago) %>
11
+ <%= report_status_chart 'resource_graph', 'Resources', "last #{@range} days", @host.resources_chart(@range.days.ago) %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title> <%= h(yield(:title) || "Foreman") %></title>
5
+ <%= stylesheet_link_tag 'jquery-ui', 'jquery.jnotify', 'bootstrap.min', 'style', 'bootstrap-responsive.min' %>
6
+ <%#If we need ovirt.css, put it on foreman/public, and add it here= stylesheet_link_tag 'jquery-ui', 'jquery.jnotify', 'bootstrap.min', 'style', 'bootstrap-responsive.min', 'ovirt' %>
7
+ <%= javascript_include_tag :defaults, 'jquery_ujs', 'jquery-ui', 'highcharts', 'charts', 'jquery.jnotify', 'jquery.jeditable',
8
+ 'bootstrap.min' %>
9
+ <%= csrf_meta_tag %>
10
+ <%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
11
+ <meta name="apple-mobile-web-app-capable" content="yes">
12
+ <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0;" />
13
+ <%= yield(:head) %>
14
+ </head>
15
+
16
+ <body>
17
+ <div id="wrap">
18
+
19
+ <div id="main-ovirt">
20
+ <%#= content_tag('div', flash[:error], :class => 'flash error') if flash[:error] -%>
21
+ <%#= content_tag('div', flash[:warning], :class => 'flash warning') if flash[:warning] -%>
22
+ <%#= content_tag('div', flash[:notice], :class => 'flash notice') if flash[:notice] -%>
23
+ <%#= render 'common/notice' unless @notices.empty? -%>
24
+ <div id="content" class="container">
25
+ <div class="row">
26
+ <div id="title_action" class="span0">
27
+ <div class="btn-toolbar ra"><%=h yield(:title_actions) %></div>
28
+ </div>
29
+ </div>
30
+
31
+ <%= yield %>
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -0,0 +1,27 @@
1
+ # Add permissions
2
+ Foreman::AccessControl.map do |map|
3
+ map.security_block :ovirt do |map|
4
+ map.permission :view_ovirt, { 'foreman_ovirt/hosts' => [:show, :show_graphs],
5
+ 'foreman_ovirt/dashboard' => [:index] }
6
+ end
7
+ end
8
+
9
+ # Add a new role called 'oVirt' if it doesn't exist
10
+ Role.transaction do
11
+ ovirt_role = Role.find_or_create_by_name("Ovirt")
12
+ if ovirt_role.permissions.empty?
13
+ ovirt_role.update_attribute :permissions, [:view_ovirt]
14
+ end
15
+ end
16
+ #require 'foreman_ovirt/auth_source_ovirt'
17
+ # Adding an oVirt authentication source for all the oVirt compute resources
18
+ User.current = User.admin
19
+ ForemanOvirt::AuthSourceOvirt.transaction do
20
+ Foreman::Model::Ovirt.unscoped.all.each do |compute_resource|
21
+ name = compute_resource.name
22
+ next if ForemanOvirt::AuthSourceOvirt.find_by_name(name)
23
+ url = URI(compute_resource.url)
24
+ tls = url.scheme == "https" ? true : false
25
+ ForemanOvirt::AuthSourceOvirt.create(:name => name, :host => url.host, :port => url.port, :onthefly_register => true, :tls => tls)
26
+ end
27
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,16 @@
1
+ Rails.application.routes.draw do
2
+
3
+ constraints(:id => /[^\/]+/) do
4
+ # Special show host for oVirt
5
+ get "hosts/:id/ovirt" => "foreman_ovirt/hosts#show"
6
+
7
+ # Special show host graphs for oVirt
8
+ get "hosts/:id/graphs/ovirt" => "foreman_ovirt/hosts#show_graphs"
9
+ end
10
+
11
+ # auth_source_ovirt resource
12
+ resources :auth_source_ovirts, :controller => "foreman_ovirt/auth_source_ovirts"
13
+
14
+ # Special dashboard for oVirt
15
+ get "dashboard/ovirt" => "foreman_ovirt/dashboard#index"
16
+ end
@@ -0,0 +1,74 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "foreman_ovirt"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Oved Ourfali"]
12
+ s.date = "2012-12-20"
13
+ s.description = "Foreman oVirt plugin"
14
+ s.email = "ovedo@redhat.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "app/controllers/foreman_ovirt/auth_source_ovirts_controller.rb",
28
+ "app/controllers/foreman_ovirt/dashboard_controller.rb",
29
+ "app/controllers/foreman_ovirt/hosts_controller.rb",
30
+ "app/models/foreman_ovirt/auth_source_ovirt.rb",
31
+ "app/models/foreman_ovirt/user_extensions.rb",
32
+ "app/views/foreman_ovirt/auth_source_ovirts/_form.html.erb",
33
+ "app/views/foreman_ovirt/auth_source_ovirts/edit.html.erb",
34
+ "app/views/foreman_ovirt/auth_source_ovirts/index.html.erb",
35
+ "app/views/foreman_ovirt/auth_source_ovirts/new.html.erb",
36
+ "app/views/foreman_ovirt/auth_source_ovirts/welcome.html.erb",
37
+ "app/views/foreman_ovirt/hosts/_overview.html.erb",
38
+ "app/views/foreman_ovirt/hosts/show.html.erb",
39
+ "app/views/foreman_ovirt/hosts/show_graphs.html.erb",
40
+ "app/views/layouts/application_ovirt.html.erb",
41
+ "config/initializers/ovirt_setup.rb",
42
+ "config/routes.rb",
43
+ "foreman_ovirt.gemspec",
44
+ "lib/engine.rb",
45
+ "lib/foreman_ovirt.rb"
46
+ ]
47
+ s.homepage = "http://github.com/oourfali/foreman_ovirt"
48
+ s.licenses = ["MIT"]
49
+ s.require_paths = ["lib"]
50
+ s.rubygems_version = "1.8.10"
51
+ s.summary = "Plugin engine for Foreman-Ovirt integration"
52
+
53
+ if s.respond_to? :specification_version then
54
+ s.specification_version = 3
55
+
56
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
58
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_development_dependency(%q<bundler>, ["~> 1.2.2"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
61
+ else
62
+ s.add_dependency(%q<shoulda>, [">= 0"])
63
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
64
+ s.add_dependency(%q<bundler>, ["~> 1.2.2"])
65
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
66
+ end
67
+ else
68
+ s.add_dependency(%q<shoulda>, [">= 0"])
69
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
70
+ s.add_dependency(%q<bundler>, ["~> 1.2.2"])
71
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
72
+ end
73
+ end
74
+
data/lib/engine.rb ADDED
@@ -0,0 +1,9 @@
1
+ module ForemanOvirt
2
+ class Engine < ::Rails::Engine
3
+
4
+ config.to_prepare do
5
+ User.send :include, ForemanOvirt::UserExtensions
6
+ end
7
+ end
8
+ end
9
+
@@ -0,0 +1,3 @@
1
+ module ForemanOvirt
2
+ require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
3
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: foreman_ovirt
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Oved Ourfali
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-12-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rdoc
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ hash: 31
43
+ segments:
44
+ - 3
45
+ - 12
46
+ version: "3.12"
47
+ type: :development
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: bundler
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 27
58
+ segments:
59
+ - 1
60
+ - 2
61
+ - 2
62
+ version: 1.2.2
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: jeweler
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ hash: 63
74
+ segments:
75
+ - 1
76
+ - 8
77
+ - 4
78
+ version: 1.8.4
79
+ type: :development
80
+ version_requirements: *id004
81
+ description: Foreman oVirt plugin
82
+ email: ovedo@redhat.com
83
+ executables: []
84
+
85
+ extensions: []
86
+
87
+ extra_rdoc_files:
88
+ - LICENSE.txt
89
+ - README.rdoc
90
+ files:
91
+ - .document
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
95
+ - README.rdoc
96
+ - Rakefile
97
+ - VERSION
98
+ - app/controllers/foreman_ovirt/auth_source_ovirts_controller.rb
99
+ - app/controllers/foreman_ovirt/dashboard_controller.rb
100
+ - app/controllers/foreman_ovirt/hosts_controller.rb
101
+ - app/models/foreman_ovirt/auth_source_ovirt.rb
102
+ - app/models/foreman_ovirt/user_extensions.rb
103
+ - app/views/foreman_ovirt/auth_source_ovirts/_form.html.erb
104
+ - app/views/foreman_ovirt/auth_source_ovirts/edit.html.erb
105
+ - app/views/foreman_ovirt/auth_source_ovirts/index.html.erb
106
+ - app/views/foreman_ovirt/auth_source_ovirts/new.html.erb
107
+ - app/views/foreman_ovirt/auth_source_ovirts/welcome.html.erb
108
+ - app/views/foreman_ovirt/hosts/_overview.html.erb
109
+ - app/views/foreman_ovirt/hosts/show.html.erb
110
+ - app/views/foreman_ovirt/hosts/show_graphs.html.erb
111
+ - app/views/layouts/application_ovirt.html.erb
112
+ - config/initializers/ovirt_setup.rb
113
+ - config/routes.rb
114
+ - foreman_ovirt.gemspec
115
+ - lib/engine.rb
116
+ - lib/foreman_ovirt.rb
117
+ homepage: http://github.com/oourfali/foreman_ovirt
118
+ licenses:
119
+ - MIT
120
+ post_install_message:
121
+ rdoc_options: []
122
+
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ requirements: []
144
+
145
+ rubyforge_project:
146
+ rubygems_version: 1.8.10
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: Plugin engine for Foreman-Ovirt integration
150
+ test_files: []
151
+