libral
libral copied to clipboard
Ralsh not picking up providers automatically
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.
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 setsRALSH_DATA_DIR
to thedata
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.