[Gelöst] Lizenzmanagement: Uninstall -> Freigabe Lizenz

Antworten
cgebauer
Beiträge: 31
Registriert: 15 Feb 2012, 09:53

[Gelöst] Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von cgebauer »

Hallo an alle,

wir haben vor ein paar Tagen das Lizenzmodul gekauft. Nun bin ich dabei ein Paket mit den entsprechenden Winst Kommandos zu versehen.
Soweit funktioniert das, bozogen auf die Installation, auch ganz gut. Beim Uninstall hingegen, wird die Lizenz leider nicht freigegeben.

Hier mein Uninstall Script:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
;
; License Management removed
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
;DefVar $MsiId32$
;DefVar $UninstallProgram32$
;DefVar $MsiId64$
;DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
;DefVar $InstallDir32$
;DefVar $InstallDir64$
DefVar $INST_SystemType$
;DefVar $INST_architecture$
DefVar $LicenseRequired$
DefVar $licensepool$


Set $INST_SystemType$ = GetSystemType
;set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$ = "%installingProdName%"
Set $licensepool$ = "p_" + $ProductId$
Set $LicenseRequired$    = "true"
;Set $InstallDir32$    = "%ProgramFiles32Dir%\<path to the product>"
;Set $InstallDir64$    = "%ProgramFiles64Dir%\<path to the product>"
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\dragon.png" $ProductId$
 
Message "Deinstalliere " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
endif

if $LicenseRequired$ = "true"
   comment "Licensing required, free license used"
   Sub_free_license
endif

