Skip to content

Conversation

@priitliivak
Copy link

@priitliivak priitliivak commented Mar 20, 2016

For CentOS 7 rpm install apparently does not create /usr/bin/keytool and /usr/bin/javadoc links. This leads to failure if playbook is run repeatedly.


This change is Reviewable

For CentOS 7 rpm install apparently does not create /usr/bin/keytool and /usr/bin/javadoc links. This leads to failure if playbook is run repeatedly.
@steenzout steenzout added this to the v4.9.8 milestone Mar 21, 2016
with_items:
- { src: "{{ oracle_java_home }}/jre/bin/keytool", dest: 'keytool' }
- { src: "{{ oracle_java_home }}/bin", dest: 'javadoc' }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably you'll need sudo: yes here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also need a when: oracle_java_set_as_default.

@steenzout
Copy link
Member

@priitliivak I'm adding some tests to replicate the problem.

@steenzout
Copy link
Member

@priitliivak after I run this the role as it is this is what I get:

[vagrant@localhost ~]$ ls -lha /usr/bin/javadoc 
lrwxrwxrwx. 1 root root 25 Mar 21 15:52 /usr/bin/javadoc -> /etc/alternatives/javadoc
[vagrant@localhost ~]$ ls -lha /usr/bin/keytool 
lrwxrwxrwx. 1 root root 25 Mar 21 15:52 /usr/bin/keytool -> /etc/alternatives/keytool

this patch will break this.
I think the idea is to let alternatives determine which Java version to point to.

@steenzout steenzout removed this from the v4.9.8 milestone Mar 21, 2016
@steenzout
Copy link
Member

here is the code that handles the Java version switch using alternatives:

- name: set Java version as default
  alternatives:
    name="{{ item.exe }}"
    link="/usr/bin/{{ item.exe }}"
    path="{{ item.path }}/{{ item.exe }}"
  when: oracle_java_set_as_default
  with_items:
    - { path: "{{ oracle_java_home }}/jre/bin", exe: 'java' }
    - { path: "{{ oracle_java_home }}/jre/bin", exe: 'keytool' }
    - { path: "{{ oracle_java_home }}/bin", exe: 'javac' }
    - { path: "{{ oracle_java_home }}/bin", exe: 'javadoc' }
  sudo: yes
  when: oracle_java_task_rpm_download|changed or (oracle_java_installed and oracle_java_version_installed != oracle_java_version_string)
  register: oracle_java_task_set_default

the problem might be the double when parameter... fixing that quickly.

This was referenced Mar 21, 2016
@steenzout
Copy link
Member

v4.9.8 tag has the fix for the double when parameter which should fix this problem.

let me know if you need more help.

@steenzout steenzout added the bug label Mar 21, 2016
@steenzout steenzout added this to the v4.9.8 milestone Mar 21, 2016
@steenzout steenzout self-assigned this Mar 21, 2016
@priitliivak
Copy link
Author

Thanks, will try it out. Using it for my personal project so not constantly
working on it. Will try out in the end of the week.

2016-03-21 23:37 GMT+02:00 Pedro Salgado notifications@github.com:

v4.9.8 tag has the fix for the double when parameter which should fix
this problem.

let me know if you need more help.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#17 (comment)

Priit Liivak
GSM: +372 55550418

@steenzout
Copy link
Member

closing ticket.

@steenzout steenzout closed this Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants