add ubuntu support 51/55451/1
authorDavid Blaisonneau <david.blaisonneau@orange.com>
Tue, 24 Mar 2015 13:03:35 +0000 (14:03 +0100)
committerDaniel Farrell <dfarrell@redhat.com>
Wed, 19 Apr 2017 19:18:39 +0000 (15:18 -0400)
Change-Id: Iaf0c4855b25373beea99346472a1ff3b6b1ad573
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
manifests/init.pp
manifests/install.pp
metadata.json
templates/upstart.odl.conf [new file with mode: 0644]

index 414e418747f6d35d7ac10a3ed71675451b27de71..e1ce45600255b374f7ebf8f113b5adbc244953ab 100644 (file)
@@ -26,8 +26,14 @@ class opendaylight (
 ) inherits ::opendaylight::params {
 
   # Validate OS family
-  if $::osfamily != 'RedHat' {
-    fail("Unsupported OS family: ${::osfamily}")
+  case $::osfamily {
+    Debian: {
+        warning('Debian family is valid but only installable with tarball method')
+    }
+    RedHat: {}
+    default: {
+        fail("Unsupported OS family: ${::osfamily}")
+    }
   }
 
   # Validate OS
@@ -44,6 +50,12 @@ class opendaylight (
         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
       }
     }
+    Ubuntu: {
+      if $::operatingsystemmajrelease != '14.04' {
+        # Only tested on 14.04
+        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+      }
+    }
     default: {
       fail("Unsupported OS: ${::operatingsystem}")
     }
index d649b3a9f3676e21754486ec47e0417b19f9d917..d3df05ca3b190a185dc9efe66f0c9a389a899b2f 100644 (file)
@@ -35,9 +35,13 @@ class opendaylight::install {
   }
   elsif $opendaylight::install_method == 'tarball' {
     # Install Java 7
+    $package = $::osfamily ? {
+      'RedHat' => 'java-1.7.0-openjdk',
+      'Debian' => 'java7-jdk',
+    }
     class { 'java':
       # NB: ODL is currently in the process of moving to Java 8
-      package => 'java-1.7.0-openjdk',
+      package => $package,
     }
 
     # Create and configure the odl user
@@ -83,27 +87,6 @@ class opendaylight::install {
       before           => [File['/opt/opendaylight/'], User['odl']],
     }
 
-    # Download ODL systemd .service file and put in right location
-    archive { 'opendaylight-systemd':
-      ensure           => present,
-      # URL from which ODL's systemd unitfile can be downloaded
-      url              => $opendaylight::unitfile_url,
-      # Will end up installing /usr/lib/systemd/system/opendaylight.service
-      target           => '/usr/lib/systemd/system/',
-      # Required by archive mod for correct exec `creates` param
-      root_dir         => 'opendaylight.service',
-      # ODL doesn't provide a checksum in the expected path, would fail
-      checksum         => false,
-      # This discards top-level dir of extracted tarball
-      # Required to avoid a subdir in system dir, generally get proper path
-      strip_components => 1,
-      # May end up with HTTP redirect output in a text file without this
-      # Note that the curl'd down file would still have a .tar.gz name
-      follow_redirects => true,
-      # The unitfile should exist before we try to set its user/group/mode
-      before           => File['/usr/lib/systemd/system/opendaylight.service'],
-    }
-
     # Set the user:group owners and mode of ODL dir
     file { '/opt/opendaylight/':
       # ensure=>dir and recurse=>true are required for managing recursively
@@ -117,17 +100,54 @@ class opendaylight::install {
       require => [Archive['opendaylight'], Group['odl'], User['odl']],
     }
 
-    # Set the user:group owners and mode of ODL's systemd .service file
-    file { '/usr/lib/systemd/system/opendaylight.service':
-      # It should be a normal file
-      ensure  => 'file',
-      # Set user:group owners of ODL systemd .service file
-      owner   => 'root',
-      group   => 'root',
-      # Set mode of ODL systemd .service file
-      mode    => '0644',
-      # Should happen after the ODL systemd .service file has been extracted
-      require => Archive['opendaylight-systemd'],
+    if ( $::osfamily == 'RedHat' ){
+        # Download ODL systemd .service file and put in right location
+        archive { 'opendaylight-systemd':
+          ensure           => present,
+          url              => $opendaylight::unitfile_url,
+          # Will end up installing /usr/lib/systemd/system/opendaylight.service
+          target           => '/usr/lib/systemd/system/',
+          # Required by archive mod for correct exec `creates` param
+          root_dir         => 'opendaylight.service',
+          # ODL doesn't provide a checksum in the expected path, would fail
+          checksum         => false,
+          # This discards top-level dir of extracted tarball
+          # Required to get proper /opt/opendaylight-<version> path
+          strip_components => 1,
+          # May end up with an HTML redirect output in a text file without this
+          # Note that the curl'd down file would still have a .tar.gz name
+          follow_redirects => true,
+          # Should exist before we try to set its user/group/mode
+          before           => File['/usr/lib/systemd/system/opendaylight.service'],
+        }
+
+        # Set the user:group owners and mode of ODL's systemd .service file
+        file { '/usr/lib/systemd/system/opendaylight.service':
+          # It should be a normal file
+          ensure  => 'file',
+          # Set user:group owners of ODL systemd .service file
+          owner   => 'root',
+          group   => 'root',
+          # Set mode of ODL systemd .service file
+          mode    => '0644',
+          # Should happen after the ODL systemd .service file has been extracted
+          require => Archive['opendaylight-systemd'],
+        }
+    }
+    elsif ( $::osfamily == 'Debian' ){
+        file { '/etc/init/opendaylight.conf':
+          # It should be a normal file
+          ensure  => 'file',
+          # Set user:group owners of ODL upstart file
+          owner   => 'root',
+          group   => 'root',
+          # Set mode of ODL upstart file
+          mode    => '0644',
+          # Get content from template
+          content => template('opendaylight/upstart.odl.conf'),
+        }
+    }else{
+        fail("Unsupported OS family: ${::osfamily}")
     }
   }
   else {
index 4655ed6bb18669f2c6f5132bd8b67c096695ba42..d8d3b37a04a46edfc6c13853e6f5860c4ecacbcc 100644 (file)
@@ -32,8 +32,8 @@
       "operatingsystemrelease": [ "7" ]
     },
     {
-      "operatingsystem": "Fedora",
-      "operatingsystemrelease": [ "20", "21" ]
+      "operatingsystem": "Ubuntu",
+      "operatingsystemrelease": [ "14.04" ]
     }
   ],
   "requirements": [
diff --git a/templates/upstart.odl.conf b/templates/upstart.odl.conf
new file mode 100644 (file)
index 0000000..0cf7972
--- /dev/null
@@ -0,0 +1,19 @@
+# odl - opendaylight
+#
+
+description     "ODL - Open Day Light"
+
+# Make sure we start before an interface receives traffic
+start on (starting network-interface
+          or starting network-manager
+          or starting networking)
+
+stop on runlevel [!023456]
+
+console output
+
+export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
+
+exec start-stop-daemon --start --chuid odl --group odl --exec /opt/opendaylight/bin/start
+
+