[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
Im Log gibt es dann folgende Fehlermeldung:

Code: Alles auswählen

[6] [Jun 29 16:17:00:395] [dragon-naturally-speaking]   ~~~~~~~ Start Sub ~~~~~~~  Sub_free_license
[5] [Jun 29 16:17:00:395] [dragon-naturally-speaking]   comment: License management is enabled and will be used
[5] [Jun 29 16:17:00:395] [dragon-naturally-speaking]   comment: Trying to free license used for the product
[5] [Jun 29 16:17:00:395] [dragon-naturally-speaking]   Set  $result$ = FreeLicense("", $ProductId$)
[2] [Jun 29 16:17:00:395] [dragon-naturally-speaking]   Syntax Error in Section: Sub_free_license (Command in line 64 origin: p:\dragon-naturally-speaking\uninstall.ins line: 65): $result$ = FreeLicense($LicensePool$) -> FreeLicense("", $ProductId$) no valid expression for a string list
[6] [Jun 29 16:17:08:816] [dragon-naturally-speaking]   
[6] [Jun 29 16:17:08:816] [dragon-naturally-speaking]   ~~~~~~~ End Sub   ~~~~~~~  Sub_free_license
[6] [Jun 29 16:17:08:816] [dragon-naturally-speaking]   
[2] [Jun 29 16:17:08:816] [dragon-naturally-speaking]   Syntax Error in Section: Actions (Command in line 56 origin: p:\dragon-naturally-speaking\uninstall.ins line: 57): EndIf -> expected
[1] [Jun 29 16:17:09:746] [dragon-naturally-speaking] ___________________
[1] [Jun 29 16:17:09:746] [dragon-naturally-speaking] script finished
Die Kommandos habe ich mir aus den Templates gezogen, wie im Handbuch beschrieben.
Was könnte die Ursache für den Fehler sein? Ich hoffe ihr könnt mir weiterhelfen.

Vielen Dank im Voraus

Carsten
Zuletzt geändert von cgebauer am 30 Jun 2015, 15:04, insgesamt 1-mal geändert.
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von r.roeder »

Hallo Carsten,

die Fehlermeldung passt nicht zu dem geposteten Skriptausschnitt - bitte nochmal überprüfen und neu posten,

Grüße
R. Röder


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


cgebauer
Beiträge: 31
Registriert: 15 Feb 2012, 09:53

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von cgebauer »

Hallo,

da ist mir in der Tat ein Fehler unterlaufen. Danke für den Hinweis.
Hier sind jetzt die richtigen Ausschnitte.

Uninstall Script:

Code: Alles auswählen

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
;
; License Management removed
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
;DefVar $MsiId32$
;DefVar $UninstallProgram32$
;DefVar $MsiId64$
;DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
;DefVar $InstallDir32$
;DefVar $InstallDir64$
DefVar $INST_SystemType$
;DefVar $INST_architecture$
DefVar $LicenseRequired$
DefVar $licensepool$


Set $INST_SystemType$ = GetSystemType
;set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$ = "%installingProdName%"
Set $licensepool$ = "p_" + $ProductId$
Set $LicenseRequired$    = "true"
;Set $InstallDir32$    = "%ProgramFiles32Dir%\<path to the product>"
;Set $InstallDir64$    = "%ProgramFiles64Dir%\<path to the product>"
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\dragon.png" $ProductId$
 
Message "Deinstalliere " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub.ins"
endif

if $LicenseRequired$ = "true"
   comment "Licensing required, free license used"
   Sub_free_license
endif

[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
Log:

Code: Alles auswählen

[6] [Jun 30 13:36:03:345] [dragon-naturally-speaking] If
[5] [Jun 30 13:36:03:345] [dragon-naturally-speaking]   $LicenseRequired$ = "true"   <<< result true
[6] [Jun 30 13:36:03:345] [dragon-naturally-speaking] Then
[5] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   comment: Licensing required, free license used
[6] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   
[6] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   ~~~~~~~ Start Sub ~~~~~~~  Sub_free_license
[5] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   comment: License management is enabled and will be used
[5] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   comment: Trying to free license used for the product
[5] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   Set  $result$ = FreeLicense($LicensePool$)
[2] [Jun 30 13:36:03:354] [dragon-naturally-speaking]   Syntax Error in Section: Sub_free_license (Command in line 63 origin: p:\dragon-naturally-speaking\uninstall.ins line: 64): $result$ = FreeLicense($LicensePool$) -> FreeLicense($LicensePool$) no valid expression for a string list
[6] [Jun 30 13:36:09:650] [dragon-naturally-speaking]   
[6] [Jun 30 13:36:09:650] [dragon-naturally-speaking]   ~~~~~~~ End Sub   ~~~~~~~  Sub_free_license
[6] [Jun 30 13:36:09:650] [dragon-naturally-speaking]   
[2] [Jun 30 13:36:09:650] [dragon-naturally-speaking]   Syntax Error in Section: Actions (Command in line 56 origin: p:\dragon-naturally-speaking\uninstall.ins line: 57): EndIf -> expected
[1] [Jun 30 13:36:10:355] [dragon-naturally-speaking] ___________________
[1] [Jun 30 13:36:10:355] [dragon-naturally-speaking] script finished
pandel
Beiträge: 830
Registriert: 25 Jan 2013, 16:47

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von pandel »

Code: Alles auswählen

DefVar $licensepool$
...
Set $result$ = FreeLicense($LicensePool$)
Du hast einmal $LicensePool$ und einmal $licensepool$ geschrieben. Vielleicht gibt's da ein Groß-/Kleinschreibungsproblem...
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von r.roeder »

Groß- und Kleinschreibung sollte egal sein, ich vermute, dass ein Belegungsproblem bei der Variable vorliegt, man müsste das Logfile komplett sehen.

Grüße
R. Röder


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


cgebauer
Beiträge: 31
Registriert: 15 Feb 2012, 09:53

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von cgebauer »

Das komplette Log passt von der Zeichenanzahl leider nicht rein.
Anlagen können nicht hinzugefügt werden oder?
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von r.roeder »

es genügt der Log ab Aufruf des uninstall.ins (oder wie das externe Skript, das mit dem sub-Befehl aufgerufen wird, heißt


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


cgebauer
Beiträge: 31
Registriert: 15 Feb 2012, 09:53

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von cgebauer »

Okay, hier ist das Log:

Code: Alles auswählen

[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking] ============ Version 4.11.4.17 script "p:\dragon-naturally-speaking\uninstall.ins"
[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking]              used script encoding: cp1252
[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking]              used system encoding: cp1252
[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking]              start: 2015-06-30  14:09:26 
[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking]              installing product: dragon-naturally-speaking_13.0-2
[1] [Jun 30 14:09:26:315] [dragon-naturally-speaking]              on client named    "win7opsi.grunecker.lokal"
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking]              loggedin user    "gebauer"
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking]              winst running as    "SYSTEM"
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking]              winst running with admin privileges
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking]              winst running in standard script mode
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking] executing: "C:\Program Files (x86)\opsi.org\opsi-client-agent\opsi-winst\winst32.exe"
[1] [Jun 30 14:09:26:316] [dragon-naturally-speaking] system infos:
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] 00-0C-29-C8-26-FC  -  PC hardware address
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] WIN7OPSI.grunecker.lokal  -  IP name 
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] 172.22.0.234  -  IP address
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] DEU  -  System default locale 
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] MS Windows 6.1 64 Bit
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] opsi service version : 4
[1] [Jun 30 14:09:26:329] [dragon-naturally-speaking] 
[6] [Jun 30 14:09:26:329] [dragon-naturally-speaking] Registry key [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion]  opened
[6] [Jun 30 14:09:26:329] [dragon-naturally-speaking] Key closed
[6] [Jun 30 14:09:26:440] [dragon-naturally-speaking] opsi-winst has version  4.11.4.17, required is : >= 4.10.8.6
[5] [Jun 30 14:09:26:441] [dragon-naturally-speaking] Set  $INST_SystemType$ = GetSystemType
[6] [Jun 30 14:09:26:443] [dragon-naturally-speaking]   The value of the variable "$INST_SystemType$" is now: "64 Bit System"
[5] [Jun 30 14:09:26:443] [dragon-naturally-speaking] Set  $LogDir$ = "C:\tmp"
[6] [Jun 30 14:09:26:443] [dragon-naturally-speaking]   The value of the variable "$LogDir$" is now: "C:\tmp"
[5] [Jun 30 14:09:26:443] [dragon-naturally-speaking] Set  $ProductId$ = "dragon-naturally-speaking"
[6] [Jun 30 14:09:26:443] [dragon-naturally-speaking]   The value of the variable "$ProductId$" is now: "dragon-naturally-speaking"
[5] [Jun 30 14:09:26:443] [dragon-naturally-speaking] Set  $LicensePool$ = "p_" + $ProductId$
[6] [Jun 30 14:09:26:443] [dragon-naturally-speaking]   The value of the variable "$LicensePool$" is now: "p_dragon-naturally-speaking"
[5] [Jun 30 14:09:26:444] [dragon-naturally-speaking] Set  $LicenseRequired$    = "true"
[6] [Jun 30 14:09:26:444] [dragon-naturally-speaking]   The value of the variable "$LicenseRequired$" is now: "true"
[5] [Jun 30 14:09:26:444] [dragon-naturally-speaking] comment: Show product picture
[5] [Jun 30 14:09:26:691] [dragon-naturally-speaking] message Deinstalliere dragon-naturally-speaking ...
[6] [Jun 30 14:09:26:691] [dragon-naturally-speaking] If
[6] [Jun 30 14:09:26:693] [dragon-naturally-speaking]     Starting query if file exist ...
[5] [Jun 30 14:09:26:705] [dragon-naturally-speaking]   FileExists("p:\dragon-naturally-speaking\delsub.ins")   <<< result true
[6] [Jun 30 14:09:26:705] [dragon-naturally-speaking] Then
[5] [Jun 30 14:09:26:705] [dragon-naturally-speaking]   comment: Start uninstall sub section
[6] [Jun 30 14:09:26:751] [dragon-naturally-speaking]   
[6] [Jun 30 14:09:26:752] [dragon-naturally-speaking]   ~~~~~~~ Start Sub ~~~~~~~  Sub "p:\dragon-naturally-speaking\delsub.ins"

