-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External ip config for winrm byon location #690
base: master
Are you sure you want to change the base?
Conversation
int port; | ||
if (ssh != null) { | ||
userAndHostAndPort = parseUserAndHostAndPort(ssh, 22); | ||
if (machineConfig.containsKey("winrm") && !(machineConfig.get("winrm") instanceof String)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@iyovcheva what do you think about supporting external provider for ssh address as well. It will be more consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bostko I agree. Will need to test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
External config is not supported for ssh. If we implement it, it's good to go in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!(machineConfig.get("winrm") instanceof String)
might be better as machineConfig.get("winrm") instanceof DeferredSupplier
?
4ec5eb2
to
7bffcd6
Compare
int port; | ||
if (ssh != null) { | ||
userAndHostAndPort = parseUserAndHostAndPort(ssh, 22); | ||
if (machineConfig.containsKey("winrm") && !(machineConfig.get("winrm") instanceof String)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iyovcheva The changes here break the support for specifying winrm
as user@host:port
. Can you add it to the test cases.
On the other hand your approach is also interesting because it doesn't resolve the value here - at the time of deploying the blueprint. Obtaining the machine could happen much later in the lifecycle where the external values have already changed.
A proper solution would involve moving all of non-essential parsing to the machine location, leaving only minimal sanity checks here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you only wanting to support external
for winrm
? If you're adding external support for the address why not do it for ssh
too?
waitForApplicationTasks(app); | ||
Asserts.shouldHaveFailedPreviously(); | ||
} catch (Exception e) { | ||
Asserts.expectedFailureOfType(e, NullPointerException.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's bad if we are throwing null pointer exceptions - these should be caught lower in the code and at least turned into something more useful with a useful error message that you can then test in here. For example use Preconditions.checkArgument
on whatever is throwing the NPE.
userAndHostAndPort = parseUserAndHostAndPort(ssh, 22); | ||
} else { | ||
// TODO set to null and rely on the MachineLocation. If not then make a dependency to WinRmMachineLocation and use its config key name. | ||
userAndHostAndPort = parseUserAndHostAndPort(winrm, vals.get("winrm.useHttps") != null && (Boolean)vals.get("winrm.useHttps") ? 5986 : 5985); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a variable here to store the result of the logical expression, it will make it a lot easier to read.
The second clause should be Boolean.parseBoolean(vals.get("winrm.useHttps").toString())
.
machineConfig.put("port", port); | ||
// If there is a tcpPortMapping defined for the connection-port, then use that for ssh/winrm machine | ||
port = userAndHostAndPort.getHostAndPort().getPort(); | ||
if (tcpPortMappings != null && tcpPortMappings.containsKey(port)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do this if
in a separate method, this one is long enough already!
machineConfig.put("address", host); | ||
try { | ||
InetAddress.getByName(host); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnknownHostException
int port; | ||
if (ssh != null) { | ||
userAndHostAndPort = parseUserAndHostAndPort(ssh, 22); | ||
if (machineConfig.containsKey("winrm") && !(machineConfig.get("winrm") instanceof String)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!(machineConfig.get("winrm") instanceof String)
might be better as machineConfig.get("winrm") instanceof DeferredSupplier
?
@geomacy yep, I'm currently working on it |
39a9cc1
to
58847c1
Compare
30dd296
to
946c0de
Compare
retest this please |
Failing with "cannot create temporary folders in parent /tmp after 1000 attempts" which is not related to the PR |
retest this please |
1 similar comment
retest this please |
No description provided.