Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
use NMIS;
use Auth;
use NMIS::UUID;
my $C = loadConfTable();
# variables used for the security mods
my $AU = Auth->new(conf => $C); # Auth::new will reap init values from NMIS::config
# Calling program needs to do auth, then set the ENVIRONMENT before this is called.
$AU->SetUser($ENV{'NMIS_USER'});
my @groups = ();
my $GT = loadGroupTable();
foreach (sort split(',',$C->{group_list})) { push @groups, $_ if $AU->InGroup($_); }
my @nodes = ();
my $LNT = loadLocalNodeTable(); # load from file or db
foreach (sort {lc($a) cmp lc($b)} keys %{$LNT}) { push @nodes, $_ if $AU->InGroup($LNT->{$_}{group}); }
my @models = ();
if ( opendir(MDL,$C->{'<nmis_models>'}) ) {
 @models = ('automatic',sort {uc($a) cmp uc($b)} (grep(s/^Model-(.*)\.nmis$/$1/,readdir MDL)));
} else {
 print Tr(td({class=>'error'},"Error on loading models names from directory $C->{'<nmis_models>'}"));
}
closedir(MDL);
my $uuid;
if ( $C->{uuid_add_with_node} eq "true" ) {
 $uuid = getUUID();
}
return (
 Nodes => [ # using an array for fixed order of fields
 { name => { header => 'Name',display => 'key,header,text',value => [""] }},
 { uuid => { header => 'UUID',display => 'header,readonly',value => ["$uuid"] }},
 { host => { header => 'Name/IP Address',display => 'header,text',value => [""] }},
--snip-- 

Not adding UUID when node added

You can use the configuration uuid_add_with_node set to true to enable a UUID to be added or disable it with false to allow the other methods to maintain the UUID.

Code Block
'uuid_add_with_node' => 'true',

Including the UUID in the Export

The sample script /usr/local/nmis8/admin/export_nodes.pl has been modified to include the UUID in the export.  You can review this code to see how it is added.  This code also uses the method createNodeUUID to create UUID's which might be missing from the nodes file.