You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/07/09 14:26:46 UTC
[trafficcontrol] 07/08: added stream iso support for custom
generate iso script
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit b2625878ffeab082d4b8fc528180ea926225c840
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Thu Jul 5 13:18:02 2018 -0600
added stream iso support for custom generate iso script
---
traffic_ops/app/lib/API/Iso.pm | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/traffic_ops/app/lib/API/Iso.pm b/traffic_ops/app/lib/API/Iso.pm
index 856fc02..0f9a84c 100644
--- a/traffic_ops/app/lib/API/Iso.pm
+++ b/traffic_ops/app/lib/API/Iso.pm
@@ -248,7 +248,9 @@ sub generate_iso {
&log($self, "ISO created [ " . $osversion_dir . " ] for " . $fqdn, "APICHANGE");
- my $iso_url = join("/", "https://" . lc hostfqdn(), $iso_dir, $iso_file_name);
+ # parse out http / https from to.base_url config; use local fqdn for download link
+ my @protocol = split( '://', $config->{'to'}{'base_url'} );
+ my $iso_url = join( '/', $protocol[0] . ':/', lc hostfqdn(), $iso_dir, $iso_file_name );
$response = {
isoName => $iso_file_name,
@@ -256,6 +258,21 @@ sub generate_iso {
};
} else {
my $data = `$cmd`;
+ if ( $type eq 'custom' ) {
+ my $ok = open my $fh, "<$iso_file_path";
+ if (! $ok ) {
+ $self->internal_server_error( { Error => "Error reading $iso_file_path" } );
+ return;
+ }
+
+ # slurp it in..
+ undef $/;
+ $data = <$fh>;
+
+ close $fh;
+ unlink $iso_file_path;
+ }
+
$response = {
iso => $data,
isoName => $iso_file_name,