File: script_gen.pl

package info (click to toggle)
ceph 10.2.11-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,660 kB
  • sloc: cpp: 851,974; ansic: 54,245; python: 45,589; sh: 30,008; java: 20,516; asm: 10,148; perl: 8,435; makefile: 5,956; php: 909
file content (59 lines) | stat: -rwxr-xr-x 1,194 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl

=head1 NAME

script_gen.pl - create a perl wrapper for the teuthology scripts  

=head1 SYNOPSIS

Use:
	perl script_gen.pl --script_name <script_name> [--help] 

Examples:
	perl script_gen.pl --script_name abc.pl or 
	perl script_gen.pl --help

=head1 DESCRIPTION

This script creates a perl wrapper in the name of script_name passed to it.
The task yaml file name and log file name
within the wrapper are modified accordingly.   

=head1 ARGUMENTS

script_gen.pl takes the following arguments:

	--help
	(optional.) Displays the usage message.

	--script_name script_name 
	(Required.) script name same as the name of the teuthology task for
	which perl wrapper is needed.

=cut

use strict;
use warnings;
use Template;

use Pod::Usage();
use Getopt::Long();

my ($help, $script_name);

Getopt::Long::GetOptions(
	'help' => \$help, 
	'script_name=s' => \$script_name);

	Pod::Usage::pod2usage( -verbose=>1 ) if ($help);

unless (defined($script_name)){
	Pod::Usage::pod2usage( -exitstatus =>2 );
}
my $sample_script = "sample.pl";
my $template =  Template->new;
my $variables = {
        script => $script_name,
};
$template->process($sample_script,$variables,$script_name);