foreman-katello-engine 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -67,4 +67,17 @@ To execute a single test file run:
67
67
  Licence
68
68
  -------
69
69
 
70
- GPLv2
70
+ Copyright (c) 2013 Red Hat Inc.
71
+
72
+ This program is free software: you can redistribute it and/or modify
73
+ it under the terms of the GNU General Public License as published by
74
+ the Free Software Foundation, either version 3 of the License, or
75
+ (at your option) any later version.
76
+
77
+ This program is distributed in the hope that it will be useful,
78
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
79
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80
+ GNU General Public License for more details.
81
+
82
+ You should have received a copy of the GNU General Public License
83
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -5,6 +5,6 @@ class UpdateEnvironmentsAddKatelloId < ActiveRecord::Migration
5
5
  end
6
6
 
7
7
  def down
8
- remote_column :environment, :katello_id
8
+ remove_column :environment, :katello_id
9
9
  end
10
10
  end
@@ -1,14 +1,21 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "foreman-katello-engine"
3
- s.version = "0.0.7"
3
+ s.version = "0.0.8"
4
4
 
5
5
  s.authors = ["Katello"]
6
6
  s.date = "2013-03-04"
7
7
  s.description = "Katello specific parts of Foreman"
8
8
  s.email = "katello-devel@redhat.com"
9
- s.files = `git ls-files`.split("\n")
9
+ s.files = %w(foreman-katello-engine.gemspec Gemfile LICENSE Rakefile README.md)
10
+ s.files += Dir["app/**/*.rb"]
11
+ s.files += Dir["config/**/*.rb"]
12
+ s.files += Dir["db/**/*.rb"]
13
+ s.files += Dir["lib/**/*.rb"]
14
+ s.files += Dir["test/test_helper.rb"]
15
+ s.files += Dir["test/lib/**/*.rb"]
16
+ s.files += Dir["test/functional/**/*.rb"]
10
17
  s.homepage = "http://github.com/katello/foreman-katello-engine"
11
- s.licenses = ["GPL-2"]
18
+ s.licenses = ["GPL-3"]
12
19
  s.require_paths = ["lib"]
13
20
  s.add_dependency "katello_api"
14
21
  s.add_dependency "deface", "~> 0.7.2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-katello-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -49,46 +49,36 @@ executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
- - .gitignore
53
- - .travis.yml
52
+ - foreman-katello-engine.gemspec
54
53
  - Gemfile
55
54
  - LICENSE
56
- - README.md
57
55
  - Rakefile
58
- - app/assets/images/foreman_katello_engine/link.png
59
- - app/controllers/foreman_katello_engine/activation_keys_controller.rb
60
- - app/controllers/foreman_katello_engine/api/environments_controller.rb
61
- - app/helpers/foreman_katello_engine/hosts_and_hostgroups_helper.rb
62
- - app/helpers/foreman_katello_engine/katello_urls_helper.rb
56
+ - README.md
63
57
  - app/models/foreman_katello_engine/environment.rb
64
58
  - app/models/setting/katello.rb
59
+ - app/helpers/foreman_katello_engine/hosts_and_hostgroups_helper.rb
60
+ - app/helpers/foreman_katello_engine/katello_urls_helper.rb
65
61
  - app/overrides/add_activation_keys_input.rb
66
62
  - app/overrides/add_katello_link.rb
67
- - app/views/foreman_katello_engine/activation_keys/_host_environment_select.html.erb
68
- - app/views/foreman_katello_engine/activation_keys/_host_tab.html.erb
69
- - app/views/foreman_katello_engine/activation_keys/_host_tab_pane.html.erb
70
- - app/views/foreman_katello_engine/layout/_katello_link.html.erb
71
- - app/views/unattended/kickstart-katello.erb
72
- - app/views/unattended/snippets/_katello_registration.erb
63
+ - app/controllers/foreman_katello_engine/api/environments_controller.rb
64
+ - app/controllers/foreman_katello_engine/activation_keys_controller.rb
73
65
  - config/routes.rb
74
- - db/migrate/20130416152224_add_katello_templates.rb
75
66
  - db/migrate/20130418105901_add_katello_ptables.rb
