Subversion Repositories camp_sysinfo_client_3

Rev

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

Rev 86 Rev 92
Line 15... Line 15...
15
 
15
 
16
our $VERSION = '1.4.0';
16
our $VERSION = '1.4.0';
17
use warnings;
17
use warnings;
18
use strict;  
18
use strict;  
19
 
19
 
20
use Data::Dumper;
20
#use Data::Dumper;
-
 
21
use YAML::Tiny;
21
use File::Basename;
22
use File::Basename;
22
 
23
 
23
use Exporter;
24
use Exporter;
24
 
25
 
25
our @ISA = qw( Exporter );
26
our @ISA = qw( Exporter );
Line 116... Line 117...
116
      } # foreach
117
      } # foreach
117
   } # if
118
   } # if
118
} # enableModules
119
} # enableModules
119
 
120
 
120
sub showConf {
121
sub showConf {
121
   use Data::Dumper;
-
 
122
   
122
   
123
   my $configuration = shift;
123
   my $configuration = shift;
124
   local $Data::Dumper::Purity = 1;
-
 
125
   $Data::Dumper::Indent = 3;
-
 
126
   $Data::Dumper::Varname = 'configuration';
124
   $configuration = Dump($configuration);
127
   $Data::Dumper::Quotekeys = 1;
-
 
128
   $Data::Dumper::Sortkeys = 1;
-
 
129
   $Data::Dumper::Terse = 1;
-
 
130
   $configuration = '%configuration = ' . Data::Dumper->Dump( [$configuration] );
-
 
131
   return $configuration;
125
   return $configuration;
132
 
126
 
133
   #return $conf;
127
   #return $conf;
134
   #my $conf;
128
   #my $conf;
135
   #$conf .= "\$clientName = '" .   ( defined( $$configuration{'clientName'}   ) ? $$configuration{'clientName'}   : '' ) . "';\n";
129
   #$conf .= "\$clientName = '" .   ( defined( $$configuration{'clientName'}   ) ? $$configuration{'clientName'}   : '' ) . "';\n";
Line 166... Line 160...
166
   my @scriptDirs;
160
   my @scriptDirs;
167
   my $UUID = '';
161
   my $UUID = '';
168
   my $transports;
162
   my $transports;
169
 
163
 
170
   foreach my $config ( @configFileNames ) {
164
   foreach my $config ( @configFileNames ) {
-
 
165
      $contents = YAML::Tiny->read( $config );
-
 
166
      %config = Load( $contents );
-
 
167
      Dumper( \%config ); die;
171
      open CONF,"<$config" or die "could not open $config: $!\n";
168
      #open CONF,"<$config" or die "could not open $config: $!\n";
172
      my $contents = join( '', <CONF> );
169
      #my $contents = join( '', <CONF> );
173
      close CONF;
170
      #close CONF;
174
      # now, eval the information we just read.
171
      # now, eval the information we just read.
175
      # NOTE: we must turn off strict while doing this, and we die if something breaks.
172
      # NOTE: we must turn off strict while doing this, and we die if something breaks.
176
      no strict "vars"; eval( $contents ); use strict "vars"; die "Error during eval: $@\n" if $@;
173
      #no strict "vars"; eval( $contents ); use strict "vars"; die "Error during eval: $@\n" if $@;
177
      # if this is a v2 config, we will update it
174
      # if this is a v2 config, we will update it
178
      $config{'clientName'} = $clientName unless $config{'clientName'};
175
      $config{'clientName'} = $clientName unless $config{'clientName'};
179
      $config{'serialNumber'} = $serialNumber unless $config{'serialNumber'};
176
      $config{'serialNumber'} = $serialNumber unless $config{'serialNumber'};
180
      $config{'UUID'} = $UUID unless $config{'UUID'};
177
      $config{'UUID'} = $UUID unless $config{'UUID'};
181
      $config{'hostname'} = $hostname unless $config{'hostname'};
178
      $config{'hostname'} = $hostname unless $config{'hostname'};