Paket opsi-wim-capture: Verbesserungsvorschlag Anpassung capture.opsiscript

Antworten
chris_10
Beiträge: 18
Registriert: 08 Dez 2022, 10:58

Paket opsi-wim-capture: Verbesserungsvorschlag Anpassung capture.opsiscript

Beitrag von chris_10 »

Guten Tag alle zusammen,

für das Paket opsi-wim-capture hätte ich einen Anpassungsvorschlag für das Script capture.opsiscript.

Aktuell ist das Script so auf gebaut das, wenn das Capturen in den WIM File durch eine Speerdatei blockiert ist, dies im Log erfaßt wird. Leider ist es dabei etwas unglücklich das das Log File durch den Reboot verloren geht.
Daher weis man in diesem Fall leider nicht genau warum das Capturen einer Installation nicht funktioniert hat bzw. schief gelaufen ist.
Ruft man an den entsprechenden Stellen die bereits vorhandene Subroutine sub_send_log auf wird der entsprechende Teil des Logs an den OPSI Server übertragen und im Config Editor in der Karteikarte "instlog" angezeigt.

Aktueller Codeblock:

Code: Alles auswählen

if $success$ = "true"
	Message "Check and Set Lock..."
	set $lockfile$ = 'p:\'+$captureproduct$+'\opsi-wim-capture.lock'
	if FileExists($lockfile$)
		if $force_clear_lock$ = "false"
			LogError "Target is locked via lockfile: "+$lockfile$
			set $success$ = "false"
		else
			LogWarning "Target is locked via lockfile: "+$lockfile$
			LogWarning "Override (lock file ignored) via force_clear_lock=true"
		endif
	else
		comment "Create lockfile ..."
		if not (saveTextFile(createStringList('locked'),$lockfile$))
			LogError "Couldn't write lockfile: "+$lockfile$
			;isFatalError
			set $success$ = "false"
		else
			set $locked$ = "true"
		endif
	endif
endif
Anpassungsvorschlag:

Code: Alles auswählen

if $success$ = "true"
	Message "Check and Set Lock..."
	set $lockfile$ = 'p:\'+$captureproduct$+'\opsi-wim-capture.lock'
	if FileExists($lockfile$)
		if $force_clear_lock$ = "false"
			LogError "Target is locked via lockfile: "+$lockfile$
			set $success$ = "false"
			sub_send_log
		else
			LogWarning "Target is locked via lockfile: "+$lockfile$
			LogWarning "Override (lock file ignored) via force_clear_lock=true"
		endif
	else
		comment "Create lockfile ..."
		if not (saveTextFile(createStringList('locked'),$lockfile$))
			LogError "Couldn't write lockfile: "+$lockfile$
			;isFatalError
			set $success$ = "false"
                        sub_send_log
		else
			set $locked$ = "true"
		endif
	endif
endif
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Paket opsi-wim-capture: Verbesserungsvorschlag Anpassung capture.opsiscript

Beitrag von d.oertel »

Hallo chris_10,

danke für den Hinweis!

Ich bin zwar die nächsten Tage unterwegs aber ende der nächsten Woche schaue ich mir das näher an
und baue es gegebenenfalls ein.
Ich gebe dann nochmal Rückmeldung.

gruß
d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
Antworten