Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

This is a test of tagging and how it will work with the release

process.
  • Loading branch information...
commit c13b679d8bf8db45027004056ecef7f1bb2a97cc 1 parent 066fd12
cfb authored
View
17 lib/Spine/Data.pm
@@ -419,15 +419,20 @@ sub _read_keyfile
$_ = $self->_convert_lame_to_TT($_);
+ # We check this first because we want YAML & JSON files to be
+ # templatable as well. We flag it as a templatized file for a minor
+ # performance gain
+ if (not defined($template) and m/\[%.+/o)
+ {
+ $template = 1;
+ }
+
# YAML and JSON key files need to have their first line formatted
- # specifically, it is then discarded (if it isn't, the JSON
- # parser throws a syntax error and blows up spine, the YAML
- # parser just gums up the name of the first item)
+ # specifically
if ($PARSER_LINE == 1 and m/^#?%(YAML\s+\d+\.\d+|JSON)/o)
{
$complex = $1;
- $buf = join('', <$fh>);
- $template = 1 if (not defined($template) and $buf =~ m/\[%.+/o);
+ $buf = $_ . join('', <$fh>);
last LINE;
}
@@ -436,8 +441,6 @@ sub _read_keyfile
next LINE;
}
- $template = 1 if (not defined($template) and m/\[%.+/o);
-
$buf .= $_;
}
View
93 lib/Spine/Plugin/FirstRun.pm
@@ -26,7 +26,7 @@ use base qw(Spine::Plugin);
use Spine::Constants qw(:plugin);
our ($VERSION, $DESCRIPTION, $MODULE);
-
+
$VERSION = sprintf("%d", q$Revision$ =~ /(\d+)/);
$DESCRIPTION = "Spine::Plugin skeleton";
@@ -39,98 +39,45 @@ $MODULE = { author => 'osscode@ticketmaster.com',
};
-use Spine::Util qw(mkdir_p safe_copy uid_conv gid_conv touch);
+use Spine::Util;
sub first_run
{
my $c = shift;
my $rval = 0;
- my $state_dir = $c->{c_config}->{spine}->{StateDir};
+ my $state_dir = $c->getval("state_dir");
+ my $software = $c->getval("software_root");
+ my $class = $c->getval("c_class");
+
my $service_bin = $c->getval('service_bin');
my $stop_services = $c->getvals('stop_services');
- my $default_ugid = $c->getval('firstrun_default_ugid') || qq(0:0);
- my $default_mode = $c->getval('firstrun_default_mode')
- || qq(0755);
-
- my $dryrun = $c->getval('c_dryrun');
-
- # If FirstRun has already been run, we just return.
- if ( -f "${state_dir}/installed")
- {
- $c->print(2, "skipping, ${state_dir}/installed found");
- return PLUGIN_SUCCESS;
- }
+ # Modules.conf is replaced with kernel 2.6.
+ my $modules_conf_file = "/etc/modules.conf";
+ $modules_conf_file = "/etc/modprobe.conf"
+ if (-f "/etc/modprobe.conf");
for my $service (@{$stop_services})
{
- $c->print(2, "stopping $service");
+ $c->cprint("stopping $service", 3);
my $result = `$service_bin $service stop 2>&1`
- unless ($dryrun);
+ unless ($c->getval('c_dryrun'));
}
- $c->print(2, "creating state directory $state_dir");
- unless ($dryrun)
- {
- mkdir_p("${state_dir}", 0755) || $rval++;
- }
+ return PLUGIN_SUCCESS if (-f "${state_dir}/installed");
- if ( exists $c->{'firstrun_mkdirs'} )
- {
- for my $element ( @{$c->getvals("firstrun_mkdirs")} )
- {
- (my $dir, my $mode, my $ugid) = split( /,/, $element);
- $mode = $default_mode unless $mode;
-
- $ugid = $default_ugid unless $ugid;
- (my $uid, my $gid) = split( /:/, $ugid);
-
- $c->print(2, "creating directory $dir "
- . "[mode $mode | owner/group "
- . uid_conv($uid) . ":"
- . gid_conv($gid) . "]");
-
- unless ($dryrun)
- {
- mkdir_p($dir, oct($mode)) || $rval++;
- chown $uid, $gid, $dir;
- }
- }
- }
+ Spine::Util::mkdir_p("${state_dir}", 0755);
+ Spine::Util::safe_copy("/etc/fstab", "${state_dir}/") || $rval++;
+ Spine::Util::safe_copy("$modules_conf_file", "${state_dir}/") || $rval++;
- if ( exists $c->{'firstrun_cpfiles'} )
- {
- for my $element ( @{$c->getvals("firstrun_cpfiles")} )
- {
- (my $file, my $dir) = split( /,/, $element);
- if ( ! -d $dir )
- {
- (my $uid, my $gid) = split( /:/, $default_ugid);
- $c->print(2, "creating directory $dir "
- . "[mode $default_mode | owner/group "
- . uid_conv($uid) . ":"
- . gid_conv($gid) . "]");
-
- unless ($dryrun)
- {
- mkdir_p($dir, oct($default_mode)) || $rval++;
- chown $uid, $gid, $dir;
- }
- }
-
- $c->print(2, "copying $file to $dir");
-
- unless ($dryrun)
- {
- safe_copy("$file", "$dir") || $rval++;
- }
- }
- }
+ Spine::Util::mkdir_p("${software}", 0755);
+ Spine::Util::mkdir_p("${class}/local", 0755);
+ Spine::Util::mkdir_p("${class}/shared", 0755);
if ($rval == 0)
{
- touch("${state_dir}/installed") unless ($dryrun);
+ Spine::Util::touch("${state_dir}/installed");
return PLUGIN_SUCCESS;
}
else
View
2  lib/Spine/Plugin/Overlay.pm
@@ -250,8 +250,6 @@ sub apply_overlay
. ' [mode ' . octal_conv($src_stat->mode) . ' |'
. ' owner/group ' . uid_conv($src_stat->uid) . ':'
. gid_conv($src_stat->gid) . ']');
-
- $touch->touch($srcfile);
}
}
View
4 lib/Spine/Plugin/SystemInfo.pm
@@ -206,10 +206,6 @@ sub get_netinfo
return 0; } @nets;
my $nobj = @nets[-1];
- unless (ref($nobj) eq 'NetAddr::IP') {
- $c->error("network for IP \"$c->{c_ip_address}\" is not defined", 'err');
- return PLUGIN_FATAL;
- }
$c->{c_subnet} = "$nobj"; # stringification of a NetAddr::IP object
$c->{c_network} = $nobj->network->addr;
Please sign in to comment.
Something went wrong with that request. Please try again.