Subversion Repositories camp_sysinfo_client_3

Rev

Rev 227 | Rev 248 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 227 Rev 228
Line 42... Line 42...
42
our @ISA = qw( Exporter );
42
our @ISA = qw( Exporter );
43
our @EXPORT = qw( $clientName $serialNumber $hostname 
43
our @EXPORT = qw( $clientName $serialNumber $hostname 
44
                  $transports $sysinfo3 $binDir $moduleDir
44
                  $transports $sysinfo3 $binDir $moduleDir
45
                  $scriptDir $confDir $binName $confName $configurationFile
45
                  $scriptDir $confDir $binName $confName $configurationFile
46
                  @confFileSearchPath  @moduleDirs @scriptDirs
46
                  @confFileSearchPath  @moduleDirs @scriptDirs
47
                  %sendTypes
47
                  %sendTypes %displayOrder
48
                  &showConf &transportsToConfig &getAnswer &yesno  
48
                  &showConf &transportsToConfig &getAnswer &yesno  
49
                  &writeConfig &processParameters $TESTING
49
                  &writeConfig &processParameters $TESTING
50
                  &setDryRun &enableModules &makeConfig &findConf &timeStamp
50
                  &setDryRun &enableModules &makeConfig &findConf &timeStamp
51
                  &loadConfigurationFile &logIt &findFile
51
                  &loadConfigurationFile &logIt &findFile
52
                );
52
                );
Line 69... Line 69...
69
 
69
 
70
# paths to search for configuration file
70
# paths to search for configuration file
71
my @confFileSearchPath = ( '.', '/etc/camp/sysinfo-client', '/etc/camp', '/usr/local/etc/camp/sysinfo-client' );
71
my @confFileSearchPath = ( '.', '/etc/camp/sysinfo-client', '/etc/camp', '/usr/local/etc/camp/sysinfo-client' );
72
my $serverInfoFileName = '/etc/server.info';
72
my $serverInfoFileName = '/etc/server.info';
73
 
73
 
-
 
74
our %displayOrder = (
-
 
75
      '1' => {
-
 
76
         'fieldname' => 'clientName',
-
 
77
         'display' => 'Client Name',
-
 
78
         'type' => 'scalar',
-
 
79
         },
-
 
80
      '2' => {
-
 
81
         'fieldname' => 'hostname',
-
 
82
         'display' => 'Hostname',
-
 
83
         'type' => 'scalar',
-
 
84
         },
-
 
85
      '3' => {
-
 
86
         'fieldname' => 'UUID',
-
 
87
         'display' => 'UUID',
-
 
88
         'type' => 'scalar',
-
 
89
         },
-
 
90
      '4' => {
-
 
91
         'fieldname' => 'serialNumber',
-
 
92
         'display' => 'Serial Number',
-
 
93
         'type' => 'scalar',
-
 
94
         },
-
 
95
      '5' => {
-
 
96
         'fieldname' => 'location',
-
 
97
         'display' => 'Location',
-
 
98
         'type' => 'scalar',
-
 
99
         },
-
 
100
      '6' => {
-
 
101
         'fieldname' => 'os_type',
-
 
102
         'display' => 'OS Type',
-
 
103
         'type' => 'scalar',
-
 
104
         },
-
 
105
      '7' => {
-
 
106
         'fieldname' => 'tags',
-
 
107
         'display' => 'Tags',
-
 
108
         'type' => 'array',
-
 
109
         },
-
 
110
      '8' => {
-
 
111
         'fieldname' => 'moduleDirs',
-
 
112
         'display' => 'Module Directories',
-
 
113
         'type' => 'array',
-
 
114
         },
-
 
115
      '9' => {
-
 
116
         'fieldname' => 'scriptDirs',
-
 
117
         'display' => 'Script Directories',
-
 
118
         'type' => 'array',
-
 
119
         },
-
 
120
      'a' => {
-
 
121
         'fieldname' => 'transports',
-
 
122
         'display' => 'Transports',
-
 
123
         'type' => 'function',
-
 
124
         'function' => 'editTransports'
-
 
125
         },
-
 
126
   );
-
 
127
   
-
 
128
 
74
my $configurationFile = 'sysinfo-client.yaml'; # name of the configuration file
129
my $configurationFile = 'sysinfo-client.yaml'; # name of the configuration file
75
 
130
 
76
 
131
 
77
my @installDirs = ( '/opt/camp/sysinfo-client', '/usr/local/opt/camp/sysinfo-client' );
132
my @installDirs = ( '/opt/camp/sysinfo-client', '/usr/local/opt/camp/sysinfo-client' );
78
my @confDirs =    ( '/etc/camp/sysinfo-client', '/usr/local/etc/camp/sysinfo-client' );
133
my @confDirs =    ( '/etc/camp/sysinfo-client', '/usr/local/etc/camp/sysinfo-client' );
Line 249... Line 304...
249
   }
304
   }
250
   unless ( $config->{'os_type'} ) {
305
   unless ( $config->{'os_type'} ) {
251
      $config->{'os_type'} = `installer/determineOS` if -x 'installer/determineOS';
306
      $config->{'os_type'} = `installer/determineOS` if -x 'installer/determineOS';
252
   }
307
   }
253
   
308
   
-
 
309
   unless ( $config->{'moduleDirs'} ) {
-
 
310
      $config->{'moduleDirs'} = [];
-
 
311
      push @{ $config->{'moduleDirs'} }, $binDir . '/modules';
-
 
312
      push @{ $config->{'moduleDirs'} }, $confDir . '/modules';
-
 
313
   }
-
 
314
 
-
 
315
   unless ( $config->{'scriptDirs'} ) {
-
 
316
      $config->{'scriptDirs'} = [];
-
 
317
      push @{ $config->{'scriptDirs'} }, $binDir . '/scripts';
-
 
318
      push @{ $config->{'scriptDirs'} }, $confDir . '/scripts';
-
 
319
   }
-
 
320
   
-
 
321
   unless ( $config->{'transports'} ) {
-
 
322
      $config->{'transports'}->{'30'} = {
-
 
323
         'name' => 'SaveLocal',
-
 
324
         'output directory' => '/tmp',
-
 
325
         'sendScript' => 'save_local'
-
 
326
      }
-
 
327
   }
-
 
328
   
254
   return $config;
329
   return $config;
255
}
330
}
256
 
331
 
257
# prompt the user for a response, then allow them to enter it
332
# prompt the user for a response, then allow them to enter it
258
# the first response is considered the default and is printed
333
# the first response is considered the default and is printed