67
+ - db/migrate/20130416152224_add_katello_templates.rb
76
68
  - db/migrate/20130419110332_update_environments_add_katello_id.rb
77
- - foreman-katello-engine.gemspec
78
69
  - lib/foreman-katello-engine.rb
79
- - lib/foreman_katello_engine.rb
80
- - lib/foreman_katello_engine/bindings.rb
81
70
  - lib/foreman_katello_engine/engine.rb
82
71
  - lib/foreman_katello_engine/renderer.rb
83
- - script/rails
72
+ - lib/foreman_katello_engine/bindings.rb
73
+ - lib/foreman_katello_engine.rb
74
+ - test/test_helper.rb
75
+ - test/lib/settings_test.rb
76
+ - test/lib/bindings_test.rb
84
77
  - test/functional/activation_keys_controller_test.rb
85
78
  - test/functional/api/environments_controller_test.rb
86
- - test/lib/bindings_test.rb
87
- - test/lib/settings_test.rb
88
- - test/test_helper.rb
89
79
  homepage: http://github.com/katello/foreman-katello-engine
90
80
  licenses:
91
- - GPL-2
81
+ - GPL-3
92
82
  post_install_message:
93
83
  rdoc_options: []
94
84
  require_paths:
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- Gemfile.lock
2
- test/foreman_app
3
- .bundle
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "1.8.7"
4
- - "1.9.3"
5
- before_install: rake test:foreman_prepare
6
- script: rake test
@@ -1,13 +0,0 @@
1
- <style>
2
- option.kt-env { margin-left: 0em; }
3
- option.kt-cv { margin-left: 1em; }
4
- </style>
5
-
6
- <%= field(f, :environment_id, {:include_blank => true}) do
7
- f.select :environment_id,
8
- grouped_env_options,
9
- {:include_blank =>true},
10
- {:onchange => 'update_puppetclasses(this);',
11
- :"data-url" => environment_selected_hostgroups_path,
12
- :'data-host-id' => (@host && @host.id)}
13
- end %>
@@ -1,3 +0,0 @@
1
- <li id="activation_keys_tab">
2
- <a href="#activation_keys" data-toggle="tab">Activation Keys</a>
3
- </li>
@@ -1,250 +0,0 @@
1
- <%= javascript_tag do %>
2
-
3
- $(function() {
4
- var KT_AK_LABEL = "<%= kt_ak_label %>";
5
- var availableActivationKeys = {};
6
-
7
- function ktLoadActivationKeys() {
8
- if(ktSelectedOrgEnvCv()[0]) {
9
- ktAkTab().show();
10
- } else {
11
- ktAkTab().hide();
12
- return; //no Katello-specific env selected
13
- }
14
-
15
- $("#ak-subscriptions-info").hide();
16
- $("#ak-subscriptions-spinner").show();
17
- var url = foreman_url('/foreman_katello_engine/activation_keys');
18
- var environmentId = $("#hostgroup_environment_id").val();
19
- if(environmentId) {
20
- $.ajax({
21
- type: 'get',
22
- url: url,
23
- data:'environment_id=' + environmentId,
24
- success: function(response) {
25
- availableActivationKeys = response;
26
- },
27
- error: function(error) {
28
- $.jnotify("Error while loading activation keys from Katello", { type: "error", sticky: true });
29
- },
30
- complete: function() {
31
- ktAkUpdateSubscriptionsInfo();
32
- }
33
- });
34
- } else {
35
- availableActivationKeys = {};
36
- ktAkUpdateSubscriptionsInfo();
37
- }
38
- }
39
-
40
- function ktFindParamContainer(name){
41
- var ret;
42
- $("div#parameters div.control-group input[ type = 'text']").each(function () {
43
- element = $(this);
44
- if(element.val() == name) {
45
- ret = element.parent();
46
- return false;
47
- }
48
- });
49
- return ret;
50
- }
51
-
52
- function ktOrganizations() {
53
- return $.grep($("#organizations #hostgroup_organization_ids option"), function (el) {
54
- return $(el).text().trim().match(/^KT-/)
55
- });
56
- }
57
-
58
- function ktParseOrgName(frOrgName) {
59
- return frOrgName.match(/^kt-\[(.*)\]\[(.*)\]$/);
60
- }
61
-
62
- function ktHideParams() {
63
- var paramsToHide = [ktFindParamContainer(KT_AK_LABEL),
64
- ktFindParamContainer('kt_org'),
65
- ktFindParamContainer('kt_env')];
66
- $.each(paramsToHide, function (i, paramContainer) {
67
- if(paramContainer) {
68
- paramContainer.hide();
69
- }
70
- });
71
- }
72
-
73
- function ktSelectedOrgEnvCv() {
74
- var selectedEnvId = $("#hostgroup_environment_id").val();
75
- var selectedOption = $("#hostgroup_environment_id option[ value ='" + selectedEnvId + "' ]");
76
-
77
- var ktEnvOption, ktCvOption, ktOrgLabel, ktEnvLabel, ktCvLabel;
78
- if(selectedOption.hasClass('kt-cv')) {
79
- ktCvOption = selectedOption;
80
- ktEnvOption = ktCvOption.prevAll('option.kt-env').first();
81
- } else if(selectedOption.hasClass('kt-env')) {
82
- ktEnvOption = selectedOption;
83
- }
84
-
85
- if(ktEnvOption) {
86
- ktEnvLabel = ktEnvOption.text();
87
- ktOrgLabel = ktEnvOption.parent().attr('label');
88
- }
89
-
90
- if(ktCvOption) {
91
- ktCvLabel = ktCvOption.text();
92
- }
93
- return [ktOrgLabel, ktEnvLabel, ktCvLabel];
94
- }
95
-
96
- function ktSetParam(name, value) {
97
- var paramContainer = ktFindParamContainer(name);
98
- if(value) {
99
- if(! paramContainer) { // we create the param for kt_activation_keys
100
- $("div#parameters a.btn-success").click();
101
- paramContainer = $("div#parameters div.control-group").last();
102
- paramContainer.find("input").val(name);
103
- }
104
- paramContainer.find("textarea").val(value);
105
- } else if(paramContainer) {
106
- // we remove the param by setting destoy to 1
107
- paramContainer.find("input[ type = 'hidden' ]").val(1);
108
- }
109
-
110
- }
111
-
112
- function ktEnvToParam() {
113
- var orgEnvCv = ktSelectedOrgEnvCv() || [];
114
- ktSetParam('kt_org', orgEnvCv[0]);
115
- ktSetParam('kt_env', orgEnvCv[1]);
116
- ktSetParam('kt_cv', orgEnvCv[2]);
117
- }
118
-
119
- function ktEnvToFrOrganizations() {
120
- var orgEnvCv = ktSelectedOrgEnvCv() || [];
121
-
122
- var orgName = "";
123
- if(orgEnvCv[0]) {
124
- orgName = 'KT-[' + orgEnvCv[0] + ']';
125
- }
126
-
127
- $.each(ktOrganizations(), function (i, option) {
128
- if(orgName == $(option).text().trim()) {
129
- $("#hostgroup_organization_ids").multiSelect('select', $(option).val());
130
- } else {
131
- $("#hostgroup_organization_ids").multiSelect('deselect', $(option).val());
132
- }
133
- });
134
- }
135
-
136
- function ktParamToAkInput() {
137
- var paramContainer = ktFindParamContainer(KT_AK_LABEL);
138
- if(paramContainer) {
139
- $("#kt_activation_keys").val(paramContainer.find("textarea").val());
140
- }
141
- }
142
-
143
- function ktAkInputToParam() {
144
- var ktActivationKeysValue = $("#kt_activation_keys").val().replace(/,\s*/g,",").replace(/,$/g,"");
145
- ktSetParam(KT_AK_LABEL, ktActivationKeysValue);
146
- }
147
-
148
- function ktAkUpdateSubscriptionsInfo() {
149
- var subsInfo = $("ul#ak-subscriptions-info");
150
- subsInfo.empty();
151
- var selectedKeys = $("#kt_activation_keys").val().split(/,\s*/);
152
- $.each(selectedKeys, function(i, key) {
153
- if(availableActivationKeys[key]) {
154
- // hack to make it working with deface
155
- var ul = "<ul>", ul_end = "</ul>", li = "<li>", li_end = "</li>";
156
- content = li + key + ul;
157
- if(!availableActivationKeys[key].length == 0) {
158
- content += li;
159
- content += availableActivationKeys[key].join(li_end + li);
160
- content += li_end;
161
- }
162
- content += ul_end + li_end;
163
- subsInfo.append(content);
164
- }
165
- });
166
- $("#ak-subscriptions-info").show();
167
- $("#ak-subscriptions-spinner").hide();
168
- }
169
-
170
- function ktAkTab() {
171
- return $('li#activation_keys_tab');
172
- }
173
-
174
- function ktOnLoad() {
175
- ktHideParams();
176
- ktParamToAkInput();
177
- ktLoadActivationKeys();
178
- };
179
-
180
- function ktOnSubmit() {
181
- ktAkInputToParam();
182
- ktEnvToParam();
183
- ktEnvToFrOrganizations();
184
- }
185
-
186
-
187
- $("#kt_activation_keys").parents("form").submit(ktOnSubmit);
188
-
189
- ktOnLoad();
190
-
191
- $("#kt_activation_keys").autocomplete({
192
- minLength: 0,
193
- source: function(request, response) {
194
- var terms = request.term.split(/,\s*/);
195
- var part = terms.pop();
196
- var items = []
197
- for(key in availableActivationKeys) {
198
- if(terms.indexOf(key) == -1) {
199
- items.push(key);
200
- }
201
- }
202
- response($.ui.autocomplete.filter(
203
- items, part));
204
- },
205
- focus: function() {
206
- // prevent value inserted on focus
207
- return false;
208
- },
209
- select: function(event, ui) {
210
- var oldTerms = this.value.replace(/[^, ][^,]*$/,"");
211
- this.value = oldTerms + ui.item.value;
212
- ktAkUpdateSubscriptionsInfo();
213
- return false;
214
- },
215
- close: function() {
216
- ktAkUpdateSubscriptionsInfo();
217
- }
218
-
219
- }).bind("focus", function(event) {
220
- if($(this)[0].value == "") {
221
- $(this).autocomplete( "search" );
222
- }});
223
-
224
- $("#hostgroup_environment_id").change(ktLoadActivationKeys);
225
-
226
- $("#ak_refresh_subscriptions").click(function () {
227
- ktLoadActivationKeys();
228
- return false;
229
- });
230
-
231
- });
232
-
233
- <% end %>
234
- <div class="tab-pane" id="activation_keys">
235
- <%= field(f, "Activation Keys", :help_inline => "comma separated values. The value will be available in templates as @host.params['#{kt_ak_label}']") do
236
- text_field_tag("kt_activation_keys", "", :style => 'width: 98%')
237
- end %>
238
- <div class="alert alert-info">
239
- <p><b>Subscriptions information based on selected activation keys:</b></p>
240
- <ul id="ak-subscriptions-info">
241
- </ul>
242
- <div id="ak-subscriptions-spinner" style="display: none">
243
- <%= image_tag "spinner.gif" %>
244
- </div>
245
- <p>Activation keys and subscriptions can be managed
246
- <b><a href="<%= Setting['katello_url'] %>/activation_keys" target="_blank">here</a></b>
247
- </p>
248
- <p><a href="" id="ak_refresh_subscriptions">Reload data from Katello</a></p>
249
- </div>
250
- </div>
@@ -1,3 +0,0 @@
1
- <li>
2
- <%= link_to "#{ForemanKatelloEngine::LABEL} #{image_tag("foreman_katello_engine/link.png")}".html_safe, Setting['katello_url'] %>
3
- </li>
@@ -1,104 +0,0 @@
1
- install
2
- <%= @mediapath %>
3
- lang en_US.UTF-8
4
- selinux --permissive
5
- keyboard us
6
- skipx
7
- network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host %>
8
- rootpw --iscrypted <%= root_pass %>
9
- firewall --<%= @host.operatingsystem.major.to_i >= 6 ? "service=" : "" %>ssh
10
- authconfig --useshadow --enablemd5
11
- timezone UTC
12
- <% if @host.operatingsystem.name == "Fedora" -%>
13
- repo --name=fedora-everything --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %>
14
- <% end -%>
15
- <% if @host.operatingsystem.name == "Fedora" and @host.operatingsystem.major.to_i <= 16 -%>
16
- # Bootloader exception for Fedora 16:
17
- bootloader --append="nofb quiet splash=quiet <%=ks_console%>" <%= grub_pass %>
18
- part biosboot --fstype=biosboot --size=1
19
- <% else -%>
20
- bootloader --location=mbr --append="nofb quiet splash=quiet" <%= grub_pass %>
21
- <% end -%>
22
- <% if @host.os.name == "RedHat" -%>
23
- key --skip
24
- <% end -%>
25
-
26
- <% if @dynamic -%>
27
- %include /tmp/diskpart.cfg
28
- <% else -%>
29
- <%= @host.diskLayout %>
30
- <% end -%>
31
- text
32
- reboot
33
-
34
- %packages
35
- yum
36
- dhclient
37
- ntp
38
- wget
39
- @Core
40
- <%= "%end\n" if @host.operatingsystem.name == "Fedora" %>
41
-
42
- <% if @dynamic -%>
43
- %pre
44
- <%= @host.diskLayout %>
45
- <% end -%>
46
-
47
- %post --nochroot
48
- exec < /dev/tty3 > /dev/tty3
49
- #changing to VT 3 so that we can see whats going on....
50
- /usr/bin/chvt 3
51
- (
52
- cp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
53
- /usr/bin/chvt 1
54
- ) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log
55
- <%= "%end\n" if @host.operatingsystem.name == "Fedora" %>
56
-
57
- %post
58
- logger "Starting anaconda <%= @host %> postinstall"
59
- exec < /dev/tty3 > /dev/tty3
60
- #changing to VT 3 so that we can see whats going on....
61
- /usr/bin/chvt 3
62
- (
63
- #update local time
64
- echo "updating system time"
65
- /usr/sbin/ntpdate -sub <%= @host.params["ntp-server"] || "ntp" %>
66
- /usr/sbin/hwclock --systohc
67
-
68
- # install epel if we can
69
- <%= snippet 'epel' %>
70
-
71
- # update all the base packages from the updates repository
72
- yum -t -y -e 0 update
73
-
74
- <%= snippets "katello_registration" %>
75
-
76
- # and add the puppet package
77
- yum -t -y -e 0 install puppet
78
-
79
- echo "Configuring puppet"
80
- cat > /etc/puppet/puppet.conf << EOF
81
- <%= snippets "puppet.conf" %>
82
- EOF
83
-
84
- # Setup puppet to run on system reboot
85
- /sbin/chkconfig --level 345 puppet on
86
-
87
- # Disable most things. Puppet will activate these if required.
88
- echo "Disabling various system services"
89
- <% %w{autofs gpm sendmail cups iptables ip6tables auditd arptables_jf xfs pcmcia isdn rawdevices hpoj bluetooth openibd avahi-daemon avahi-dnsconfd hidd hplip pcscd restorecond mcstrans rhnsd yum-updatesd}.each do |service| -%>
90
- /sbin/chkconfig --level 345 <%= service %> off 2>/dev/null
91
- <% end -%>
92
-
93
- /usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize
94
-
95
- sync
96
-
97
- # Inform the build system that we are done.
98
- echo "Informing Foreman that we are built"
99
- wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
100
- # Sleeping an hour for debug
101
- ) 2>&1 | tee /root/install.post.log
102
- exit 0
103
-
104
- <%= "%end\n" if @host.operatingsystem.name == "Fedora" -%>
@@ -1,8 +0,0 @@
1
- <% if @host.params['kt_org'] and @host.params['kt_activation_keys'] %>
2
- # add subscription manager
3
- yum -t -y -e 0 install subscription-manager
4
- yum -y install <%= subscription_manager_configuration_url %>
5
-
6
- echo "Registering the System"
7
- subscription-manager register --org=<%= @host.params['kt_org']%> --name=<%= @host.name %> --activationkey=<%= @host.params['kt_activation_keys'] %>
8
- <% end %>
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/foreman_katello_engine/engine', __FILE__)
6
-
7
- require 'rails/all'
8
- require 'rails/engine/commands'