remove port number from hostname
authorlrrb <lrrb@users.noreply.github.com>
Wed, 16 Nov 2016 22:06:37 +0000 (23:06 +0100)
committerGitHub <noreply@github.com>
Wed, 16 Nov 2016 22:06:37 +0000 (23:06 +0100)
Solve the issue reported in https://tickets.puppetlabs.com/browse/MODULES-4104 :  remove the port number from repository location in order to get the host name of the repository.

manifests/source.pp

index 9adf6a2336ee764db234216e1cf0b20b413ef48a..c70a8cc66e2e67eabedbcc50b5a8f72f359ba50c 100644 (file)
@@ -124,8 +124,8 @@ define apt::source(
     if is_hash($pin) {
       $_pin = merge($pin, { 'ensure' => $ensure, 'before' => $_before })
     } elsif (is_numeric($pin) or is_string($pin)) {
-      $url_split = split($location, '/')
-      $host      = $url_split[2]
+      $url_split = split($location, '[:\/]+')
+      $host      = $url_split[1]
       $_pin = {
         'ensure'   => $ensure,
         'priority' => $pin,