-
Notifications
You must be signed in to change notification settings - Fork 223
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
lib/Rex/CLI.pm: display a warning when/if Rex::Template is loaded. #1512
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,6 @@ use Rex::TaskList; | |
use Rex::Logger; | ||
use YAML; | ||
|
||
use Data::Dumper; | ||
|
||
my $no_color = 0; | ||
eval "use Term::ANSIColor"; | ||
if ($@) { $no_color = 1; } | ||
|
@@ -197,6 +195,7 @@ FORCE_SERVER: { | |
|
||
load_server_ini_file($::rexfile); | ||
load_rexfile($::rexfile); | ||
check_template_modules(); | ||
|
||
#### check if some parameters should be overwritten from the command line | ||
CHECK_OVERWRITE: { | ||
|
@@ -455,6 +454,30 @@ sub __help__ { | |
|
||
} | ||
|
||
# Check whether Rex/Template.pm | ||
# or Rex/Template/NG.pm modules are loaded. If there are, | ||
# they should be present in the %INC hash. | ||
sub check_template_modules { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have |
||
my @tpl_modules_loaded = | ||
grep { /(Rex\/Template|Rex\/Template\/NG)/ } keys %INC; | ||
if ( scalar @tpl_modules_loaded > 0 ) { | ||
Rex::Logger::info( | ||
"WARNING! You are using Rex built-in template engine aka Rex::Template.", | ||
"warn" | ||
); | ||
Rex::Logger::info( | ||
"This engine is obsolete, unmaintained and will be retired in future releases.", | ||
"warn" | ||
); | ||
monsieurp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Rex::Logger::info( | ||
"Please consider migrating to a more modern template engine.", "warn" ); | ||
Rex::Logger::info( | ||
"Text::Template::Simple, Template::Toolkit, etc. As usual, CPAN is you friend.", | ||
"warn" | ||
); | ||
Comment on lines
+472
to
+477
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about pointing to Rex::Template::TT as a readily available and recommended external module, and point to the docs about how to set one's own custom templating functions:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can do that indeed. |
||
} | ||
} | ||
|
||
sub add_help { | ||
my ( $self, $code ) = @_; | ||
push( @help, $code ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why Data::Dumper is also removed in this context about Rex::Template::* deprecation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module is unused in
CLI.pm
.