-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathputJTL.pl
More file actions
executable file
·106 lines (70 loc) · 2.53 KB
/
putJTL.pl
File metadata and controls
executable file
·106 lines (70 loc) · 2.53 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env perl
# This is based on work that is in the public domain
# and modified by Marc Boudreau
use strict;
use warnings;
require JobTemplateLibraryService;
package main;
use Getopt::Long ();
use File::Basename;
use Pod::Usage;
my $jtlName;
my $jtlFilename;
my $mgr;
my $passwd;
my $user;
my $help;
pod2usage(-verbose => 2, -noperldoc => 1) if (
@ARGV < 4 or
! Getopt::Long::GetOptions(
"j|jtl:s" => \$jtlName, # The Job Template Library name
"f|file=s" => \$jtlFilename, # The file to read the JTL from
"m|mgr=s" => \$mgr, # The Signiant manager name
"p|pwd=s" => \$passwd, # The password for the user
"u|usr=s" => \$user, # The username to connect to the manager
"h|help|?" => \$help ) or
(!defined $mgr) or
(!defined $jtlFilename) or
(!defined $user) or
(!defined $passwd) or
defined $help);
die "ERROR: [$jtlFilename] Does not exist" if (!-e $jtlFilename);
my ( $tmpName, $jtlPath, $jtlSuf ) = fileparse($jtlFilename,".xml");
$jtlName = $tmpName if (!defined $jtlName);
open( JTLFILE, "<$jtlFilename" ) or die "ERROR: unable to open [$jtlFilename.xml]";
my $jtlFileContent = do { local $/; <JTLFILE> };
close JTLFILE;
my $soap = new SigniantJobTemplateLibraryService();
$soap->setup( "http://$mgr/signiant/", $user, $passwd ) or die "ERROR: Unable to create SOAP connection";
my $err = $soap->importJobTemplateLibrary($jtlName,$jtlFileContent);
__END__
=head1 NAME
putJTL.pl - Run a Signiant perl file
=head1 SYNOPSIS
putJTL.pl [options]
Options:
-j -jtl Job Template Library name (optional)
-f -file Job Template Library XML file
-m -mgr Signiant manager hostname
-u -usr Signiant username
-p -pwd Signiant password
-help brief help message
=head1 OPTIONS
=over 8
=item B<-jtl>
The name of the Job Template Library to store the XML as. If this is not provided, the name will be determined from the filename provided.
=item B<-file>
XML file containing the Job Template Library.
=item B<-mgr>
The hostname of the Signiant manager to publish the JTL to.
=item B<-usr>
The Signiant username to connect to the specified manager.
=item B<-pwd>
The Signiant password for the specified user.
=item B<-help>
Prints this page and exits.
=back
=head1 DESCRIPTION
B<This program> will connect to a Signiant manager and upload the specified XML file as a Job Template Library.
NOTE: This connection can be slow.
=cut