Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions chef/cookbooks/suse-manager-client/files/default/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copy the rhn-org-trusted-ssl-cert-VERSION-RELEASE.noarch.rpm package you downloaded
from your SUSE Manager server to this directory as ssl-cert.rpm.
24 changes: 10 additions & 14 deletions chef/cookbooks/suse-manager-client/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
# limitations under the License.
#

manager_server = node[:suse_manager_client][:manager_server]
activation_key = node[:suse_manager_client][:activation_key]
return if node[:crowbar_wall][:suse_manager_client_registered] || false

bootstrap_script_url = node[:suse_manager_client][:bootstrap_script_url]


temp_pkg = Mixlib::ShellOut.new("mktemp /tmp/ssl-cert-XXXX.rpm").run_command.stdout.strip

Expand All @@ -28,19 +30,13 @@

package(temp_pkg)

org_cert = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
bash "install SSL certificate" do
code <<-EOH
cp #{org_cert} \
/etc/ssl/certs/`openssl x509 -noout -hash -in #{org_cert}`.0
EOH
execute "update-ca-certificates" do
command "update-ca-certificates"
end

# XXX requires chef-client with CHEF-4090 fixed otherwise the package
# provider can't handle the URL
package "https://#{manager_server}/pub/bootstrap/sm-client-tools.rpm"

execute "sm-client" do
command "sm-client --hostname #{manager_server} --activation-keys #{activation_key}"
execute "bootstrap SUMA client" do
command "curl #{bootstrap_script_url} | sh"
end

node.set[:crowbar_wall][:suse_manager_client_registered] = true
node.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def upgrade(ta, td, a, d)
a["bootstrap_script_url"] = ta["bootstrap_script_url"]
a.delete("activation_key")
a.delete("manager_server")
return a, d
end

def downgrade(ta, td, a, d)
a["activation_key"] = ta["activation_key"]
a["manager_server"] = ta["manager_server"]
a.delete("bootstrap_script_url")
return a, d
end
4 changes: 2 additions & 2 deletions chef/data_bags/crowbar/template-suse_manager_client.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"description": "Register systems as SUSE Manager clients",
"attributes": {
"suse_manager_client": {
"activation_key": "",
"manager_server": ""
"bootstrap_script_url": ""
}
},
"deployment": {
"suse_manager_client": {
"crowbar-revision": 0,
"schema-revision": 1,
"crowbar-applied": false,
"element_states": {
"suse-manager-client": [ "readying", "ready", "applying" ]
Expand Down
4 changes: 2 additions & 2 deletions chef/data_bags/crowbar/template-suse_manager_client.schema
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"type": "map",
"required": true,
"mapping": {
"activation_key": { "type": "str", "required": true },
"manager_server": { "type": "str", "required": true }
"bootstrap_script_url": { "type": "str", "required": true }
}
}
}
Expand All @@ -27,6 +26,7 @@
"required": true,
"mapping": {
"crowbar-revision": { "type": "int", "required": true },
"schema-revision": { "type": "int", "required": true },
"crowbar-committing": { "type": "bool" },
"crowbar-applied": { "type": "bool" },
"crowbar-status": { "type": "str" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def suse_manager_client_rpm
end

def suse_manager_client_install
"/opt/dell/bin/barclamp_install.rb --rpm suse-manager-client"
"knife cookbook upload suse-manager-client -o /opt/dell/chef/cookbooks"
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
%span.help-block.alert.alert-info
= t(".manual_steps", manager_url: suse_manager_client_url, rpm_path: suse_manager_client_rpm, install_command: suse_manager_client_install).html_safe

= string_field :activation_key
= string_field :bootstrap_script_url
%span.help-block
= t(".activation_key_hint")

= string_field :manager_server
%span.help-block
= t(".manager_server_hint", :link => link_to_proposal(:dns))
= t('.bootstrap_script_url_hint')
10 changes: 6 additions & 4 deletions crowbar_framework/config/locales/suse_manager_client/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ en:
barclamp:
suse_manager_client:
edit_attributes:
manager_server: 'SUSE Manager server hostname'
manager_server_hint: 'For example susemgr.example.com. You can set a record within the %{link}.'
activation_key: 'Activation Key'
activation_key_hint: 'For example 1-00112233445566778899aabbccddeeff'
bootstrap_script_url: 'URL of the bootstrap script'
bootstrap_script_url_hint: |
This is the script the administrator of the SUSE Manager server has
prepared to be used for activation of the clients. It is likely located under
/pub/bootstrap directory on the server.
For example https://susemgr.example.com/pub/bootstrap/bootstrap-sles12sp1.sh.

manual_steps: |
Manual steps are required in order to use this barclamp. After
Expand Down