Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

INIT_SCRIPTS not run when using VMWare Tools #52

Closed
jeremyoverman opened this issue Nov 14, 2018 · 4 comments
Closed

INIT_SCRIPTS not run when using VMWare Tools #52

jeremyoverman opened this issue Nov 14, 2018 · 4 comments

Comments

@jeremyoverman
Copy link

If we end up using the VMWare tools to pull the context information instead of the CONTEXT ISO, the $contextLetter variable never gets set. I'd expect this to get set up $env:SystemDrive\. Without this being set, scripts declared in the runScripts function don't run because the this doesn't set the path correctly:

runScripts $context $contextLetter

$script = $contextLetter + $script

jeremyoverman pushed a commit to jeremyoverman/addon-context-windows that referenced this issue Nov 19, 2018
@vholer vholer added this to the v5.8.0 milestone Dec 4, 2018
@vholer vholer modified the milestones: v5.8.0, v5.10.0 Feb 25, 2019
@vholer vholer assigned vholer and unassigned al3xhh Jun 12, 2019
@vholer vholer modified the milestones: v5.10.0, v5.12.0 Sep 5, 2019
ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 2, 2021
If any script inside the INIT_SCRIPTS variable is not an absolute path
then its path will be prefixed either by the disk drive letter of the
CD-ROM containing the 'context.sh' or simply by the system drive letter.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
@ospalax
Copy link

ospalax commented Mar 2, 2021

Hi, you are correct that $contextLetter variable is empty in the case of VMWare and no CD-ROM but that does not need to be an issue if each script inside the INIT_SCRIPTS variable is an absolute path - e.g.: C:\custom-init.d\rc1.ps1

Correct me if I am wrong or I misunderstood something.

Either way I am tackling this issue in another PR: #89

It will check if the script is absolute path and if it is then it will use this path unmodified but if the script path is relative then it will be prefixed as you suggested here.

Hopefully by doing it like this I don't break anyone's code - who used absolute paths to workaround this issue should be unaffected and the others now can enjoy your solution.

If my change does not solve your issue feel free to reopen this and update your PR to resolve the merging conflicts.

Thanks

@ospalax ospalax closed this as completed Mar 2, 2021
vholer pushed a commit that referenced this issue Mar 2, 2021
* F #87: Add support for recontextualization

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Refactor wait loop

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Fix contextPaths object

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Refactor log messages

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Fix subshell issue with termination

- Reexecuting the powershell with 64bit version will break service stop
  and fail to terminate both powershell sessions (32bit and 64bit). It
  will also create orphaned process tree which will continue to hold
  file descriptors.
- Disable subshell for the whole script and instead use new pswrapper
  function only where it is truly needed and where the subprocess is
  expected to terminate on its own.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Add support for nssm

- The problem with orphans was caused by rhsrvany itself which does not
  handle stop service correctly. The solution was better service
  manager: http://nssm.cc/
- If nssm directory is present then nssm will be used otherwise the wixl
  will fallback to rhsrvany again.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Move context.ps1 to src dir

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Add nssm.exe binaries and remove src

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Add SRV_MANAGER parameter

Do not check the existence of the nssm.exe vs rhsrvany.exe but enforce
the service manager by env. variable SRV_MANAGER - defaults to 'nssm'.

Usage:
    % env SRV_MANAGER=rhsrvany VERSION=5.13 ./generate-all.sh
    % env SRV_MANAGER=nssm VERSION=5.13 ./generate-all.sh

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Update comments

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Update README

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Update example prompt in README

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* M #-: Add support for PASSWORD_BASE64

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* M #-: Fix newlines in older powershells (e.g.: 4)

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #87: Improve contextualization

Create a copy instead of working directly on the context.sh. This way
even when context changes during the contextualization - we will have
the proper checksum of the actually applied file and we can still act
subsequently on the waiting changed and unapplied context.sh.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* M #-: Remove Start-Script copy after the use

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* B #52: Fix INIT_SCRIPTS in VMWare

If any script inside the INIT_SCRIPTS variable is not an absolute path
then its path will be prefixed either by the disk drive letter of the
CD-ROM containing the 'context.sh' or simply by the system drive letter.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
@vholer
Copy link
Contributor

vholer commented Mar 2, 2021

I'm partially reopening this issue as I see 2 problems:

  • INIT_SCRIPTS are not implemented for the VMware, it should pass custom script from OpenNebula (files datastore) to the VM and this doesn't work yet now.

  • @jeremyoverman, even with @ospalax 's fix, looks to me like you are misusing the INIT_SCRIPTS parametr for a different behaviour. If you need to run the custom script, which is already inside the VM image, you should use START_SCRIPT.

@vholer vholer reopened this Mar 2, 2021
@vholer vholer modified the milestones: v5.12.0, v5.14.0 Mar 2, 2021
@jeremyoverman
Copy link
Author

Thanks for taking a look at this. I'm not in a position where I can test out changes with OpenNebula anymore, but based on @vholer's description it sounds like START_SCRIPT is what I was actually looking for here.

ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 30, 2021
Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 30, 2021
Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 30, 2021
Move 'ContextLetter' destination from the System Drive (most often
'C:\') to 'C:\.onecontext\' where 'context.sh' is already stored.

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
@vholer vholer modified the milestones: v6.0.0, v6.2.0 Mar 31, 2021
ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 31, 2021
Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
ospalax pushed a commit to ospalax/addon-context-windows that referenced this issue Mar 31, 2021
Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
vholer pushed a commit that referenced this issue Apr 1, 2021
* F #52: Add support for INIT_SCRIPTS

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #52: Sanitize init script filenames

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>

* F #52: Refactor cleanup

Signed-off-by: Petr Ospalý <pospaly@opennebula.io>
@vholer
Copy link
Contributor

vholer commented Apr 16, 2021

Implemented as part of #91

@vholer vholer closed this as completed Apr 16, 2021
carloshm91 added a commit to carloshm91/addon-context-windows that referenced this issue Aug 3, 2021
carloshm91 added a commit to carloshm91/addon-context-windows that referenced this issue Aug 3, 2021
Signed-off-by: Carlos Herrera <cherrera@opennebula.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants