Open kostecky opened 4 months ago
您的邮件我已经收到,我会尽快回复您!
Thank you!
Maybe something like this for the docker py script, - although it would add HP specific ilo code in this and the python libraries would have to be modified to pass these options. I'll await your response! Have a good day.
def get_java_viewer(
hostname,
skip_login,
user,
password,
download_location,
login_endpoint,
download_endpoint,
ssl_verify,
user_attribute_name,
password_attribute_name,
extra_form_fields=None,
format_jnlp=False,
use_json=False,
session_cookie_key=None,
session_only=False,
generate_jnlp=False, # New parameter to control JNLP generation
ilo_jar="html/intgapp3_231.jar", # Default value for iLO jar file
):
# Your existing function code up until the JNLP handling part
if generate_jnlp:
# Generate JNLP content using provided details
jnlp_template = f"""<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="{hostname}" href="">
<information>
<title>Integrated Remote Console</title>
<vendor>HPE</vendor>
<offline-allowed></offline-allowed>
</information>
<security>
<all-permissions></all-permissions>
</security>
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"></j2se>
<jar href="{hostname}/{ilo_jar}" main="false" />
</resources>
<applet-desc main-class="com.hp.ilo2.intgapp.intgapp" name="iLOJIRC" documentbase="{hostname}/html/java_irc.html" width="1" height="1">
<param name="RCINFO1" value="{session_cookie_key}"/>
<param name="RCINFOLANG" value="en"/>
</applet-desc>
<update check="background"></update>
</jnlp>"""
# Write the JNLP content to a file
with open(download_location, "w") as f:
f.write(jnlp_template)
logging.info("Generated JNLP file.")
else:
# Your existing code for downloading the JNLP file
# Any additional function code
We had a similar issue before: #22 IMHO, this could only be solved in a general way if nojava-ipmi-kvm would include a JavaScript engine, but this is probably a bit over the top. But if you know the template which is used for the jnlp generation, this should work. To keep it general, it would probably be better to reference the template in the nojava-ipmi-kvm configuration file. This way, users could use different templates without changing the source code.
OK, I managed to get this working! However, once I VNC in, the java applet runs, downloads jar, good stdout, but the window that should display the console is just white. It does have the proper header as I"m used to, but no video =(
Any ideas? The dreaded xprop error =(
java.security.AccessControlException: access denied ("java.io.FilePermission" "/usr/bin/xprop" "execute")
2024-03-04 18:11:49,575 DEBG 'javaws' stdout output:
No video. image_source = java.awt.image.MemoryImageSource@4d08b705
2024-03-04 18:11:49,575 DEBG 'javaws' stdout output:
2024-03-04 18:11:59,258 DEBG 'javaws' stdout output:
Moving Power to ON state
2024-03-04 18:11:59,270 DEBG 'javaws' stdout output:
Do you usually use Oracle Java or the OpenJDK? Some KVM consoles do not work without Oracle Java 😢
That was it. I had to use 8u211!!!
Thank you so much. Now I have to document all my changes and keep this forever ;)
I'm not sure if you've come across this before but in the HP ilo3 IPMI, these jnlp files are dynamically generated from javascript and then the browser saves the file. It's not a static download. This looks as though it might work if I just get this last part working! I managed to figure out the remaining options to set.
Is there any workaround for this? I have the format of the file where you just need to replace the variables that are ${} or $