ansible-oracle-java icon indicating copy to clipboard operation
ansible-oracle-java copied to clipboard

fatal: [default]: FAILED! => {"changed": false, "dest": "/tmp/jdk-8u112-linux-x64.tar.gz", "failed": true, "msg": "Request failed", "response": "HTTP Error 404: Not Found", "state": "absent", "status_code": 404, "url": "http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz"}

Open javahas opened this issue 7 years ago • 11 comments

started getting this error today, it worked last week but now it doesn't

fatal: [default]: FAILED! => {"changed": false, "dest": "/tmp/jdk-8u112-linux-x64.tar.gz", "failed": true, "msg": "Request failed", "response": "HTTP Error 404: Not Found", "state": "absent", "status_code": 404, "url": "http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz"}

javahas avatar May 22 '17 22:05 javahas

I am also facing the same error.

fatal: [10.0.225.94]: FAILED! => {
    "changed": false,
    "dest": "/tmp/jdk-8u91-linux-x64.tar.gz",
    "failed": true,
    "invocation": {
        "module_args": {
            "backup": false,
            "checksum": "",
            "content": null,
            "delimiter": null,
            "dest": "/tmp/jdk-8u91-linux-x64.tar.gz",
            "directory_mode": null,
            "follow": false,
            "force": false,
            "force_basic_auth": false,
            "group": null,
            "headers": "Cookie:oraclelicense=accept-securebackup-cookie",
            "http_agent": "ansible-httpget",
            "mode": null,
            "owner": null,
            "regexp": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "sha256sum": "",
            "src": null,
            "timeout": 10,
            "tmp_dest": "",
            "unsafe_writes": null,
            "url": "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz",
            "url_password": null,
            "url_username": null,
            "use_proxy": true,
            "validate_certs": true
        },
        "module_name": "get_url"
    },
    "msg": "Request failed",
    "response": "HTTP Error 404: Not Found",
    "state": "absent",
    "status_code": 404,
    "url": "http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz"
}

for now I have added a workaround in my copy of role

- name: get JDK tarball (as tar.gz file)
  command: "<wget path of your s3>"
  args:
    chdir: "/tmp"
  when: ansible_pkg_mgr != "yum" and ansible_pkg_mgr != "zypper" and ansible_os_family != 'Darwin'

cc: @akshita27

manjitkumar avatar May 23 '17 05:05 manjitkumar

This is probably because the URL structure has changed:

When I download JDK using the UI, I see an additional hash.

http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

savishy avatar May 23 '17 08:05 savishy

I think this PR would solve the issue : https://github.com/William-Yeh/ansible-oracle-java/pull/60

How can we speed up the merge of it ? @William-Yeh

gbergere avatar May 23 '17 10:05 gbergere

I manually changed one of the files, which fixed issue for me, until the fix will be in: replace the context of williamyeh.oracle-java/defaults/main.yml with::

java_version: 8 java_subversion: 131 java_build_custom: 11 jdk_version_detail_custom: "{{ java_version }}u{{ java_subversion }}-b{{ java_build_custom }}" jdk_tarball_hash: d54c1d3a095b4ff2b6607d096fa80163 jdk_tarball_url: "http://download.oracle.com/otn-pub/java/jdk/{{ jdk_version_detail_custom }}/{{ jdk_tarball_hash }}/{{ jdk_tarball_file }}" java_download_path: /tmp java_download_from_oracle: true java_remove_download: true java_install_jce: false java_set_javahome: false

javahas avatar May 23 '17 18:05 javahas

While that does seem to be unique for JDK 8u131, older versions have different hashes:

http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz

savishy avatar May 24 '17 04:05 savishy

Duplicate of #58, I believe.

afeld avatar May 24 '17 20:05 afeld

The issue is not with hashes (they are not used for older distributions (like 112, in this issue), but the URL is different (second is copied from Oracle's site):

http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz
http://download.oracle.com/otn/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz

I've changed that in /etc/ansible/roles/williamyeh.oracle-java/tasks/set-role-variables.yml, and now I get different error:

{"changed": false, "dest": "/tmp/jdk-8u112-linux-x64.rpm", "failed": true, "msg": "Request failed", "response": "HTTP Error 401: Authorization Required", "state": "absent", "status_code": 401, "url": "http://download.oracle.com/otn/java/jdk/8u112-b15/jdk-8u112-linux-x64.rpm"}

accept-securebackup-cookie is not working anymore? Damn, Oracle! Why do you hate us?

madhead avatar May 25 '17 16:05 madhead

Anyone found some work around for this? I change the URL to http://download.oracle.com/otn/java/jdk/8u91-b14/jdk-8u91-linux-i586.rpm but still, it fails with authentication error. If anyone know any other ansible role, then also please let me know. Thanks !

niravradia avatar Jun 19 '17 15:06 niravradia

same with mac users. currently not working...

avivys avatar Jul 24 '17 14:07 avivys

After playing around using wget, I think I have a (hacky, non-ansible) solution that could be made into a role.

First, from @ianhattendorf's comment on #58 , I did the equivalent for 8u144b01 on Mac OS using bash and wget. But I also needed to send a cookie with the current timestamp to Oracle to get around auth errors:

#!/usr/bin/env bash

jdk_platform=macosx-x64
jdk_file_extension=dmg
java_version=8
java_subversion=144
java_build_custom=01
jdk_version_detail_custom="${java_version}u${java_subversion}-b${java_build_custom}"
jdk_tarball_hash="090f390dda5b47b9b721c7dfaa008135"
jdk_tarball_file="jdk-${java_version}u${java_subversion}-${jdk_platform}.${jdk_file_extension}"
jdk_tarball_url="http://download.oracle.com/otn-pub/java/jdk/${jdk_version_detail_custom}/${jdk_tarball_hash}/${jdk_tarball_file}"

# substitute current date into the cookies file
now=`date`
epoch=`date -j -f "%a %b %d %T %Z %Y" "${now}" "+%s"`
inHalfAnHour=`expr ${epoch} \+ 1800`
tomorrow=`expr ${epoch} \+ 86400`
nextmonth=`expr ${epoch} \+ 2592000`
epochmillis="${epoch}000"


cat <<EOF > cookies.txt
www.oracle.com FALSE /technetwork/java/javase/downloads FALSE 0 testSessionCookie Enabled
.oracle.com TRUE / FALSE ${tomorrow} oraclelicense accept-securebackup-cookie
.oracle.com TRUE / FALSE ${inHalfAnHour} s_nr ${epochmillis}
EOF

# replace spaces with tabs
tempfile=`mktemp`
sed -e "s/ /    /g" cookies.txt > "${tempfile}" && mv -f "${tempfile}" cookies.txt

wget --load-cookies cookies.txt "${jdk_tarball_url}"

cunneen avatar Oct 12 '17 15:10 cunneen

You'll need to replace the replacement expression in that sed to be a tab character, as github has converted it to whitespace:

sed -e "s/ /TAB_CHAR_HERE/g"  ... 

cunneen avatar Oct 12 '17 16:10 cunneen