-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installed perl modules are not accessible in script #154
Comments
Hi @frenzymind
in the s2i |
@pkubatrh thank you man! I just found the same solution. But I look at httpd.conf and there is string: and here I understand thing I have to do. |
Why assemble does not define PERL5LIB:
Assemble script is executed only when building an application image.
Environment variables exported in the assemble script do not survive to run
time. Therefore the PERL5LIB variable is set in the run script.
Assemble script does not use PERL5LIB variable not to infect cpanm installer with
user-installed modules. cpanm tool obtains the path using "-l" option.
That means we do not need PERL5LIB in the assemble script.
Why "docker exec" does not have PERL5LIB:
"docker exec" executes a program into a pristine environemnt. Thus PERL5LIB
does not exist there.
If we defined PERL5LIB in /opt/app-root/etc/scl_enable that's executed by bash
when execing into a container, we would taint the environment and Perl
configuration in centos/perl-526-centos7 base image with references specific
and valid only for s2i application images. But we have to support also non-s2i
use cases with centos/perl-526-centos7. If we did so we would divert perl's
behevior from pristine SCL perl.
Clean solution would be not to use PERL5LIB at all and install modules into
SCL perl's site directory, but there is contadicting requirment from OpenShift
that all user's content must be installed under /opt/app-root. Thus we have to
use PERL5LIB enviroment variable to explain Perl where to look the
user-installed modules.
I'm sorry but I cannot see any solution that would not break some of the use
cases. But now when I thinking about it more, I have an idea:
Maybe we could modify /opt/app-root/etc/scl_enable to define PERL5LIB at the
end of the assemble script. Assemble script is executed only in s2i use case
when bulding an application image. Thus it would not affect non-s2t use cases.
|
lakras
added a commit
to broadinstitute/polyphonia
that referenced
this issue
Jun 21, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have script begins with:
`#!/usr/bin/perl
use strict;
use warnings;
use Math::Round;
use utf8;
use XML::LibXML::Reader;
`
cpanfile file:
requires 'Math::Round', '== 0.06'; requires 'XML::LibXML::Reader', '== 2.0132';
Both located in tests2i folder, inside this folder I run command:
s2i build . centos/perl-526-centos7 test-cos
Build log here:
---> Installing application source ... ---> Installing modules from cpanfile ... --> Working on Module::CoreList Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Module-CoreList-5.20181020.tar.gz ... OK Configuring Module-CoreList-5.20181020 ... OK Building Module-CoreList-5.20181020 ... OK Successfully installed Module-CoreList-5.20181020 (upgraded from 5.20171120) 1 distribution installed --> Working on . Configuring /opt/app-root/src ... OK ==> Found dependencies: XML::LibXML::Reader, Math::Round --> Working on XML::LibXML::Reader Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0132.tar.gz ... OK Configuring XML-LibXML-2.0132 ... OK ==> Found dependencies: XML::SAX, XML::SAX::Exception, XML::SAX::Base, XML::NamespaceSupport --> Working on XML::SAX Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-SAX-1.00.tar.gz ... OK Configuring XML-SAX-1.00 ... OK ==> Found dependencies: XML::NamespaceSupport, XML::SAX::Base --> Working on XML::NamespaceSupport Fetching http://www.cpan.org/authors/id/P/PE/PERIGRIN/XML-NamespaceSupport-1.12.tar.gz ... OK Configuring XML-NamespaceSupport-1.12 ... OK Building XML-NamespaceSupport-1.12 ... OK Successfully installed XML-NamespaceSupport-1.12 --> Working on XML::SAX::Base Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-SAX-Base-1.09.tar.gz ... OK Configuring XML-SAX-Base-1.09 ... OK Building XML-SAX-Base-1.09 ... OK Successfully installed XML-SAX-Base-1.09 Building XML-SAX-1.00 ... OK Successfully installed XML-SAX-1.00 Building XML-LibXML-2.0132 ... OK Successfully installed XML-LibXML-2.0132 --> Working on Math::Round Fetching http://backpan.perl.org/authors/id/G/GR/GROMMEL/Math-Round-0.06.tar.gz ... OK Configuring Math-Round-0.06 ... OK Building Math-Round-0.06 ... OK Successfully installed Math-Round-0.06 <== Installed dependencies for .. Finishing. 5 distributions installed Build completed successfully
It seems ok, dependencies found and installed. I run container:
docker run -d -p 8080:8080 test-cos
and exec bash. Inside I try:
perl zapret.pl
thats give error:
Can't locate Math/Round.pm in @INC (you may need to install the Math::Round module) (@INC contains: /opt/rh/rh-perl526/root/usr/local/lib64/perl5 /opt/rh/rh-perl526/root/usr/local/share/perl5 /opt/rh/rh-perl526/root/usr/lib64/perl5/vendor_perl /opt/rh/rh-perl526/root/usr/share/perl5/vendor_perl /opt/rh/rh-perl526/root/usr/lib64/perl5 /opt/rh/rh-perl526/root/usr/share/perl5) at zapret.pl line 6. BEGIN failed--compilation aborted at zapret.pl line 6.
What do I do wrong ?
The text was updated successfully, but these errors were encountered: