criteo-cookbooks / nexus3 Goto Github PK
View Code? Open in Web Editor NEWChef cookbook to install and configure Sonatype Nexus 3 Repository Manager
Home Page: http://www.sonatype.com/download-oss-sonatype
License: MIT License
Chef cookbook to install and configure Sonatype Nexus 3 Repository Manager
Home Page: http://www.sonatype.com/download-oss-sonatype
License: MIT License
Hi,
I'm trying to update the email adres for the admin user with the nexus3_api
resource.
However anything I try does not update the email address.
I'm using this JSON file:
{
"name": "admin_email",
"type": "groovy",
"content": "def user = security.securitySystem.getUser('admin');user.setEmailAddress('[email protected]');'security.securitySystem.updateUser(user);'"
}
And the Chef code:
nexus3_api 'admin_update_email' do
script_source 'admin_update_email.json'
script_cookbook 'company_nexus'
action :run
end
Test Kitchen output:
* nexus3_api[admin_update_email] action run
* ruby_block[wait up to 300 seconds for Nexus Rest API endpoint to respond] action run
- execute the ruby block wait up to 300 seconds for Nexus Rest API endpoint to respond
* execute[wait for http://localhost:8081/service/siesta/rest/v1/script to respond] action run
[execute] % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0[ {
"name" : "anonymous",
"content" : "security.setAnonymousAccess(Boolean.valueOf(args))",
"type" : "groovy"
100 119 100 119 0 0 2705 0 --:--:-- --:--:-- --:--:-- 2767
- execute curl --fail -X GET -u admin:admin123 'http://localhost:8081/service/siesta/rest/v1/script'
* execute[delete script admin_update_email] action run
[execute] % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to localhost port 8081 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Basic with user 'admin'
> DELETE /service/siesta/rest/v1/script/admin_update_email HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4xMjM=
> User-Agent: curl/7.29.0
> Host: localhost:8081
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Date: Thu, 01 Feb 2018 18:42:44 GMT
< Server: Nexus/3.7.1-02 (OSS)
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< X-Siesta-FaultId: 6974ab26-9575-423e-8a81-92ba02b874dd
< Content-Length: 0
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host localhost left intact
- execute curl -v -X DELETE -u admin:admin123 'http://localhost:8081/service/siesta/rest/v1/script/admin_update_email'
* directory[/tmp/kitchen/cache/nexus/scripts] action create (up to date)
* cookbook_file[/tmp/kitchen/cache/nexus/scripts/admin_update_email.json] action create
- update content in file /tmp/kitchen/cache/nexus/scripts/admin_update_email.json from 1b790c to f86c34
--- /tmp/kitchen/cache/nexus/scripts/admin_update_email.json 2018-02-01 18:37:55.371225623 +0000
+++ /tmp/kitchen/cache/nexus/scripts/.chef-admin_update_email20180201-9247-18evfxp.json 2018-02-01 18:42:44.338347727 +0000
@@ -1,5 +1,5 @@
{
- "name": "anonymous",
+ "name": "admin_email",
"type": "groovy",
"content": "def user = security.securitySystem.getUser('admin');user.setEmailAddress('[email protected]');'security.securitySystem.updateUser(user);'"
}
- restore selinux security context
* file[/tmp/kitchen/cache/nexus/scripts/admin_update_email.json] action create (skipped due to only_if)
* execute[upload script admin_update_email] action run
[execute] % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to localhost port 8081 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Basic with user 'admin'
> POST /service/siesta/rest/v1/script HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4xMjM=
> User-Agent: curl/7.29.0
> Host: localhost:8081
> Accept: */*
> Content-Type: application/json
> Content-Length: 197
>
} [data not shown]
* upload completely sent off: 197 out of 197 bytes
< HTTP/1.1 204 No Content
< Date: Thu, 01 Feb 2018 18:42:44 GMT
< Server: Nexus/3.7.1-02 (OSS)
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
<
100 197 0 0 100 197 0 11789 --:--:-- --:--:-- --:--:-- 12312
* Connection #0 to host localhost left intact
- execute curl -v -X POST -u admin:admin123 --header "Content-Type: application/json" 'http://localhost:8081/service/siesta/rest/v1/script' -d @admin_update_email.json
* execute[run script admin_update_email] action run
[execute] % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to localhost port 8081 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Basic with user 'admin'
> POST /service/siesta/rest/v1/script/admin_update_email/run HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4xMjM=
> User-Agent: curl/7.29.0
> Host: localhost:8081
> Accept: */*
> Content-Type: text/plain
>
< HTTP/1.1 404 Not Found
< Date: Thu, 01 Feb 2018 18:42:44 GMT
< Server: Nexus/3.7.1-02 (OSS)
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< X-Siesta-FaultId: d937922e-1085-4e99-b207-eb5198613498
< Content-Length: 0
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host localhost left intact
- execute curl -v -X POST -u admin:admin123 --header "Content-Type: text/plain" 'http://localhost:8081/service/siesta/rest/v1/script/admin_update_email/run'
Let's leverage the sensitive
flag on properties that has been introduced with Chef 12.14.34
On version 3.5.0 of Nexus, there's a warning in the GUI which suggests changing the default file handlers to 65536. What's the best method to define file limits for nexus with systemd?
Systemd does not support /etc/security/limits.conf, which was my first idea, and using the limits cookbook (https://supermarket.chef.io/cookbooks/limits) was my second. Unfortunately systemd has already started by the time of the nexus un-tar, meaning any new values you've passed will not be picked up (either overwritten or ignored depending on scenario).
How do we set the limits in nexus.service file which the nexus3 cookbook creates?
You can test to see if your changes are affective by adding echo 'ulimit -a | grep "open files"'
to line 512 of /opt/nexus3/bin/nexus
and checking /var/log/messages
(or syslog depending on distro). I'm on Centos 7.3.
Hello,
This cookbook in chef supermarket doesn't contains repo resource.
I've been trying to converge this cookbook on test kitchen. I increased the vm memory to 4gig. Here's my recipe.
node.default['java']['jdk_version'] = '8'
include_recipe 'java'
nexus3 'nexus' do
properties_variables(
host: '0.0.0.0',
port: '8443',
context_path: '/components/'
)
action :install
end
And this the chef error I get
- enable service service[nexus3_nexus]
* ruby_block[block until operational] action nothing (skipped due to action :nothing)
* nexus3_service_systemd[nexus] action restart
* service[nexus3_nexus] action restart
- restart service service[nexus3_nexus]
* ruby_block[block until operational] action run
================================================================================
Error executing action `run` on resource 'ruby_block[block until operational]'
================================================================================
NoMethodError
-------------
undefined method `nexus_timeout' for Custom resource nexus3 from cookbook nexus3
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:38:in `rescue in wait_until_ready!'
/tmp/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:20:in `wait_until_ready!'
/tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb:105:in `block (3 levels) in class_from_file'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb
102: ruby_block 'block until operational' do
103: block do
104: Chef::Log.info "Waiting until Nexus is listening on port #{node['nexus3']['properties_variables']['port']}"
105: wait_until_ready!(node['nexus3']['api']['endpoint'], node['nexus3']['api']['wait'])
106: end
107: action :nothing
108: end
109: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb:102:in `block in class_from_file'
ruby_block("block until operational") do
action [:nothing]
default_guard_interpreter :default
block_name "block until operational"
declared_type :ruby_block
cookbook_name "role_nexus"
block #<Proc:0x00000000022188e0@/tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb:103>
end
System Info:
------------
chef_version=13.6.4
platform=ubuntu
platform_version=16.04
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
program_name=chef-client worker: ppid=2298;start=15:51:20;
executable=/opt/chef/bin/chef-client
================================================================================
Error executing action `install` on resource 'nexus3[nexus]'
================================================================================
NoMethodError
-------------
ruby_block[block until operational] (/tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb line 102) had an error: NoMethodError: undefined method `nexus_timeout' for Custom resource nexus3 from cookbook nexus3
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:38:in `rescue in wait_until_ready!'
/tmp/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:20:in `wait_until_ready!'
/tmp/kitchen/cache/cookbooks/nexus3/resources/default.rb:105:in `block (3 levels) in class_from_file'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/role_nexus/recipes/default.rb
27: nexus3 'nexus' do
28: properties_variables(
29: host: '0.0.0.0',
30: port: '8443',
31: context_path: '/components/'
32: )
33: action :install
34: end
35:
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/role_nexus/recipes/default.rb:27:in `from_file'
nexus3("nexus") do
action [:install]
updated true
updated_by_last_action true
default_guard_interpreter :default
declared_type :nexus3
cookbook_name "role_nexus"
recipe_name "default"
properties_variables {:host=>"0.0.0.0", :port=>"8443", :context_path=>"/components/"}
instance_name "nexus"
service_name "nexus"
vmoptions_variables {"Xms"=>"1200M", "Xmx"=>"1200M"}
end
System Info:
------------
chef_version=13.6.4
platform=ubuntu
platform_version=16.04
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
program_name=chef-client worker: ppid=2298;start=15:51:20;
executable=/opt/chef/bin/chef-client
Running handlers:
Please update view source and view issues links to point to Criteo. They still point to dhoer.
Nexus Version:
3.23.0-03
OS:
Ubuntu 18.04
Message:
nexus3_api[upsert_repo dockerPriv] action run
================================================================================
Error executing action run
on resource 'nexus3_api[upsert_repo dockerPriv]'
================================================================================
Nexus3::ApiError
----------------
HTTP_STATUS=400 {
"name" : "upsert_repo",
"result" : "org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\nScript3.groovy: 22: You cannot create an instance from the abstract interface 'org.sonatype.nexus.repository.config.Configuration'.\n @ line 22, column 12.\n conf = new Configuration(\n ^\n\n1 error\n"
}
Details
Trying to customize an entire nexus3 server through the chef cookbook, but besides installing the server, can't do much else in the latest version of nexus. Any help with moving all apis to REST requests? Kinda hard for me as I am not a developer
The default nexus3 url for downloading Nexus picks 'latest' as the version number (attributes/default.rb), but the unit tests hardcode this version to '3.2.1-01' (spec/spec_helper.rb), so unittests are currently failing -- see https://travis-ci.org/criteo-cookbooks/nexus3/jobs/230335539 for instance -- since Nexus updated their latest.
Possible solutions:
It would be very cool to be able to easily change the admin password using a custom resource for instance.
Something like that:
nexus3_admin_password 'change admin password do
new_password 'new-secret-password'
old_password 'old-secret-password'
end
Hello guys!
I tried to initialize a new repo using the nexus3_api resource, and got the following error:
null_resource.nexus (chef): Deprecated features used!
null_resource.nexus (chef): Property `ignore_failure` of resource `nexus3_api` overwrites an existing method. Please use a different property name. This will raise an exception in Chef 13. at 1 location:
null_resource.nexus (chef): - /var/chef/cache/cookbooks/nexus3/resources/api.rb:14:in 'class_from_file'
null_resource.nexus (chef): See https://docs.chef.io/deprecations_property_name_collision.html for further details.
null_resource.nexus (chef): Property `sensitive` of resource `nexus3_api` overwrites an existing method. Please use a different property name. This will raise an exception in Chef 13. at 1 location:
null_resource.nexus (chef): - /var/chef/cache/cookbooks/nexus3/resources/api.rb:17:in 'class_from_file'
null_resource.nexus (chef): See https://docs.chef.io/deprecations_property_name_collision.html for further details.
Is it a known issue, or am I using something wrong?
The recipe looks like this:
nexus3 'nexus' do
action :install
end
nexus3_api 'maven-internal' do
content "repository.createMavenHosted('maven-internal')"
action :run
end
Chef: 12.19.36
Since the resource that creates the vmoptions file uses key=value syntax, things like -Xms2g end up as -Xmx=2g, breaking startup.
The "/service/siesta/rest/v1/script" endpoint has been moved to "/service/rest/v1/script".
Ran into this one trying to upgrade to the latest Nexus 3.17.0 release.
Nexus now generates UUID for the default password and puts it in /opt/sonatype-work/nexus3/admin.password
. This cookbook assumes the default password is admin123, which no longer works as of this new nexus version.
Found this mentioned in the release notes:
In new instances the admin user will now start with a randomly generated password.
I used the following as a workaround:
ruby_block 'read random nexus password into attribute' do
block do
node.override['nexus3']['api']['password'] = File.read("#{node['nexus3']['data']}/admin.password")
end
action :run
end
The README should note that the node['nexus3']['nofile_limit']
attribute only applies to the systemd service configuration.
I had mistakenly assumed that this was being set for the node['nexus3']['user']
.
The default value for the api
resource is default: lazy { ::Nexus3::Api.default(node) }
https://github.com/criteo-cookbooks/nexus3/blob/master/resources/api.rb#L4
However, the other resources have default: ::Nexus3::Api.default(node)
I found that in the same chef run, this caused unexpected results.
nexus3 'nexus' do
action :install
notifies :create, 'nexus3_api[admin_change_password]', :immediately
notifies :run, 'nexus3_api[admin_change_password]', :immediately
notifies :delete, 'nexus3_api[admin_change_password]', :immediately
end
nexus3_api 'admin_change_password' do
script_name 'admin_change_password'
content "security.securitySystem.changePassword('admin', args)"
args 'some new password'
sensitive true
action :nothing
end
ruby_block 'update nexus api credentials' do
block do
# this is run at converge time so that following resources use the new password
node.override['nexus3']['api']['password'] = 'some new password'
end
action :run
end
nexus3_repo "Create a repo" do
repo_name 'new-repo'
repo_type 'raw-hosted'
# without this, it would fail
api_client lazy { ::Nexus3::Api.default(node) }
action :create
end
It would be very cool to be able to define repo groups using a custom resource.
Something like that:
nexus3_repo_group 'create my group' do
group_name 'my_group'
repositories %w(repo1 repo2)
end
Converging this cookbook using Chef 16.5.64 (stable release) fails due to Nexus API: 'uninitialized constant Addressable::URI'
error.
nexus3 Cookbook: 3.6.0
Chef Client 16.5.64
Test Kitchen: 2.5.4
Platform: Centos 7+ (Kitchen VM)
* ruby_block[block until Nexus default@8081 operational] action run/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
/opt/kitchen/cache/cookbooks/nexus3/libraries/nexus_helper.rb:22: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open
- execute the ruby block block until Nexus default@8081 operational
* nexus3_api[admin_change_password for default@8081] action create
================================================================================
Error executing action `create` on resource 'nexus3_api[admin_change_password for default@8081]'
================================================================================
RuntimeError
------------
Nexus API: 'uninitialized constant Addressable::URI'
Cookbook Trace: (most recent call first)
----------------------------------------
/opt/kitchen/cache/cookbooks/nexus3/libraries/api.rb:58:in `rescue in request'
/opt/kitchen/cache/cookbooks/nexus3/libraries/api.rb:56:in `request'
/opt/kitchen/cache/cookbooks/nexus3/resources/api.rb:8:in `block in class_from_file'
Resource Declaration:
---------------------
# In /opt/kitchen/cache/cookbooks/nexus3/resources/default.rb
127: nexus3_api pwchanger do
128: script_name 'change_admin_password'
129: content "security.securitySystem.changePassword('admin', args)"
130: args new_resource.nexus3_password
131: api_client lazy { ::Nexus3::Api.local(port, 'admin', ::File.read(passwd_file)) }
132: only_if { ::File.exist? passwd_file }
133: action :nothing
134: notifies :delete, "file[#{passwd_file}]"
135: end
136:
Compiled Resource:
------------------
# Declared in /opt/kitchen/cache/cookbooks/nexus3/resources/default.rb:127:in `block in class_from_file'
nexus3_api("admin_change_password for default@8081") do
action [:nothing]
default_guard_interpreter :default
declared_type :nexus3_api
cookbook_name "server-infrastructure-nexus"
api_client #<Nexus3::Api:0x00000000043d0fa0 @endpoint="http://localhost:8081/service/rest/v1/script/", @password="2a0d31fc-ee36-4fc9-80de-96d8f3870cc7", @user="admin">
content "security.securitySystem.changePassword('admin', args)"
args "secret"
script_name "change_admin_password"
only_if { #code block }
end
System Info:
------------
chef_version=16.5.64
platform=centos
platform_version=7.8.2003
ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
program_name=/opt/chef/bin/chef-client
executable=/opt/chef/bin/chef-client
Converge a Kitchen VM with Chef Client 16.5.64. The default recipe of this cookbook, should be in the test nodes run_list. No additional configuration for this cookbook should be required, to reproduce the issue.
Currently none for the author.
It would be very cool to be able to define users using a custom resource.
Something like that:
nexus3_users 'create my user1' do
userid 'user1'
password 'secret-password'
firstname 'firstname1'
lastname 'lastname1'
email 'email1'
roles 'anonymous'
end
Hi, I'm running test kitchen in an environment that does not have direct connectivity to the internet.
I've found that download_url
fails:
Kitchen Output:
============================================================
Error executing action `install` on resource 'nexus3[nexus]'
============================================================
Net::OpenTimeout
----------------
execution expired
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:13:in `download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:54:in `block in class_from_file'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/nexus3/recipes/default.rb
1: nexus3 'nexus' do
2: action :install
3: end
I know this isn't probably the correct place for this announcement, but I know you have mentioned interest in adopting some of the other cookbook I maintained.
https://github.com/dhoer?utf8=%E2%9C%93&tab=repositories&q=chef&type=&language=
When using nexus3_api resource I get this message:
rename api_client to new_resource.api_client at 1 location:
- /var/chef/cache/cookbooks/nexus3/resources/api.rb:21:in `block (2 levels) in class_from_file'
See https://docs.chef.io/deprecations_namespace_collisions.html for further details.
rename api_client to current_resource.api_client at 1 location:
- /var/chef/cache/cookbooks/nexus3/resources/api.rb:30:in `block (2 levels) in class_from_file'
See https://docs.chef.io/deprecations_namespace_collisions.html for further details.
At the moment all works fine, but according to this page in Chef 14 this functionality will be removed
It would be a good improvement of this cookbook if all the required gems would be installed in the default recipe. I'm using resources with a custom API client instance to communicate with the API using an updated password. The problem with that is that the required httpclient gem is not installed at the time I create the API client instance, which is directly in a resource declaration. So I suggest putting the following in the default recipe:
chef_gem 'httpclient' do
action :install
end
This would avoid this problem and everyone using this cookbook is not required to do this manually when using a custom API client instance, which is not the default created by a resource.
Issue: localhost is hardcoded at the default nexus3 api endpoint:
default['nexus3']['api']['endpoint'] = 'http://localhost:8081/service/rest/v1/script/'
localhost does not resolve always well (ipv4 vs ipv6 configuration could cause an error) but the active ip address will always work.
Proposed Solution:
Use this as the default variable: default['nexus3']['api']['endpoint'] = "http://#{node['ipaddress']}:8081/service/rest/v1/script/"
Move the various Groovy scripts out of the resource definitions into their own files.
This will make the resource code cleaner and easier to read; Groovy scripts will benefit from editor support for the language, and might be testable (no guarantee about that).
To research: how to read a cached cookbook file as content.
Instead of passing api_endpoint, api_username, api_password for each resource, pass a class ApiEndpoint defined in libraries.
Overriding the version by setting default['nexus3']['version']
in the cookbook doesn't install the correct version. It installs the version that is defaulted in the nexus3
cookbook. If you override both the version and the download URL then it will download and install the correct version.
To test:
nexus3
cookbookattributes.rb
file set default['nexus3']['version'] = '3.18.1-01'
nexus3 'nexus' do
action :install
end
After the install all folders etc. point to 3.18.1 but the install is actually for version 3.16.2-01 (which is the default version in the nexus3
cookbook)
I suspect this behaviour is due to the fact that the version is used in the download URL. I guess that version is read as soon as the default download URL is constructed which seems to be before the version number is overwritten by the dependent cookbook
Recipe: nexus3::default
* nexus3[nexus] action install[2017-07-31T10:22:14+00:00] INFO: Processing nexus3[nexus] action install (nexus3::default line 1)
================================================================================
Error executing action `install` on resource 'nexus3[nexus]'
================================================================================
SystemStackError
----------------
stack level too deep
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:13:in `block in download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:13:in `download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:20:in `download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:20:in `download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:20:in `download_url'
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:20:in `download_url'
.
.
.
/tmp/kitchen/cache/cookbooks/nexus3/providers/default.rb:54:in `block in class_from_file'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/nexus3/recipes/default.rb
1: nexus3 'nexus' do
2: action :install
3: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/nexus3/recipes/default.rb:1:in `from_file'
nexus3("nexus") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :nexus3
cookbook_name "nexus3"
recipe_name "default"
url "http://download.sonatype.com/nexus/3/latest-unix.tar.gz"
servicename "nexus"
path "/opt"
data "/opt/sonatype-work/nexus3"
home "/opt/nexus3"
properties_cookbook "nexus3"
properties_source "nexus.properties.erb"
properties_variables {"host"=>"0.0.0.0", "port"=>"8081", "args"=>"${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml", "context_path"=>"/"}
vmoptions_cookbook "nexus3"
vmoptions_source "nexus.vmoptions.erb"
vmoptions_variables {"Xms"=>"1200M", "Xmx"=>"1200M"}
end
Hi,
With the new 3.X cookbook version it seems there is no property to use our own template for nexus.properties.erb.
We were using it to add a few properties like shiro.globalSessionTimeout
or nexus.ui.keepAlive
. It seems we cannot override those parameters through jvm options but only through the nexus.properties, could you add back the support to implement our own template?
Thank you
The commit is pretty valuable, please release the commit as a patch version:
https://github.com/criteo-cookbooks/nexus3/pull/39/commits
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.