[英]Chef download and install Oracle Java on Windows
我想在Windows 7上使用Chef 13安装Java。
从文件安装很容易,但是我也想从Oracle归档文件中下载它。 问题是,Oracle需要特殊的cookie- oraclelicense=accept-securebackup-cookie
。
我尝试过Java食谱,因为人们似乎做到了没有问题。 Hovewer,运行Chef后出现错误:
Recipe: java::notify
* log[jdk-version-changed] action nothing (skipped due to action :nothing)
Recipe: java::windows
* ruby_block[Enable Accessing cookies] action run
- execute the ruby block Enable Accessing cookies
* remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] action create[2017-05-25T08:30:21+02:00] WARN: remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] cannot be downloaded from http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe: 401 "Authorization Required"
[2017-05-25T08:30:21+02:00] WARN: remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] cannot be downloaded from http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe: 401 "Authorization Required"
================================================================================
Error executing action `create` on resource 'remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe]'
================================================================================
Net::HTTPServerException
------------------------
401 "Authorization Required"
Resource Declaration:
---------------------
# In C:/Users/User/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb
62: remote_file cache_file_path do
63: checksum pkg_checksum if pkg_checksum
64: source node['java']['windows']['url']
65: backup false
66: action :create
67: end
68: end
Compiled Resource:
------------------
# Declared in C:/Users/User/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb:62:in `from_file'
remote_file("C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe") do
provider Chef::Provider::RemoteFile
action [:create]
default_guard_interpreter :default
source ["http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe"]
use_etag true
use_last_modified true
declared_type :remote_file
cookbook_name "java"
recipe_name "windows"
path "C:/Users/User\\.chef\\local-mode-cache\\cache/jdk-7u79-windows-i586.exe"
checksum nil
rights nil
deny_rights nil
verifications []
end
System Info:
------------
chef_version=13.0.118
platform=windows
platform_version=6.1.7600
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [i386-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
如您在上面的日志中所看到的,我已经将['java']['oracle']['accept_oracle_download_terms']
为true( execute the ruby block Enable Accessing cookies
)。
由于此菜谱对我不起作用,因此我尝试制作自己的Java菜谱:
windows_package package_name do
source source
action :install
installer_type :custom
remote_file_attributes ({
:headers => {"Cookie" => "oraclelicense=accept-securebackup-cookie"}
})
options opts
end
...并且仍然会出现相同的错误。
Oracle网站上的任何更改都使下载JDK不再起作用了吗? 还是我必须设置防火墙或其他东西?
不幸的是,Oracle会不时引入这样的更改。 由于从常规用户的角度来看,对此无能为力,因此最好的解决方案是自己托管软件包,并修改节点属性以指向该源。 这就是我要做的,属性看起来像这样(对于linux和samba共享):
"java": {
"install_flavor": "oracle",
"jdk_version": "8",
"jdk" : {
"8" : {
"x86_64" : {
"url" : "file:///path/to/jdk-8u131-linux-x64.tar.gz",
"checksum": "the file's checksum"
}
}
}
}
这样,甲骨文所做的更改不再是问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.