Brian Bouterse wrote:
While I'm working on the esxthin.pm provisioning module, I will be using a config file placed in the same directory as esxthin.pm. For example, in my installation this would be /opt/vcl/lib/VCL/Module/Provisioning/esxthin.conf

1) I tried to open a file but it only works if I give it the entire path. Is there an easy way inside a VCL perl provisioning module to know the path of itself?


The only way I know is to use FindBin. The path that $FindBin::Bin returns within your module can vary depending on the command that was executed to load the module. Under normal circumstances, vcld automatically loads your module and $FindBin::Bin returns vcld's directory. If you call 'perl /opt/.../esxthin.pm', $FindBin::Bin returns esxthin.pm's directory.

2) Is there an easier way to configure a username, password, and IP for esxthin.pm to use besides using the variable table?

How about storing esxthin.conf in /etc/vcl by default? You could also add code to your module to support a command line argument so that the default esxthin.pm path can be overridden. This is how the code to locate vcld.conf is written. See utils.pm near line 305.

-Andy


Thanks!
Brian


Brian Bouterse
NEXT Services
919.698.8796

Reply via email to