You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2020/11/10 09:59:59 UTC

[GitHub] [brooklyn-server] duncangrant opened a new pull request #1122: Winrmtaskfactory - Similar to SshTaskFactory

duncangrant opened a new pull request #1122:
URL: https://github.com/apache/brooklyn-server/pull/1122


   So this gives us a WinrmTaskFactory which can be used in the same way as the sshtaskfactory. Some generalisations of MachineLocation etc were required which I think is a good thing.
   
   e.g.
   
                   WinRmTasks.newWinrmExecTaskFactory(winRmMachineLocation, "my command").runAsCommand().summary();
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [brooklyn-server] duncangrant closed pull request #1122: Winrmtaskfactory - Similar to SshTaskFactory

Posted by GitBox <gi...@apache.org>.
duncangrant closed pull request #1122:
URL: https://github.com/apache/brooklyn-server/pull/1122


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [brooklyn-server] duncangrant commented on a change in pull request #1122: Winrmtaskfactory - Similar to SshTaskFactory

Posted by GitBox <gi...@apache.org>.
duncangrant commented on a change in pull request #1122:
URL: https://github.com/apache/brooklyn-server/pull/1122#discussion_r520444242



##########
File path: pom.xml
##########
@@ -164,7 +164,7 @@
         <jax-rs-api.version>2.1.1</jax-rs-api.version> <!-- differs from jclouds 2.1.2, which depends on v2.0.1 -->
         <maxmind.version>2.8.0-rc1</maxmind.version>
         <maxmind-db.version>1.2.1</maxmind-db.version>
-        <winrm4j.version>0.9.0</winrm4j.version> <!--  FIXME NO CHECK IN -->
+        <winrm4j.version>0.9.0-SNAPSHOT</winrm4j.version> <!--  FIXME NO CHECK IN -->

Review comment:
       This is wrong and needs to be something else but I'm not sure what yet

##########
File path: software/winrm/src/main/java/org/apache/brooklyn/location/winrm/WinRmMachineLocation.java
##########
@@ -507,4 +515,43 @@ public String resolveOnBoxDirFor(Entity entity, String unresolvedPath) {
         return unresolvedPath.replaceAll("/", "\\");
     }
 
+    public int installTo(ResourceUtils utils, Map<String, ?> props, String url, String destPath) {
+        LOG.debug("installing {} to {} on {}, attempting remote curl", new Object[] { url, destPath, this });
+
+        try(PipedInputStream insO = new PipedInputStream(); OutputStream outO = new PipedOutputStream(insO);
+            PipedInputStream insE = new PipedInputStream(); OutputStream outE = new PipedOutputStream(insE);
+            StreamGobbler sgsO = new StreamGobbler(insO, null, LOG);
+            StreamGobbler sgsE = new StreamGobbler(insE, null, LOG)
+            ){
+            sgsO.setLogPrefix("[curl @ "+getAddress()+":stdout] ").start();
+            sgsE.setLogPrefix("[curl @ "+getAddress()+":stderr] ").start();
+            Map<String, ?> winrmProps = MutableMap.<String, Object>builder().putAll(props).put("out", outO).put("err", outE).build();
+            ImmutableList<String> commands = ImmutableList.of(
+                    "echo $WebClient = New-Object System.Net.WebClient > C:\\temp.ps1",

Review comment:
       oops - I need to create a proper temp file here I guess




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org