2017-05-25 156 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