[6] [Jun 30 14:11:31:967] [dragon-naturally-speaking]   ~~~~~~~ End Sub   ~~~~~~~  Sub "p:\dragon-naturally-speaking\delsub.ins"
[6] [Jun 30 14:11:31:967] [dragon-naturally-speaking]   
[6] [Jun 30 14:11:31:967] [dragon-naturally-speaking] EndIf
[6] [Jun 30 14:11:31:967] [dragon-naturally-speaking] If
[5] [Jun 30 14:11:31:967] [dragon-naturally-speaking]   $LicenseRequired$ = "true"   <<< result true
[6] [Jun 30 14:11:31:967] [dragon-naturally-speaking] Then
[5] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   comment: Licensing required, free license used
[6] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   
[6] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   ~~~~~~~ Start Sub ~~~~~~~  Sub_free_license
[5] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   comment: License management is enabled and will be used
[5] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   comment: Trying to free license used for the product
[5] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   Set  $result$ = FreeLicense($LicensePool$)
[2] [Jun 30 14:11:31:979] [dragon-naturally-speaking]   Syntax Error in Section: Sub_free_license (Command in line 63 origin: p:\dragon-naturally-speaking\uninstall.ins line: 64): $result$ = FreeLicense($LicensePool$) -> FreeLicense($LicensePool$) no valid expression for a string list
[6] [Jun 30 14:11:52:805] [dragon-naturally-speaking]   
[6] [Jun 30 14:11:52:805] [dragon-naturally-speaking]   ~~~~~~~ End Sub   ~~~~~~~  Sub_free_license
[6] [Jun 30 14:11:52:805] [dragon-naturally-speaking]   
[2] [Jun 30 14:11:52:805] [dragon-naturally-speaking]   Syntax Error in Section: Actions (Command in line 56 origin: p:\dragon-naturally-speaking\uninstall.ins line: 57): EndIf -> expected
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] ___________________
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] script finished
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] 2 errors
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] 4 warnings
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] 
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] installed product: dragon-naturally-speaking Version: 13.0-2
[1] [Jun 30 14:11:53:411] [dragon-naturally-speaking] 
[6] [Jun 30 14:11:53:412] [dragon-naturally-speaking] JSON service request https://172.21.0.8:4447/rpc productOnClient_updateObject
[6] [Jun 30 14:11:54:051] [dragon-naturally-speaking] JSON Bench for productOnClient_updateObject "params":[{"clientId":"win7opsi.grunecker.lokal"," Start: 14:11:53:412 Time: 00:00:00:639
[6] [Jun 30 14:11:54:156] Registry key [HKLM\SOFTWARE\opsi.org\winst]  opened
[6] [Jun 30 14:11:54:156]                 Variable "RebootRequested"  is keeping its value "0"
[6] [Jun 30 14:11:54:156]                 Variable "LastLogFilename"  is keeping its value "c:\opsi.org\log\opsi-script.log"
[6] [Jun 30 14:11:54:156]                 Variable "ContinueLogFile"  is keeping its value "0"
[6] [Jun 30 14:11:54:156]                 Variable "NumberOfErrors"  is keeping its value "0"
[6] [Jun 30 14:11:54:157]                 Key flushed
[6] [Jun 30 14:11:54:157]                 Key closed
[5] [Jun 30 14:11:54:167] -------- submitted part of log file ends here, see the rest of log file on client ----------
cgebauer
Beiträge: 31
Registriert: 15 Feb 2012, 09:53

Re: Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von cgebauer »

Vielen Dank für das Schubsen in die richtige Richtung. Ich habe gerade gesehen, dass in der delsub.ins auch eine Variable $result$ benutzt wird :shock:
Nachdem ich die geändert habe, läuft es jetzt.

Also nochmals vielen Dank.

VG
Carsten
Benutzeravatar
r.roeder
uib-Team
Beiträge: 540
Registriert: 02 Jul 2008, 10:08

Re: [Gelöst] Lizenzmanagement: Uninstall -> Freigabe Lizenz

Beitrag von r.roeder »

aus irgendeinem Grund kennt das Skript die Variable $LicensePool$ an der Stelle, wo sie aufgerufen wird, nicht (mehr).

Bau doch mal unmittelbar vor der Zeile Set $result$ = FreeLicense($LicensePool$) testhalber die Zeile

pause $LicensePool$

ein, da wird der Wert von $LicensePool$ direkt angezeigt.


Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.

Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.

uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de


Antworten