2017-05-25 140 views
0

我想在Windows 7厨师下载和在Windows

从文件安装很容易用厨师13安装Java安装Oracle的Java,但我想也从Oracle档案下载。事情是,Oracle需要特殊的cookie - oraclelicense=accept-securebackup-cookie

我试过java食谱,因为看起来人们没有问题。 Hovewer,运行后,厨师,我得到错误:

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不起作用了吗?或者我必须设置防火墙或什么?

+1

我听说Oracle最近改变了一些东西,它可能会打破自动下载。这不太可能成为防火墙问题。 –

+0

我确实希望有另一种方式来下载它们......你可能有这些信息的来源吗?我想阅读它。 – deem

回答

0

Oracle不时引入这样的变化,这很不幸常见。由于从常规用户的角度来看没有办法做到这一点,所以最好的解决方案是自己托管包,并修改节点属性以指向该源。这就是我做的,有看起来像这样(为Linux和桑巴份额)属性:

"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" 
     } 
    } 
    } 
} 

这样一来,像甲骨文做出的一个改变是不再有问题。

+0

我正在尝试编写安装Java的通用食谱 - 我没有任何人可见的FTP服务器。也许有一些方法可以获得这些资源? – deem