Commit afe679f7 authored by Leigh Stoller's avatar Leigh Stoller

Mark NS converted profiles as "portal" converted so that the user can

use Jacks too. The wrinkle is that we append the original NS file to the
end of the geni-lib script, so it fails the RTE check. So put in an
explicit exclusion for that, while I think about how a more general
comments solution.
parent 1d64bc68
......@@ -112,10 +112,34 @@ else {
die("Bad data in argument: $file.");
}
#
# Exclusion for NS converted files which have the original NS file as
# a comment at the end of the file. Lets find that and strip it out of
# the comparison. If the user uses the topology editor we are going to
# lose the comment block anyway, but thats okay.
#
my ($copyfd, $copyname) = tempfile("/tmp/rtecheckXXXXX", UNLINK => 1);
if (!defined($copyfd)) {
fatal("Could not open temporary file for geni-lib");
}
open(IN, $file) or
fatal("Could not open $file for reading: $!");
while (<IN>) {
if ($_ =~ /^\# Here is the original NS file/) {
while (<IN>) {
next
if ($_ =~ /^\#$/);
}
next;
}
print $copyfd $_;
}
close(IN);
#
# First convert to rspec.
#
my $rspec = emutil::ExecQuiet("$RUNGENILIB -W $file");
my $rspec = emutil::ExecQuiet("$RUNGENILIB -W $copyname");
if ($?) {
print STDERR $rspec;
print STDERR "Could not convert geni-lib script to an rspec\n";
......@@ -156,7 +180,7 @@ if (!defined($fd)) {
}
print $fd $genilib;
my $output = emutil::ExecQuiet("$DIFF -E -B -b $file $filename");
my $output = emutil::ExecQuiet("$DIFF -I '^\#\$' -E -B -b $copyname $filename");
if ($?) {
print STDERR $output;
# For the web interface.
......
......@@ -1496,10 +1496,11 @@ $(function ()
return;
}
sup.ClearDownloadOnClick($('#rspec_modal_download_button'));
// Need to force Jacks into viewermode.
gotscript = 1;
CreateJacksEditor();
sup.HideWaitWait(function () { changeRspec(json.value.script); });
sup.HideWaitWait(function () {
changeRspec(json.value.script);
// Do this after so we do not do an RTE check up above.
MarkPortalConverted(true);
});
}
/*
* Send along the project if one is selected; only makes sense
......@@ -1706,15 +1707,11 @@ $(function ()
if (fromrepo) {
caneditcode = 0;
canedittopo = 0;
// Hide the file upload button, user is committed
$('#sourcefile-button-div').addClass("hidden");
}
if (portal_converted) {
caneditcode = 1;
canedittopo = 1;
// Hide the file upload button, user is committed
$('#sourcefile-button-div').addClass("hidden");
// Ditto the git-repo button.
// Hide the git-repo button.
$('#git-repo-button-div').addClass("hidden");
}
if (canedittopo) {
......@@ -1725,6 +1722,9 @@ $(function ()
}
if (caneditcode) {
$('#show_source_modal_button').html('Edit Code');
// Hide the file upload button, user is committed, and
// there is an upload button in the code editor.
$('#sourcefile-button-div').addClass("hidden");
}
else {
$('#show_source_modal_button').html('View Code');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment