Hello community,

here is the log from the commit of package rubygem-winrm-elevated for 
openSUSE:Factory checked in at 2020-03-07 21:40:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-winrm-elevated (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-winrm-elevated.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-winrm-elevated"

Sat Mar  7 21:40:46 2020 rev:3 rq:773867 version:1.2.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/rubygem-winrm-elevated/rubygem-winrm-elevated.changes
    2019-01-21 10:54:19.991730171 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-winrm-elevated.new.26092/rubygem-winrm-elevated.changes
 2020-03-07 21:40:48.940376557 +0100
@@ -1,0 +2,6 @@
+Mon Feb 10 16:04:49 UTC 2020 - Stephan Kulow <[email protected]>
+
+- updated to version 1.2.0
+  no changelog found
+
+-------------------------------------------------------------------

Old:
----
  winrm-elevated-1.1.1.gem

New:
----
  winrm-elevated-1.2.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-winrm-elevated.spec ++++++
--- /var/tmp/diff_new_pack.vl8M3e/_old  2020-03-07 21:40:50.132377362 +0100
+++ /var/tmp/diff_new_pack.vl8M3e/_new  2020-03-07 21:40:50.136377364 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-winrm-elevated
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,15 +24,15 @@
 #
 
 Name:           rubygem-winrm-elevated
-Version:        1.1.1
+Version:        1.2.0
 Release:        0
 %define mod_name winrm-elevated
 %define mod_full_name %{mod_name}-%{version}
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  %{ruby >= 2.2.0}
+BuildRequires:  %{ruby >= 2.3.0}
 BuildRequires:  %{rubygem gem2rpm}
 BuildRequires:  ruby-macros >= 5
-Url:            https://github.com/WinRb/winrm-elevated
+URL:            https://github.com/WinRb/winrm-elevated
 Source:         https://rubygems.org/gems/%{mod_full_name}.gem
 Source1:        gem2rpm.yml
 Summary:        Ruby library for running commands as elevated

++++++ winrm-elevated-1.1.1.gem -> winrm-elevated-1.2.0.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/winrm/shells/elevated.rb 
new/lib/winrm/shells/elevated.rb
--- old/lib/winrm/shells/elevated.rb    2018-12-20 01:38:11.000000000 +0100
+++ new/lib/winrm/shells/elevated.rb    2020-02-01 01:30:27.000000000 +0100
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-require 'erubis'
+require 'erubi'
 require 'winrm'
 require 'winrm-fs'
 require 'securerandom'
@@ -33,6 +33,7 @@
         @interactive_logon = false
         @shell = Powershell.new(connection_opts, transport, logger)
         @winrm_file_transporter = WinRM::FS::Core::FileTransporter.new(@shell)
+        @execution_timeout = 86_400
       end
 
       # @return [String] The admin user name to execute the scheduled task as
@@ -44,6 +45,9 @@
       # @return [Bool] Using an interactive logon
       attr_accessor :interactive_logon
 
+      # @return [Integer] Timeout for the task to be executed
+      attr_accessor :execution_timeout
+
       # Run a command or PowerShell script elevated without any of the
       # restrictions that WinRM puts in place.
       #
@@ -75,7 +79,7 @@
       end
 
       def with_temp_file(script_text)
-        file = Tempfile.new(['winrm-elevated-shell', 'ps1'])
+        file = Tempfile.new(%w[winrm-elevated-shell ps1])
         file.write(script_text)
         file.write("\r\n$Host.SetShouldExit($LASTEXITCODE)")
         file.fsync
@@ -91,12 +95,18 @@
       end
 
       def wrap_in_scheduled_task(script_path, username, password)
-        Erubis::Eruby.new(elevated_shell_script_content).result(
+        context = {
           username: username,
           password: password,
           script_path: script_path,
-          interactive_logon: interactive_logon
-        )
+          interactive_logon: interactive_logon,
+          execution_timeout: execution_timeout
+        }
+
+        b = binding
+        locals = context.collect { |k, _| "#{k} = context[#{k.inspect}]; " }
+        b.eval(locals.join)
+        b.eval(Erubi::Engine.new(elevated_shell_script_content).src)
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/winrm-elevated/scripts/elevated_shell.ps1 
new/lib/winrm-elevated/scripts/elevated_shell.ps1
--- old/lib/winrm-elevated/scripts/elevated_shell.ps1   2018-12-20 
01:38:11.000000000 +0100
+++ new/lib/winrm-elevated/scripts/elevated_shell.ps1   2020-02-01 
01:30:27.000000000 +0100
@@ -16,7 +16,7 @@
   $logon_type_xml = "<LogonType>InteractiveTokenOrPassword</LogonType>"
 }
 
-$task_name = "WinRM_Elevated_Shell"
+$task_name = "WinRM_Elevated_Shell_" + (New-Guid).Guid
 $out_file = [System.IO.Path]::GetTempFileName()
 $err_file = [System.IO.Path]::GetTempFileName()
 
@@ -83,7 +83,7 @@
 
 function SlurpOutput($file, $cur_line, $out_type) {
   if (Test-Path $file) {
-    get-content $file | select -skip $cur_line | ForEach {
+    get-content $file | Select-Object -skip $cur_line | ForEach-Object {
       $cur_line += 1
       if ($out_type -eq 'err') {
         $host.ui.WriteErrorLine("$_")
@@ -97,11 +97,13 @@
 
 $err_cur_line = 0
 $out_cur_line = 0
+$timeout = <%= execution_timeout %>
+$startDate = Get-Date
 do {
   Start-Sleep -m 100
   $out_cur_line = SlurpOutput $out_file $out_cur_line 'out'
   $err_cur_line = SlurpOutput $err_file $err_cur_line 'err'
-} while (!($registered_task.state -eq 3))
+} while( (!($registered_task.state -eq 3)) -and 
($startDate.AddSeconds($timeout) -gt (Get-Date)) )
 
 # We'll make a best effort to clean these files
 # But a reboot could possibly end the task while the process
@@ -111,6 +113,9 @@
 try { Remove-Item $script_file -ErrorAction Stop } catch {}
 
 $exit_code = $registered_task.LastTaskResult
+
+try { Unregister-ScheduledTask -TaskName $task_name -Confirm:$false } catch {}
+
 [System.Runtime.Interopservices.Marshal]::ReleaseComObject($schedule) | 
Out-Null
 
 exit $exit_code
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2018-12-20 01:38:11.000000000 +0100
+++ new/metadata        2020-02-01 01:30:27.000000000 +0100
@@ -1,16 +1,30 @@
 --- !ruby/object:Gem::Specification
 name: winrm-elevated
 version: !ruby/object:Gem::Version
-  version: 1.1.1
+  version: 1.2.0
 platform: ruby
 authors:
 - Shawn Neal
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2018-12-19 00:00:00.000000000 Z
+date: 2020-01-31 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
+  name: erubi
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - "~>"
+      - !ruby/object:Gem::Version
+        version: '1.8'
+  type: :runtime
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - "~>"
+      - !ruby/object:Gem::Version
+        version: '1.8'
+- !ruby/object:Gem::Dependency
   name: winrm
   requirement: !ruby/object:Gem::Requirement
     requirements:
@@ -113,7 +127,7 @@
   requirements:
   - - ">="
     - !ruby/object:Gem::Version
-      version: 2.2.0
+      version: 2.3.0
 required_rubygems_version: !ruby/object:Gem::Requirement
   requirements:
   - - ">="
@@ -121,7 +135,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.7.6
+rubygems_version: 2.7.8
 signing_key: 
 specification_version: 4
 summary: Ruby library for running commands as elevated


Reply via email to