Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Ralsh not picking up providers automatically #34

Open
garethr opened this issue Jun 23, 2017 · 1 comment
Open

Ralsh not picking up providers automatically #34

garethr opened this issue Jun 23, 2017 · 1 comment

Comments

@garethr
Copy link
Contributor

garethr commented Jun 23, 2017

According to the readme providers should be discovered either via the ENV, a flag or from a known directory. From some basic testing this doesn't appear to be the case?

(Note this testing was done in a Docker container running ubuntu:latest)

I have the example providers available:

$ ls /usr/share/libral/data/providers/
metadata.yaml  mruby.prov  python.prov  simple.prov

If we try and load them using the ENV they are not picked up.

$ RALSH_DATA_DIR=/usr/share/libral/data/ ralsh
2017-06-23 08:10:30.505205 WARN  ral - provider[/opt/ral/data/providers/yum.prov]: ignored as it exited with status 2
2017-06-23 08:10:31.447939 WARN  ral - provider[/opt/ral/data/providers/dnf.prov]: ignored as it exited with status 2
file::posix
group::groupadd
host::aug
mount::aug
package::apt
service::systemd
ssh_authorized_key::ssh_authorized_key
user::useradd

If we assume they should be picked up because they are in the default directory from the README they are also not picked up.

$ ralsh
2017-06-23 08:10:38.349373 WARN  ral - provider[/opt/ral/data/providers/yum.prov]: ignored as it exited with status 2
2017-06-23 08:10:39.266445 WARN  ral - provider[/opt/ral/data/providers/dnf.prov]: ignored as it exited with status 2
file::posix
group::groupadd
host::aug
mount::aug
package::apt
service::systemd
ssh_authorized_key::ssh_authorized_key
user::useradd

But if we use --include they are picked up. Note the python provider warning and the mruby provider being loaded.

$ ralsh --include=/usr/share/libral/data/
2017-06-23 08:11:05.734880 WARN  ral - provider[/usr/share/libral/data//providers/python.prov]: ignored as it exited with status 2
2017-06-23 08:11:08.123525 WARN  ral - provider[/opt/ral/data/providers/yum.prov]: ignored as it exited with status 2
2017-06-23 08:11:09.120289 WARN  ral - provider[/opt/ral/data/providers/dnf.prov]: ignored as it exited with status 2
example::mruby
file::posix
group::groupadd
host::aug
mount::aug
package::apt
service::systemd
ssh_authorized_key::ssh_authorized_key
user::useradd

Based on the README I would have expected the same output for all of these commands.

garethr added a commit to garethr/libral that referenced this issue Jun 23, 2017
I put this together for my own purposes but sharing here as it's likely
useful for others. A couple of related thoughts:

* I'll update the docs with instructions for mounting providers for
  testing once puppetlabs-toy-chest#34 is
  resolved.
* I could have used the new multi-state builds to avoid some of the
  apt wranging, but left this way for now until multi-stage builds works
  it's way into a stable Docker release
* This only supports building from the precompiled binary. I'll take a
  run at converting the HACKING instructions at some point so you can
  build using Docker, that should be a separate PR

I also haven't pushed an image to Docker Hub. I would be happy to do
that if useful or hold off for now.
@lutter
Copy link
Contributor

lutter commented Jun 23, 2017

There's a few things going on here:

  • the docs (or the static build) are wrong in that the default data dir built into the static binary ralsh.bin defaults to /opt/puppetlabs/puppet/share/libral/data (the default is really ${CMAKE_INSTALL_PREFIX}/share/libral/data
  • that doesn't really matter, as ralsh is a shell script that sets RALSH_DATA_DIR to the data directory from the tarball. That also explains why it was not possible to override that with your own environment variable (since the script just clobbers it)
  • the --include works since that is additive to whatever is set through the environment variable

I'll have to think about how to make the shell script wrapper behave more like what the docs say; e.g., by transforming an existing RALSH_DATA_DIR env variable into --include options that get passed to the binary. The default data dir for the static built is somewhat meaningless, as the assumption is that there wouldn't be anything there anyway.

lutter pushed a commit that referenced this issue Jun 26, 2017
I put this together for my own purposes but sharing here as it's likely
useful for others. A couple of related thoughts:

* I'll update the docs with instructions for mounting providers for
  testing once #34 is
  resolved.
* I could have used the new multi-state builds to avoid some of the
  apt wranging, but left this way for now until multi-stage builds works
  it's way into a stable Docker release
* This only supports building from the precompiled binary. I'll take a
  run at converting the HACKING instructions at some point so you can
  build using Docker, that should be a separate PR

I also haven't pushed an image to Docker Hub. I would be happy to do
that if useful or hold off for now.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants