rockyluke / drac-kvm Goto Github PK
View Code? Open in Web Editor NEWThis project forked from paulmaddox/drac-kvm
A simple CLI launcher for Dell DRAC and HP iLO.
License: Apache License 2.0
This project forked from paulmaddox/drac-kvm
A simple CLI launcher for Dell DRAC and HP iLO.
License: Apache License 2.0
[signal 0xc0000005 code=0x0 addr=0x30 pc=0x6d8da9]
goroutine 1 [running]:
main.visit(0x78d8b5, 0x16, 0x0, 0x0, 0x7e34c0, 0xc000070de0, 0x79ab08, 0x50)
E:/bin/gopath/src/github.com/rockyluke/drac-kvm/consts_windows_amd64.go:25 +0x49
path/filepath.Walk(0x78d8b5, 0x16, 0x7a21b8, 0x1, 0xa)
E:/bin/goroot/src/path/filepath/path.go:402 +0x71
main.DefaultJavaPath(0x7880be, 0x5)
E:/bin/gopath/src/github.com/rockyluke/drac-kvm/consts_windows_amd64.go:19 +0x7e
main.main()
E:/bin/gopath/src/github.com/rockyluke/drac-kvm/main.go:92 +0x275
Hi,
when getJavawsArgs() returns an empty string, javaws refuses to launch: "netx: Invalid argument: net.sourceforge.jnlp.util.optionparser.InvalidArgumentException: [ , /tmp/kvm_.jnlp]"
Also there's no -wait flag in my javaws despite OpenJDK 1.8.0 is properly installed (see attached logs). This could be my fault I guess. Maybe the version and thus flag existence should be matched against javaws?
This patch fixed the problem (stdout & stderr redirected for better debugging):
diff --git a/main.go b/main.go
index 195c530..4c81f7f 100644
--- a/main.go
+++ b/main.go
@@ -54,8 +54,6 @@ func getJavawsArgs(waitFlag bool) string {
strings.Contains(string(slurp[:]), "1.8") {
if waitFlag {
javawsArgs = "-wait"
- } else {
- javawsArgs = ""
}
}
@@ -196,7 +194,10 @@ func main() {
// Launch it!
log.Printf("Launching KVM session with %s", filename)
- if err := exec.Command(*_javaws, getJavawsArgs(*_wait), filename, "-nosecurity", "-noupdate", "-Xnofork").Run(); err != nil {
+ cmd := exec.Command(*_javaws, getJavawsArgs(*_wait), filename, "-nosecurity", "-noupdate", "-Xnofork")
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ if err := cmd.Run(); err != nil {
os.Remove(filename)
log.Fatalf("Unable to launch DRAC (%s), from file %s", err, filename)
}
My environment:
rush@jarvis:~$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
rush@jarvis:~$ javaws -version
icedtea-web 1.6.2 (1.6.2-3ubuntu1)
rush@jarvis:~$ javaws
SYNOPSIS
javaws [-run-options] jnlp file
javaws [-control-options]
OPTIONS
When specifying options, the name of the jnlp file can be after the command, the -jnlp option, an option with no arguments, or after an argument with an option that takes one argument. A html file that launches a jnlp can be specified after the -html option.
The jnlp-file can either be a url or a local path.
The JNLP file should only be specified once, whether as a main argument, after -jnlp or through an html file.
Control options:
-about - Shows a sample application.(No argument expected)
-help - Prints out information about supported command and basic usage.(No argument expected)
-license - Display the GPL license and exit.(No argument expected)
-viewer - Shows the trusted certificate viewer.(No argument expected)
-Xclearcache - Clean the JNLP application cache.(No argument expected)
Run options:
-allowredirect - Follows HTTP redirects.(No argument expected)
-arg arg - Adds an application argument before launching.(Expected one or more arguments)
-headless - Disables download window, other UIs.(No argument expected)
-html - Location of HTML file to launch (url or file). You can use parameter ALL or numbers (like 1 2 5) to select applets on page. However experimental, this switch should keep you still in safety.(Expected one or more arguments)
-jnlp - Location of JNLP file to launch (url or file).(Exactly one argument expected)
-nosecurity - Disables the secure runtime environment.(No argument expected)
-noupdate - Disables checking for updates.(No argument expected)
-param name=value - Adds an applet parameter before launching.(Expected one or more arguments)
-property name=value - Sets a system property before launching.(Expected one or more arguments)
-strict - Enables strict checking of JNLP file format.(No argument expected)
-update seconds - Check for updates.(Exactly one argument expected)
-verbose - Enable verbose output.(No argument expected)
-version - Print the IcedTea-Web version and exit.(No argument expected)
-Xignoreheaders - Skip jar header verification.(No argument expected)
-xml - Uses a strict XML parser to parse the JNLP file.(No argument expected)
-Xnofork - Do not create another JVM.(No argument expected)
-Xoffline - Prevent ITW network connection. Only cache will be used. Application can still connect.(No argument expected)
-Xtrustnone - Instead of asking user, will foretold all answers as no.(No argument expected)
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x68 pc=0x722ae1]
goroutine 1 [running]:
github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig.(*ConfigFile).GetValue(0x0, 0x7f3129, 0x8, 0x7f4085, 0xb, 0x0, 0x0, 0x0, 0x0)
C:/Users/Nikdo/go/src/github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig/conf.go:164 +0x51
main.main()
C:/Users/Nikdo/go/src/github.com/rockyluke/drac-kvm/main.go:109 +0x507
Hi , boss
now idrac version 2.60.60.60 use this running notice faile.
you have time test.
tks
This is an awesome utility. If only there was a way to enable weak Java algorithms with a flag rather than having to set it in the java.security
file, and a way to ignore the invalid certificate popup with a flag too...
Here is my error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x68 pc=0x6b40c1]
goroutine 1 [running]:
github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig.(*ConfigFile).GetValue(0x0, 0xc042062090, 0x9, 0x772483, 0x4, 0x0, 0x0, 0x0, 0x0)
D:/bin/gopath/src/github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig/conf.go:164 +0x51
main.main()
D:/bin/gopath/src/github.com/rockyluke/drac-kvm/main.go:115 +0x410
I know a little bit about Golang, I'll try to see if I can figure it out when I get some time :)
drac-kvm is not working on HighSierra, version 10.13.6 with go installed using brew, go version: go1.11.1 darwin/amd64
When running drac-kvm I get this:
drac-kvm -h 10.107.1.121 -u root -p password
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12d78ea]
goroutine 1 [running]:
github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig.(*ConfigFile).GetValue(0x0, 0x1398031, 0x8, 0x1398d1b, 0xb, 0x0, 0x0, 0x0, 0x0)
/Users/bogdan/go/src/github.com/rockyluke/drac-kvm/vendor/github.com/Unknwon/goconfig/conf.go:164 +0x4a
main.main()
/Users/bogdan/go/src/github.com/rockyluke/drac-kvm/main.go:109 +0x436
Hello,
thank you once more for this marvelous tool! Today I started using it for Supermicro as well.
There's a minor annoyance with --vendor having default value set to "dell". It causes ignoring vendor set in .drackvmrc.
The reason is this if block - *_vendor is never an empty string due to the default value. (https://github.com/rockyluke/drac-kvm/blob/master/main.go#L141)
if *_vendor == "" {
if value, err := cfg.GetValue(*_host, "vendor"); err == nil {
vendor = value
} else {
// To keep old default behaviour we set vendor string to dell by default.
vendor = "dell"
}
} else {
vendor = *_vendor
}
if _, err := kvm.CheckVendorString(vendor); err != nil {
log.Fatalf("Provided vendor: %s, is not supported consider adding support with Github PR...", vendor)
}
Quick and dirty fix is to replace if *_vendor == "" {
with if *_vendor == "" || *_vendor == "dell" {
but it's clearly suboptimal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.