foreman_docker 1.0.1 → 1.1.0
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_docker/image_step.js +79 -39
- data/app/controllers/image_search_controller.rb +2 -1
- data/app/helpers/container_steps_helper.rb +22 -0
- data/app/models/container.rb +2 -1
- data/app/models/docker_container_wizard_state.rb +3 -1
- data/app/models/docker_container_wizard_states/preliminary.rb +2 -2
- data/app/models/docker_registry.rb +5 -2
- data/app/models/service/registry_api.rb +2 -2
- data/app/views/containers/steps/_form_buttons.html.erb +2 -1
- data/app/views/containers/steps/_image_hub_tab.html.erb +53 -0
- data/app/views/containers/steps/image.html.erb +27 -56
- data/app/views/image_search/_repository_search_results.html.erb +1 -1
- data/db/migrate/20150122011747_add_katello_flag_to_docker_wizard_image.rb +9 -0
- data/db/migrate/20150129054944_add_katello_flag_to_containers.rb +9 -0
- data/lib/foreman_docker/version.rb +1 -1
- data/test/functionals/containers_steps_controller_test.rb +18 -0
- data/test/units/docker_registry_test.rb +7 -2
- data/test/units/registry_api_test.rb +17 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e681e8c0ceee246d607633e6b910b9dc6ba280
|
4
|
+
data.tar.gz: 8e56c72c227e1a14cb14a22f44b854fab6f2bc6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee41e12ec2a7dca60bb0d2bed285e1cbdada0ec0b28e853e33d6bc3d998b0436d37c2dec7c01313b367f184b5ad44d3d7df32c72d2c9886c8a4f4adddc86a89e
|
7
|
+
data.tar.gz: 8cd2fb046a8e8521954cafa9f6e6183b1b6fb6a45a06ec228a7d3800d8ec5e12342b6e36bf5259078c9165b4764e3cf41b37c168b9565050d25ac1c8ddfd1077
|
@@ -1,5 +1,15 @@
|
|
1
1
|
$(document).ready(function() {
|
2
|
-
|
2
|
+
setupAutoComplete("hub");
|
3
|
+
setupAutoComplete("registry");
|
4
|
+
$('#hub_tab').click( function() {
|
5
|
+
$('#docker_container_wizard_states_image_registry_id').val('');
|
6
|
+
});
|
7
|
+
});
|
8
|
+
|
9
|
+
function setupAutoComplete(registryType) {
|
10
|
+
var tag = getTag(registryType),
|
11
|
+
repo = getRepo(registryType);
|
12
|
+
|
3
13
|
tag.autocomplete({
|
4
14
|
source: [],
|
5
15
|
autoFocus: true,
|
@@ -9,18 +19,12 @@ $(document).ready(function() {
|
|
9
19
|
$(this).data("uiAutocomplete").search($(this).val());
|
10
20
|
});
|
11
21
|
|
12
|
-
|
13
|
-
|
14
|
-
target.autocomplete({
|
15
|
-
source: function( request, response ) { autoCompleteRepo(target); },
|
22
|
+
repo.autocomplete({
|
23
|
+
source: function( request, response ) { autoCompleteRepo(repo); },
|
16
24
|
delay: 500,
|
17
25
|
minLength: 1
|
18
26
|
});
|
19
|
-
|
20
|
-
$('#hub_tab').click( function() {
|
21
|
-
$('#docker_container_wizard_states_image_registry_id').val('');
|
22
|
-
});
|
23
|
-
});
|
27
|
+
}
|
24
28
|
|
25
29
|
function autoCompleteRepo(item) {
|
26
30
|
$.ajax({
|
@@ -29,67 +33,103 @@ function autoCompleteRepo(item) {
|
|
29
33
|
data: { search: item.val(), registry_id: $('#docker_container_wizard_states_image_registry_id').val() },
|
30
34
|
//data:'search=' + item.val(),
|
31
35
|
success:function (result) {
|
36
|
+
var registryType = $(item).data('registry'),
|
37
|
+
search_add_on = getSearchAddOn(registryType),
|
38
|
+
tag = getTag(registryType);
|
32
39
|
if(result == 'true'){
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
setWaitingText('Image found: <strong>' + item.val() + '</strong>. Retrieving available tags, please wait...');
|
38
|
-
setAutocompleteTags();
|
40
|
+
search_add_on.attr('title', 'Image found in the compute resource');
|
41
|
+
search_add_on.removeClass('glyphicon-remove');
|
42
|
+
search_add_on.css('color', 'lightgreen');
|
43
|
+
search_add_on.addClass('glyphicon-ok');
|
44
|
+
setWaitingText('Image found: <strong>' + item.val() + '</strong>. Retrieving available tags, please wait...', registryType);
|
45
|
+
setAutocompleteTags(registryType);
|
39
46
|
} else {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
search_add_on.attr('title', 'Image NOT found in the compute resource');
|
48
|
+
search_add_on.removeClass('glyphicon-ok');
|
49
|
+
search_add_on.css('color', 'red');
|
50
|
+
search_add_on.addClass('glyphicon-remove');
|
51
|
+
tag.autocomplete('option', 'source', []);
|
45
52
|
}
|
46
53
|
}
|
47
54
|
});
|
48
55
|
}
|
49
56
|
|
50
|
-
function setAutocompleteTags() {
|
51
|
-
var tag =
|
57
|
+
function setAutocompleteTags(registryType) {
|
58
|
+
var tag = getTag(registryType);
|
52
59
|
tag.addClass('tags-autocomplete-loading');
|
53
60
|
tag.val('');
|
54
61
|
var source = [];
|
55
|
-
$.getJSON( tag.data("url"), { search:
|
62
|
+
$.getJSON( tag.data("url"), { search: getRepo(registryType).val(), registry_id: $('#docker_container_wizard_states_image_registry_id').val() },
|
56
63
|
function(data) {
|
57
|
-
|
64
|
+
getSearchSpinner(registryType).hide();
|
58
65
|
tag.removeClass('tags-autocomplete-loading');
|
59
66
|
$.each( data, function(index, value) {
|
60
67
|
source.push({label: value.label, value: value.value});
|
61
68
|
});
|
62
|
-
|
69
|
+
tag.focus();
|
63
70
|
});
|
64
71
|
tag.autocomplete('option', 'source', source);
|
65
72
|
}
|
66
73
|
|
67
74
|
function searchRepo(item) {
|
68
|
-
|
69
|
-
|
70
|
-
|
75
|
+
var registryType = $(item).data('registry'),
|
76
|
+
results = getRepositorySearchResults(registryType),
|
77
|
+
search = getRepo(registryType),
|
78
|
+
searching_spinner = getSearchSpinner(registryType);
|
79
|
+
setWaitingText('<strong>Searching</strong> in the hub, this can be slow, please wait...', registryType);
|
80
|
+
results.html('');
|
81
|
+
results.show();
|
71
82
|
$.ajax({
|
72
83
|
type:'get',
|
73
84
|
dataType:'text',
|
74
85
|
url: $(item).attr('data-url'),
|
75
|
-
data: { search:
|
86
|
+
data: { search: search.val(), registry_id: $('#docker_container_wizard_states_image_registry_id').val() },
|
76
87
|
success: function (result) {
|
77
|
-
|
88
|
+
results.html(result);
|
78
89
|
},
|
79
90
|
complete: function (result) {
|
80
|
-
|
91
|
+
searching_spinner.hide();
|
81
92
|
}
|
82
93
|
});
|
83
94
|
}
|
84
95
|
|
85
96
|
function repoSelected(item) {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
97
|
+
var registryType = "hub";
|
98
|
+
if ($(item).data("hub") !== true) {
|
99
|
+
registryType = "registry";
|
100
|
+
}
|
101
|
+
|
102
|
+
getRepositorySearchResults(registryType).hide();
|
103
|
+
setWaitingText('Image selected: <strong>' + item.text + '</strong>. Retrieving available tags, please wait...', registryType);
|
104
|
+
getRepo(registryType).val(item.text);
|
105
|
+
setAutocompleteTags(registryType);
|
106
|
+
}
|
107
|
+
|
108
|
+
function setWaitingText(string, registryType) {
|
109
|
+
getWaitText(registryType).html(string);
|
110
|
+
getSearchSpinner(registryType).show();
|
111
|
+
}
|
112
|
+
|
113
|
+
function getTag(registryType) {
|
114
|
+
return $('form[data-registry="' + registryType + '"] input[data-tag]:first');
|
115
|
+
}
|
116
|
+
|
117
|
+
function getRepo(registryType) {
|
118
|
+
return $('form[data-registry="' + registryType + '"] input[data-search]:first');
|
119
|
+
}
|
120
|
+
|
121
|
+
function getSearchSpinner(registryType) {
|
122
|
+
return $('form[data-registry="' + registryType + '"] [data-search-spinner]:first');
|
90
123
|
}
|
91
124
|
|
92
|
-
function
|
93
|
-
$('
|
94
|
-
$('#searching_spinner').show();
|
125
|
+
function getRepositorySearchResults(registryType) {
|
126
|
+
return $('form[data-registry="' + registryType + '"] [data-repository-search-results]:first');
|
95
127
|
}
|
128
|
+
|
129
|
+
function getSearchAddOn(registryType) {
|
130
|
+
return $('form[data-registry="' + registryType + '"] [data-search-addon]:first');
|
131
|
+
}
|
132
|
+
|
133
|
+
function getWaitText(registryType) {
|
134
|
+
return $('form[data-registry="' + registryType + '"] [data-wait-text]:first');
|
135
|
+
}
|
@@ -24,7 +24,8 @@ class ImageSearchController < ::ApplicationController
|
|
24
24
|
respond_to do |format|
|
25
25
|
format.js do
|
26
26
|
render :partial => 'repository_search_results',
|
27
|
-
:locals => { :repositories => repositories
|
27
|
+
:locals => { :repositories => repositories,
|
28
|
+
:use_hub => use_hub? }
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
@@ -25,4 +25,26 @@ module ContainerStepsHelper
|
|
25
25
|
def taxonomy_icon(taxonomy)
|
26
26
|
taxonomy == 'locations' ? 'globe' : 'briefcase'
|
27
27
|
end
|
28
|
+
|
29
|
+
def tab_class(tab_name)
|
30
|
+
active_tab.to_s == tab_name.to_s ? "active" : ""
|
31
|
+
end
|
32
|
+
|
33
|
+
def model_for(registry_type)
|
34
|
+
if active_tab.to_s == registry_type.to_s
|
35
|
+
@docker_container_wizard_states_image
|
36
|
+
else
|
37
|
+
DockerContainerWizardStates::Image.new(:wizard_state => @state)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def active_tab
|
42
|
+
if @docker_container_wizard_states_image.katello?
|
43
|
+
:katello
|
44
|
+
elsif @docker_container_wizard_states_image.registry_id.nil?
|
45
|
+
:hub
|
46
|
+
else
|
47
|
+
:registry
|
48
|
+
end
|
49
|
+
end
|
28
50
|
end
|
data/app/models/container.rb
CHANGED
@@ -13,7 +13,8 @@ class Container < ActiveRecord::Base
|
|
13
13
|
|
14
14
|
attr_accessible :command, :repository_name, :name, :compute_resource_id, :entrypoint,
|
15
15
|
:cpu_set, :cpu_shares, :memory, :tty, :attach_stdin, :registry_id,
|
16
|
-
:attach_stdout, :attach_stderr, :tag, :uuid, :environment_variables_attributes
|
16
|
+
:attach_stdout, :attach_stderr, :tag, :uuid, :environment_variables_attributes,
|
17
|
+
:katello
|
17
18
|
|
18
19
|
def repository_pull_url
|
19
20
|
repo = tag.blank? ? repository_name : "#{repository_name}:#{tag}"
|
@@ -15,6 +15,7 @@ class DockerContainerWizardState < ActiveRecord::Base
|
|
15
15
|
{ :repository_name => image.repository_name,
|
16
16
|
:tag => image.tag,
|
17
17
|
:registry_id => image.registry_id,
|
18
|
+
:katello => image.katello?,
|
18
19
|
:name => configuration.name,
|
19
20
|
:compute_resource_id => preliminary.compute_resource_id,
|
20
21
|
:tty => environment.tty,
|
@@ -25,6 +26,7 @@ class DockerContainerWizardState < ActiveRecord::Base
|
|
25
26
|
:attach_stdin => environment.attach_stdin,
|
26
27
|
:attach_stderr => environment.attach_stderr,
|
27
28
|
:cpu_shares => configuration.cpu_shares,
|
28
|
-
:cpu_set => configuration.cpu_set
|
29
|
+
:cpu_set => configuration.cpu_set
|
30
|
+
}
|
29
31
|
end
|
30
32
|
end
|
@@ -11,13 +11,13 @@ module DockerContainerWizardStates
|
|
11
11
|
def used_location_ids
|
12
12
|
Location.joins(:taxable_taxonomies).where(
|
13
13
|
'taxable_taxonomies.taxable_type' => 'DockerContainerWizardStates::Preliminary',
|
14
|
-
'taxable_taxonomies.taxable_id' => id).pluck(
|
14
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
|
15
15
|
end
|
16
16
|
|
17
17
|
def used_organization_ids
|
18
18
|
Organization.joins(:taxable_taxonomies).where(
|
19
19
|
'taxable_taxonomies.taxable_type' => 'DockerContainerWizardStates::Preliminary',
|
20
|
-
'taxable_taxonomies.taxable_id' => id).pluck(
|
20
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -6,19 +6,22 @@ class DockerRegistry < ActiveRecord::Base
|
|
6
6
|
has_many :containers, :foreign_key => "registry_id", :dependent => :destroy
|
7
7
|
encrypts :password
|
8
8
|
|
9
|
+
validates_lengths_from_database
|
10
|
+
validates :name, :presence => true, :uniqueness => true
|
11
|
+
|
9
12
|
scoped_search :on => :name, :complete_value => true
|
10
13
|
scoped_search :on => :url
|
11
14
|
|
12
15
|
def used_location_ids
|
13
16
|
Location.joins(:taxable_taxonomies).where(
|
14
17
|
'taxable_taxonomies.taxable_type' => 'DockerRegistry',
|
15
|
-
'taxable_taxonomies.taxable_id' => id).pluck(
|
18
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
|
16
19
|
end
|
17
20
|
|
18
21
|
def used_organization_ids
|
19
22
|
Organization.joins(:taxable_taxonomies).where(
|
20
23
|
'taxable_taxonomies.taxable_type' => 'DockerRegistry',
|
21
|
-
'taxable_taxonomies.taxable_id' => id).pluck(
|
24
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Taxonomy.table_name}.id")
|
22
25
|
end
|
23
26
|
|
24
27
|
def prefixed_url(image_name)
|
@@ -6,8 +6,8 @@ module Service
|
|
6
6
|
def initialize(params = {})
|
7
7
|
config = DEFAULTS.merge(params)
|
8
8
|
uri = URI(config.delete(:url))
|
9
|
-
uri.user = config.delete(:user)
|
10
|
-
uri.password = config.delete(:password)
|
9
|
+
uri.user = config.delete(:user) unless config[:user].blank?
|
10
|
+
uri.password = config.delete(:password) unless config[:password].blank?
|
11
11
|
@config = config.merge(:url => uri.to_s)
|
12
12
|
end
|
13
13
|
|
@@ -8,7 +8,8 @@
|
|
8
8
|
<%= _("Back") %>
|
9
9
|
</a>
|
10
10
|
<% end %>
|
11
|
-
|
11
|
+
<% next_id = defined?(registry) ? "next_#{registry}" : "next" %>
|
12
|
+
<%= button_tag(:id => next_id, :type => 'submit', :class => "btn btn-primary pull-right") do %>
|
12
13
|
<% if last_step? %>
|
13
14
|
<%= _("Submit") %>
|
14
15
|
<% else %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<%- model = model_for(registry) %>
|
2
|
+
<%= form_for model, :namespace => registry,
|
3
|
+
:class => 'form-horizontal',
|
4
|
+
:url => wizard_path,
|
5
|
+
:method => :put,
|
6
|
+
:html => {:data => {:registry => registry}} do |f| %>
|
7
|
+
<% if registry == "registry" -%>
|
8
|
+
<div class="input-group col-md-6">
|
9
|
+
<%= select_registry f %>
|
10
|
+
</div>
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<div>
|
14
|
+
<div class="form-group col-md-6">
|
15
|
+
<%= label_tag "image_id", _('Search'), :class=>"col-sm-2 control-label" %>
|
16
|
+
<div class="input-group">
|
17
|
+
|
18
|
+
<%= auto_complete_docker_search('docker_container_wizard_states_image[repository_name]', '',
|
19
|
+
:'data-url' => auto_complete_repository_name_image_search_path(model.compute_resource_id),
|
20
|
+
:value => f.object.repository_name.present? ? f.object.repository_name : '',
|
21
|
+
:'data-registry' => registry,
|
22
|
+
:'data-search' => true,
|
23
|
+
:focus_on_load => true,
|
24
|
+
:placeholder => _('Find your favorite container, e.g: centos')) %>
|
25
|
+
<span class="input-group-addon glyphicon" data-search-addon=true></span>
|
26
|
+
<span class="input-group-btn">
|
27
|
+
<%= button_tag(:class => 'btn btn-default',
|
28
|
+
:type => 'button',
|
29
|
+
:id => "search_repository_#{registry}",
|
30
|
+
:'data-registry' => registry,
|
31
|
+
:'data-url' => search_repository_image_search_path(model.compute_resource_id),
|
32
|
+
:onclick => 'searchRepo(this)') do %>
|
33
|
+
<span class="glyphicon glyphicon-search"></span>
|
34
|
+
<% end %>
|
35
|
+
</span>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<%= text_f f, :tag,
|
39
|
+
:'data-registry' => registry,
|
40
|
+
:'data-tag' => true,
|
41
|
+
:'data-url' => auto_complete_image_tag_image_search_path(model.compute_resource_id) %>
|
42
|
+
<div class="col-md-12">
|
43
|
+
<div data-search-spinner=true class='col-md-offset-3 hide'>
|
44
|
+
<span data-wait-text=true>
|
45
|
+
</span>
|
46
|
+
<%= image_tag('/assets/spinner.gif', :id => "loading_repositories_indicator_#{registry}") %>
|
47
|
+
</div>
|
48
|
+
<div data-repository-search-results=true >
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
<%= render :partial => 'form_buttons', locals: { :registry => registry} %>
|
52
|
+
</div>
|
53
|
+
<% end -%>
|
@@ -3,68 +3,39 @@
|
|
3
3
|
|
4
4
|
<%= render :layout => 'title', :locals => { :step => 2 } do %>
|
5
5
|
<ul class="nav nav-tabs" data-tabs="tabs">
|
6
|
-
|
6
|
+
<% if defined? Katello -%>
|
7
|
+
<li class="<%= tab_class(:katello)%>"><a href="#katello" data-toggle="tab" id="katello_tab">
|
8
|
+
<span class="glyphicon glyphicon-tower"></span>
|
9
|
+
<%= _("Katello") %>
|
10
|
+
</a></li>
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<li class='<%= tab_class(:hub) %>'><a href="#hub" data-toggle="tab" id="hub_tab">
|
7
14
|
<span class="glyphicon glyphicon-cloud-download"></span>
|
8
15
|
<%= _("Docker hub") %>
|
9
16
|
</a></li>
|
10
|
-
<li class
|
17
|
+
<li class='<%= tab_class(:registry) %>'><a href="#registry" data-toggle="tab" id="registry_tab">
|
11
18
|
<span class="glyphicon glyphicon-cloud-download"></span>
|
12
19
|
<%= _("External registry") %>
|
13
20
|
</a></li>
|
14
21
|
</ul>
|
15
|
-
|
16
|
-
|
17
|
-
<div class=
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
<div class="tab-pane active" id="registry">
|
26
|
-
<% end %>
|
27
|
-
<div class="input-group col-md-6">
|
28
|
-
<%= select_registry f %>
|
29
|
-
</div>
|
30
|
-
</div>
|
31
|
-
<div>
|
32
|
-
<div class="form-group col-md-6">
|
33
|
-
<%= label_tag "image_id", _('Search'), :class=>"col-sm-2 control-label" %>
|
34
|
-
<div class="input-group">
|
35
|
-
|
36
|
-
<%= auto_complete_docker_search('docker_container_wizard_states_image[repository_name]', '',
|
37
|
-
:'data-url' => auto_complete_repository_name_image_search_path(@docker_container_wizard_states_image.compute_resource_id),
|
38
|
-
:value => f.object.repository_name.present? ? f.object.repository_name : '',
|
39
|
-
:id => :search,
|
40
|
-
:focus_on_load => true,
|
41
|
-
:placeholder => _('Find your favorite container, e.g: centos')) %>
|
42
|
-
<span class="input-group-addon glyphicon" id="search-addon"></span>
|
43
|
-
<span class="input-group-btn">
|
44
|
-
<%= button_tag(:class => 'btn btn-default',
|
45
|
-
:type => 'button',
|
46
|
-
:id => 'search_repository',
|
47
|
-
:'data-url' => search_repository_image_search_path(@docker_container_wizard_states_image.compute_resource_id),
|
48
|
-
:onclick => 'searchRepo(this)') do %>
|
49
|
-
<span class="glyphicon glyphicon-search"></span>
|
50
|
-
<% end %>
|
51
|
-
</span>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
<%= text_f f, :tag,
|
55
|
-
:id => 'tag',
|
56
|
-
:'data-url' => auto_complete_image_tag_image_search_path(@docker_container_wizard_states_image.compute_resource_id) %>
|
57
|
-
<div class="col-md-12">
|
58
|
-
<div id='searching_spinner' class='col-md-offset-3 hide'>
|
59
|
-
<span id='waiting_text'>
|
60
|
-
</span>
|
61
|
-
<%= image_tag('/assets/spinner.gif', :id => 'loading_repositories_indicator') %>
|
62
|
-
</div>
|
63
|
-
<div id='repository_search_results'>
|
64
|
-
</div>
|
65
|
-
</div>
|
66
|
-
</div>
|
67
|
-
<%= render :partial => 'form_buttons' %>
|
22
|
+
<div class="tab-content">
|
23
|
+
<% if defined?(Katello) -%>
|
24
|
+
<div class='tab-pane <%= tab_class(:katello) %>' id="katello">
|
25
|
+
<%= form_for model_for("katello"), :namespace => "katello",
|
26
|
+
:class => 'form-horizontal',
|
27
|
+
:url => wizard_path,
|
28
|
+
:method => :put do |f| %>
|
29
|
+
<%= katello_partial(f) %>
|
30
|
+
<%= render :partial => 'form_buttons', locals: { :registry => "katello"} %>
|
31
|
+
<% end -%>
|
68
32
|
</div>
|
69
|
-
|
33
|
+
<% end -%>
|
34
|
+
<div class='tab-pane <%= tab_class(:hub) %>' id="hub">
|
35
|
+
<%= render :partial => 'image_hub_tab' , locals: { :registry => "hub" } %>
|
36
|
+
</div>
|
37
|
+
<div class='tab-pane <%= tab_class(:registry) %>' id="registry">
|
38
|
+
<%= render :partial => 'image_hub_tab' , locals: { :registry => "registry"} %>
|
39
|
+
</div>
|
40
|
+
</div>
|
70
41
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% repositories.each do |repository| %>
|
2
|
-
<h3><%= link_to repository['name'], '#', :onclick => 'repoSelected(this)' %></h3>
|
2
|
+
<h3><%= link_to repository['name'], '#', :onclick => 'repoSelected(this)', "data-hub" => use_hub %></h3>
|
3
3
|
<p>
|
4
4
|
<%= '<span class="glyphicon glyphicon-certificate" title="Official"></span>'.html_safe if repository['is_official'] %>
|
5
5
|
<%= '<span class="glyphicon glyphicon-thumbs-up" title="Trusted"></span>'.html_safe if repository['is_trusted'] %>
|
@@ -17,5 +17,23 @@ module Containers
|
|
17
17
|
|
18
18
|
assert_redirected_to container_path(:id => @container.id)
|
19
19
|
end
|
20
|
+
|
21
|
+
test 'image show doesnot load katello' do
|
22
|
+
compute_resource = FactoryGirl.create(:docker_cr)
|
23
|
+
state = DockerContainerWizardState.create!
|
24
|
+
create_options = { :wizard_state => state,
|
25
|
+
:compute_resource_id => compute_resource.id
|
26
|
+
|
27
|
+
}
|
28
|
+
state.preliminary = DockerContainerWizardStates::Preliminary.create!(create_options)
|
29
|
+
DockerContainerWizardState.expects(:find).at_least_once.returns(state)
|
30
|
+
get :show, { :wizard_state_id => state.id, :id => :image }, set_session_user
|
31
|
+
refute state.image.katello?
|
32
|
+
refute response.body.include?("katello") # this is code generated by katello partial
|
33
|
+
docker_image = @controller.instance_eval do
|
34
|
+
@docker_container_wizard_states_image
|
35
|
+
end
|
36
|
+
assert_equal state.image, docker_image
|
37
|
+
end
|
20
38
|
end
|
21
39
|
end
|
@@ -18,7 +18,12 @@ class DockerRegistryTest < ActiveSupport::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
test 'password is stored encrypted' do
|
21
|
-
|
22
|
-
assert
|
21
|
+
registry = as_admin { FactoryGirl.create(:docker_registry) }
|
22
|
+
assert registry.is_decryptable?(registry.password_in_db)
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'registries need a name' do
|
26
|
+
registry = FactoryGirl.build(:docker_registry, :name => '')
|
27
|
+
refute registry.valid?
|
23
28
|
end
|
24
29
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class RegistryApiTest < ActiveSupport::TestCase
|
4
|
+
test "initialize handles username password info correctly" do
|
5
|
+
uname = "tardis"
|
6
|
+
password = "boo"
|
7
|
+
url = "http://docker-who.gov"
|
8
|
+
reg = Service::RegistryApi.new(:url => url,
|
9
|
+
:user => uname,
|
10
|
+
:password => password)
|
11
|
+
assert reg.config[:url].include?(uname)
|
12
|
+
assert reg.config[:url].include?(password)
|
13
|
+
|
14
|
+
reg = Service::RegistryApi.new(:url => url)
|
15
|
+
assert_equal url, reg.config[:url]
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato, Amos Benari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- app/views/containers/index.html.erb
|
86
86
|
- app/views/containers/show.html.erb
|
87
87
|
- app/views/containers/steps/_form_buttons.html.erb
|
88
|
+
- app/views/containers/steps/_image_hub_tab.html.erb
|
88
89
|
- app/views/containers/steps/_title.html.erb
|
89
90
|
- app/views/containers/steps/configuration.html.erb
|
90
91
|
- app/views/containers/steps/environment.html.erb
|
@@ -111,6 +112,8 @@ files:
|
|
111
112
|
- db/migrate/20141120123003_add_user_credentials_to_docker_registries.rb
|
112
113
|
- db/migrate/20141209182008_remove_docker_tables.rb
|
113
114
|
- db/migrate/20141222113313_create_wizard_states.rb
|
115
|
+
- db/migrate/20150122011747_add_katello_flag_to_docker_wizard_image.rb
|
116
|
+
- db/migrate/20150129054944_add_katello_flag_to_containers.rb
|
114
117
|
- lib/foreman_docker.rb
|
115
118
|
- lib/foreman_docker/engine.rb
|
116
119
|
- lib/foreman_docker/tasks/test.rake
|
@@ -127,6 +130,7 @@ files:
|
|
127
130
|
- test/units/container_test.rb
|
128
131
|
- test/units/containers_service_test.rb
|
129
132
|
- test/units/docker_registry_test.rb
|
133
|
+
- test/units/registry_api_test.rb
|
130
134
|
homepage: http://github.com/theforeman/foreman-docker
|
131
135
|
licenses:
|
132
136
|
- GPL-3
|
@@ -159,6 +163,7 @@ test_files:
|
|
159
163
|
- test/factories/containers.rb
|
160
164
|
- test/units/container_test.rb
|
161
165
|
- test/units/docker_registry_test.rb
|
166
|
+
- test/units/registry_api_test.rb
|
162
167
|
- test/units/containers_service_test.rb
|
163
168
|
- test/test_plugin_helper.rb
|
164
169
|
- test/integration/container_steps_test.rb
|