st2 icon indicating copy to clipboard operation
st2 copied to clipboard

Unable to install pack from local directory

Open aaronkyriesenbach opened this issue 3 years ago • 5 comments

SUMMARY

Upon trying to install a known working pack from a local directory within the StackStorm Docker client container, the installation fails with ValueError: Local pack directory "/opt/stackstorm/test_pack" doesn't exist.

STACKSTORM VERSION

st2 3.6.0, on Python 3.6.9

OS, environment, install method

Docker container, using the official Docker Compose config. Host environment is Arch Linux running 5.17.5. All commands are executed from within the st2client container.

Steps to reproduce the problem

  1. Obtain copy of working pack on local computer. The linked pack installs fine when installing directly from GitHub.
  2. Copy local pack to st2client container: docker compose cp ~/repos/test_pack st2client:/opt/stackstorm/ (on host machine, from st2-docker directory)
  3. Attempt to install pack: st2 pack install file:///opt/stackstorm/test_pack (from within st2client container)

Expected Results

The pack installs successfully, as it does when installing from GitHub.

Actual Results

Install fails with ValueError: Local pack directory "/opt/stackstorm/test_pack" doesn't exist. As a sanity check, the directory does exist:

root@667335d8ca8c:/opt/stackstorm# ls /opt/stackstorm
configs  exports  packs  packs.dev  rbac  st2  test_pack  virtualenvs

Thank you for any assistance!

aaronkyriesenbach avatar May 03 '22 01:05 aaronkyriesenbach

You need to copy the pack content to the st2actionrunner container - that's where the actions run on. In addition to that, you also need to run st2-register-content in that container to register resources from that pack.

Or even better, copy it into the stackstorm-packs volume which is mounted and available in all the containers where that is necessary - https://github.com/StackStorm/st2-docker/blob/master/docker-compose.yml#L265.

Kami avatar May 04 '22 00:05 Kami

@aaronkyriesenbach Just to confirm, per your message, does the pack install from github work? It's just the st2 pack install file:// that has issues.

arm4b avatar May 04 '22 10:05 arm4b

@armab That’s correct.

Thanks @Kami - makes sense. When installing a pack from the packs volume, how are paths handled? I’ve copied the pack to /opt/stackstorm/packs, which is where the volume is mounted on st2client, but have the same issue when installing from file:///opt/stackstorm/packs/test_pack. Looked through the Docker Compose config but didn’t see anything that seemed relevant here other than that the packs volume is mounted at the same place within st2actionrunner.

aaronkyriesenbach avatar May 04 '22 10:05 aaronkyriesenbach

Do you have a .git dir in the pack? If no, run git init inside the pack and try to re-install the pack again with file:///.

arm4b avatar May 04 '22 11:05 arm4b

There is a .git directory within the pack.

aaronkyriesenbach avatar May 04 '22 13:05 aaronkyriesenbach