]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Update docker resource python script location 73/1773/23
authorIgor Yozhikov <iyozhikov@mirantis.com>
Wed, 31 Dec 2014 09:50:06 +0000 (12:50 +0300)
committerIgor Yozhikov <iyozhikov@mirantis.com>
Tue, 20 Jan 2015 11:57:57 +0000 (14:57 +0300)
* add python-docker as runtime requirement
* docker resource add as additional package heat-docker
* add tests for heat-docker

Change-Id: I41dcf10f4d407e18c1c9a6829c01fbe13b700d52
Closes-Bug: #1404911

debian/changelog
debian/control
debian/heat-docker.dirs [new file with mode: 0644]
debian/heat-docker.install [new file with mode: 0644]
debian/rules
rpm/SPECS/openstack-heat.spec
tests/runtests.sh

index 3375dc5388be41a1f0cf76e214fbf97c81381d6e..37b76b39c32a51e96263ccbba0b34a559f6531f7 100644 (file)
@@ -1,3 +1,9 @@
+heat (2014.2.b3-0ubuntu1) trusty; urgency=medium
+
+  *  update docker resource python script location according to LP 1404911
+
+ -- Igor Yozhikov <iyozhikov@mirantis.com>  Wed, 31 Dec 2014 12:30:05 +0400
+
 heat (2014.2.b3-0ubuntu1) trusty; urgency=medium
 
   *  update for global requirements
@@ -35,7 +41,7 @@ heat (2014.1-0ubuntu1) trusty; urgency=medium
   [ Chuck Short ]
   * New upstream release. (LP: #1299055)
   * debian/heat-common.postinst: Create directory before changing
-    permissions. (LP: #1267557) 
+    permissions. (LP: #1267557)
 
   [ Corey Bryant ]
   * New upstream release (LP: #1299055).
@@ -44,7 +50,7 @@ heat (2014.1-0ubuntu1) trusty; urgency=medium
 
 heat (2014.1~rc2-0ubuntu3) trusty; urgency=medium
 
-  * debian/heat-common.postinst: Fix failing autopkg test. 
+  * debian/heat-common.postinst: Fix failing autopkg test.
 
  -- Chuck Short <zulcss@ubuntu.com>  Mon, 14 Apr 2014 13:36:05 -0400
 
@@ -110,7 +116,7 @@ heat (2014.1~b2-0ubuntu1) trusty; urgency=low
 heat (2014.1~b1-0ubuntu2) trusty; urgency=low
 
   * debian/patches/default-sqlite.patch: Update default sqlite path to
-    fix heat-engine install failures. 
+    fix heat-engine install failures.
 
  -- James Page <james.page@ubuntu.com>  Fri, 06 Dec 2013 11:26:25 +0000
 
@@ -173,14 +179,14 @@ heat (2013.2~b3-0ubuntu1) saucy; urgency=low
 heat (2013.2~b2.a186.g2b4b248-0ubuntu2) saucy; urgency=low
 
   * d/rules: Limit test execution concurrency to 1 to avoid test failures
-    in buildds. 
+    in buildds.
 
  -- James Page <james.page@ubuntu.com>  Thu, 08 Aug 2013 15:42:32 +0100
 
 heat (2013.2~b2.a186.g2b4b248-0ubuntu1) saucy; urgency=low
 
   [ Chuck Short ]
-  * debian/patches/rename-quantumclient.patch: Dropped no longer needed. 
+  * debian/patches/rename-quantumclient.patch: Dropped no longer needed.
   * debian/control: Add python-oslo.sphinx
 
   [ James Page ]
@@ -218,7 +224,7 @@ heat (2013.2~b2-0ubuntu3) saucy; urgency=low
   * Resynchronize with debian, remaining changes:
     - Add sqlite3 to heat-common depends to fix
       an autopkgtest failure.
-    - Add autopkg tests. 
+    - Add autopkg tests.
     - Pass the testsuite if it fails.
 
  -- Chuck Short <zulcss@ubuntu.com>  Wed, 07 Aug 2013 10:36:33 -0400
@@ -226,7 +232,7 @@ heat (2013.2~b2-0ubuntu3) saucy; urgency=low
 heat (2013.2~b2-0ubuntu2) saucy; urgency=low
 
   * debian/control: Add sqlite3 to heat-common depends to fix
-    an autopkgtest failure. 
+    an autopkgtest failure.
 
  -- Chuck Short <zulcss@ubuntu.com>  Tue, 06 Aug 2013 15:36:33 +0000
 
index ffd5b905b33d914bf9a2a80b16ab7f6429a2a77c..d0ddfb5261aaeb45ea79df68c3e1473fa17a085c 100644 (file)
@@ -139,6 +139,21 @@ Description: OpenStack orchestration service - common files
  .
  This package contains the common files.
 
+Package: heat-docker
+Architecture: all
+Depends:
+ python-docker (>= 0.7.0),
+ heat-engine (=${binary:Version}),
+ ${misc:Depends},
+ ${ostack-lsb-base},
+ ${python:Depends}
+Description: OpenStack orchestration service docker resource
+ Heat is a service to orchestrate multiple composite cloud applications using
+ templates, through both an OpenStack-native ReST API and a
+ CloudFormation-compatible Query API.
+ .
+ This package contains the heat engine docker resource.
+
 Package: heat-engine
 Architecture: all
 Depends:
diff --git a/debian/heat-docker.dirs b/debian/heat-docker.dirs
new file mode 100644 (file)
index 0000000..aee7534
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/heat/docker
diff --git a/debian/heat-docker.install b/debian/heat-docker.install
new file mode 100644 (file)
index 0000000..16f8833
--- /dev/null
@@ -0,0 +1 @@
+contrib/heat_docker/heat_docker/* /usr/lib/heat/docker
index fbd534330cd74bc15d9882cfe8153efa0225f4d3..ded8fd2750ddcb7c145901fd05079fce4d39d089 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 
 #export DH_VERBOSE=1
-
+DESTDIR := $(CURDIR)/debian/heat
 %:
        dh $@  --with python2
 
index 2ef434d470c20b730d53f3218e1348a0a2782c95..17391cca0fc420574c7eb08d1d6da24d0358d729 100644 (file)
@@ -132,6 +132,10 @@ install -p -D -m 755 %{SOURCE3} %{buildroot}%{_initrddir}/openstack-heat-api-cfn
 install -p -D -m 755 %{SOURCE4} %{buildroot}%{_initrddir}/openstack-heat-engine
 install -p -D -m 755 %{SOURCE5} %{buildroot}%{_initrddir}/openstack-heat-api-cloudwatch
 
+mkdir -p %{buildroot}/usr/lib/heat/docker
+cp -vr contrib/heat_docker/heat_docker/* %{buildroot}/usr/lib/heat/docker/
+find %{buildroot}/usr/lib/heat/docker/ -type f -name "*.py[co]" -delete
+
 mkdir -p %{buildroot}/var/lib/heat/
 mkdir -p %{buildroot}/etc/heat/
 
@@ -160,6 +164,7 @@ install -p -D -m 640 etc/heat/policy.json %{buildroot}/%{_sysconfdir}/heat
 cp -vr etc/heat/templates %{buildroot}/%{_sysconfdir}/heat
 cp -vr etc/heat/environment.d %{buildroot}/%{_sysconfdir}/heat
 
+
 %description
 Heat provides AWS CloudFormation and CloudWatch functionality for OpenStack.
 
@@ -245,6 +250,19 @@ useradd --uid 187 -r -g heat -d %{_sharedstatedir}/heat -s /sbin/nologin \
 -c "OpenStack Heat Daemons" heat
 exit 0
 
+# docker resource
+%package docker
+Summary: The Heat Docker resource
+Group: System Environment/Base
+Requires: python-docker-py >= 0.7
+Requires: %{name}-engine = %{version}-%{release}
+
+%description docker
+OpenStack HEAT docker resourece for managing docker instances on OpenStack
+
+%files docker
+/usr/lib/heat/docker
+
 %package engine
 Summary: The Heat engine
 Group: System Environment/Base
@@ -405,6 +423,9 @@ fi
 
 
 %changelog
+* Wed Dec 31 2014 Igor Yozhikov <iyozhikov@mirantis.com> - 2014.2.b2
+- update docker resource python script location according to LP 1404911
+
 * Wed Sep 17 2014 Denis Egorenko <degorenko@mirantis.com> - 2014.2.b2
 - update for global requirements
 - fix init script (explicitly setting config file)
@@ -594,7 +615,7 @@ fi
 - added LICENSE to docs
 - added dist tag
 - added heat directory to files section
-- removed unnecessary defattr 
+- removed unnecessary defattr
 
 * Tue Jul 24 2012 Jeff Peeler <jpeeler@redhat.com> - 4-4
 - remove pycrypto requires
index e34280374db1a49cc01b239c5b4f28754b558f42..10ff07727a0bf9d5f3b70eddd3efe64ac94447ab 100755 (executable)
@@ -5,149 +5,173 @@ MYSQL_PASSWORD="heat"
 conf_file=/etc/heat/heat.conf
 
 prepare_vm() {
-   if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]]
-   then
-      echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" | sudo debconf-set-selections
-      echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" | sudo debconf-set-selections
-      apt-get install -y mysql-server python-mysqldb rabbitmq-server
-   else
-      yum install screen mysql-server MySQL-python rabbitmq-server -y
-      service mysqld start
-      /usr/bin/mysqladmin -u root password $MYSQL_PASSWORD
-      /usr/bin/mysqladmin -u root --password=$MYSQL_PASSWORD  -h localhost $MYSQL_PASSWORD
-   fi
-   service rabbitmq-server start
-   mysql -uroot -p$MYSQL_PASSWORD -Bse "create database heat"
-   sed -i "/^\[database\]/a connection=mysql://root:$MYSQL_PASSWORD@localhost/heat"  $conf_file
-   heat-manage -d db_sync
-   if [ "$?" != "0" ]
-   then
-      echo "Couldn't execute 'heat-manage db_sync'"
-      RES=1
-   fi
+    if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]]
+        then
+        echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" | sudo debconf-set-selections
+        echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" | sudo debconf-set-selections
+        apt-get install -y mysql-server mysql-client python-mysqldb rabbitmq-server
+    else
+        yum install screen mysql-server MySQL-python MySQL-client rabbitmq-server -y
+        service $(chkconfig | grep -oE '^mysql.?\s') start
+        /usr/bin/mysqladmin -u root password $MYSQL_PASSWORD
+    fi
+    service rabbitmq-server start
+    mysql -uroot -p$MYSQL_PASSWORD -Bse "create database heat"
+    sed -i "/^\[database\]/a connection=mysql://root:$MYSQL_PASSWORD@localhost/heat"  $conf_file
+    heat-manage -d db_sync
+    if [ "$?" != "0" ]
+        then
+        echo "Couldn't execute 'heat-manage db_sync'"
+        RES=1
+    fi
 }
 
 case $package in
-     openstack-heat-common)
-        python -c 'import heat'
-        if [ $? -ne '0' ]; then
-            echo -e "Couldn't import module 'heat'"
-            RES=1
-        fi
-        if [ -z "$(cut -d: -f1 /etc/passwd | grep 'heat')" ]; then
-            echo -e "User 'heat' doesn't exist"
+    openstack-heat-common)
+    python -c 'import heat'
+    if [ $? -ne '0' ]; then
+        echo -e "Couldn't import module 'heat'"
+        RES=1
+    fi
+    if [ -z "$(cut -d: -f1 /etc/passwd | grep 'heat')" ]; then
+        echo -e "User 'heat' doesn't exist"
+        RES=1
+    fi
+    config_files="policy.json api-paste.ini heat.conf"
+    for i in $config_files; do
+        if [ ! -f "/etc/heat/$i" ]; then
             RES=1
+            echo "File /etc/heat/$i doesn't exist"
         fi
-        files="policy.json api-paste.ini heat.conf"
-        for i in $config_files; do
-            if [ ! -f "/etc/heat/$i" ]; then
-               RES=1
-               echo "File /etc/heat/$i doesn't exist"
-            fi
-        done
-     ;;
-     python-heat)
-        python -c 'import heat'
-        if [ $? -ne '0' ]; then
-            echo -e "Couldn't import module 'heat'"
+    done
+    ;;
+    python-heat)
+    python -c 'import heat'
+    if [ $? -ne '0' ]; then
+        echo -e "Couldn't import module 'heat'"
+        RES=1
+    fi
+    ;;
+    heat-common)
+    if [ -z "$(cut -d: -f1 /etc/passwd | grep 'heat')" ]; then
+        echo -e "User 'heat' doesn't exist"
+        RES=1
+    fi
+    config_files="policy.json api-paste.ini heat.conf"
+    for i in $config_files; do
+        if [ ! -f "/etc/heat/$i" ]; then
             RES=1
+            echo "File /etc/heat/$i doesn't exist"
         fi
-     ;;
-     heat-common)
-        if [ -z "$(cut -d: -f1 /etc/passwd | grep 'heat')" ]; then
-            echo -e "User 'heat' doesn't exist"
-            RES=1
-        fi
-        files="policy.json api-paste.ini heat.conf"
-        for i in $config_files; do
-            if [ ! -f "/etc/heat/$i" ]; then
-               RES=1
-               echo "File /etc/heat/$i doesn't exist"
-            fi
-        done
-     ;;
-     heat-api|openstack-heat-api)
-        prepare_vm
-        screen -dmS heat-api
-        sleep 2
-        echo "Starting Heat API..."
-        screen -S heat-api -p 0 -X stuff "heat-api --config-file $conf_file -d --log-file /tmp/heat-api.log
-"
-        sleep 5
-        curl_req=`curl http://localhost:8004/v1/tenant/stacks`
-        cat /tmp/heat-api.log
-        if [ `netstat -nat | grep 8004 | wc -l` != 0 ] && [[ $curl_req =~ Auth ]]
+    done
+    ;;
+    heat-api|openstack-heat-api)
+    prepare_vm
+    screen -dmS heat-api
+    sleep 2
+    echo "Starting Heat API..."
+    screen -S heat-api -p 0 -X stuff "heat-api --config-file $conf_file -d --log-file /tmp/heat-api.log 2>>/tmp/heat-api.log
+    "
+    sleep 5
+    curl_req=`curl http://localhost:8004/v1/tenant/stacks`
+    cat /tmp/heat-api.log
+    if [ `netstat -nat | grep 8004 | wc -l` != 0 ] && [[ $curl_req =~ Auth ]]
         then
-            echo "Heat API successfully started"
-        else
-            echo "Heat API didn't start"
-            RES=1
-        fi
-     ;;
-     heat-engine|openstack-heat-engine)
-        prepare_vm
-        screen -dmS heat-engine
-        sleep 2
-        echo "Starting Heat Engine..."
-        screen -S heat-engine -p 0 -X stuff "heat-engine --config-file $conf_file -d --log-file /tmp/heat-engine.log
-"
-        sleep 5
-        cat /tmp/heat-engine.log
-        trace_count=`cat /tmp/heat-engine.log | grep -i Traceback | wc -l`
-        if [ "$trace_count" -ne "0" ]
+        echo "Heat API successfully started"
+    else
+        echo "Heat API didn't start"
+        RES=1
+    fi
+    ;;
+    heat-engine|openstack-heat-engine)
+    prepare_vm
+    screen -dmS heat-engine
+    sleep 2
+    echo "Starting Heat Engine..."
+    screen -S heat-engine -p 0 -X stuff "heat-engine --config-file $conf_file -d --log-file /tmp/heat-engine.log 2>>/tmp/heat-engine.log
+    "
+    sleep 5
+    cat /tmp/heat-engine.log
+    trace_count=`cat /tmp/heat-engine.log | grep -i Traceback | wc -l`
+    if [ "$trace_count" -ne "0" ]
         then
-           echo "Something went wrong! Log file have trace errors! Check logs"
-           RES=1
+        echo "Something went wrong! Log file have trace errors! Check logs"
+        RES=1
+    else
+        rabbit_connections=`cat /tmp/heat-engine.log | grep 'Connected to AMQP server on' | wc -l`
+        if [ "$rabbit_connections" -eq "0" ]
+            then
+            echo "Heat Engine: Can't connected to RabbitMQ"
+            RES=1
         else
-           rabbit_connections=`cat /tmp/heat-engine.log | grep 'Connected to AMQP server on' | wc -l`
-           if [ "$rabbit_connections" -eq "0" ]
-           then
-               echo "Heat Engine: Can't connected to RabbitMQ"
-               RES=1
-           else
-               echo "Heat Engine successfully started"
-           fi
+            echo "Heat Engine successfully started"
         fi
-     ;;
-     heat-api-cfn|openstack-heat-api-cfn)
-        prepare_vm
-        screen -dmS heat-api-cfn
-        sleep 2
-        echo "Starting Heat API CFN..."
-        screen -S heat-api-cfn -p 0 -X stuff "heat-api-cfn --config-file $conf_file -d --log-file /tmp/heat-api-cfn.log
-"
-        sleep 5
-        cat /tmp/heat-api-cfn.log
-        check_start_cfn=`cat /tmp/heat-api-cfn.log | grep 'Starting Heat API on' | wc -l`
-        if [ "$check_start_cfn" -ne "0" ]
+    fi
+    ;;
+    heat-docker|openstack-heat-docker)
+    prepare_vm
+    screen -dmS heat-engine
+    sleep 2
+    echo "Starting Heat Engine with docker resource..."
+    screen -S heat-engine -p 0 -X stuff "heat-engine --config-file $conf_file -d --log-file /tmp/heat-engine.log 2>>/tmp/heat-engine.log
+    "
+    sleep 5
+    cat /tmp/heat-engine.log
+    trace_count=$(grep -ic Traceback /tmp/heat-engine.log)
+    if [ "$trace_count" -ne "0" ]
         then
-            echo "Heat API CFN successfully started"
-        else
+        echo "Something went wrong! Log file have trace errors! Check logs"
+        RES=1
+    else
+        docker_regitered=$(grep -c 'Registering DockerInc::Docker::Container' /tmp/heat-engine.log)
+        if [ "$docker_regitered" -eq "0" ]
+            then
+            echo "Heat Docker: engine can't load docker resource"
             RES=1
-            echo "Heat API CFN didn't start"
-        fi
-     ;;
-     heat-api-cloudwatch|openstack-heat-api-cloudwatch)
-        prepare_vm
-        screen -dmS heat-api-clw
-        sleep 2
-        echo "Starting Heat API Cloudwatch..."
-        screen -S heat-api-clw -p 0 -X stuff "heat-api-cloudwatch --config-file $conf_file -d --log-file /tmp/heat-api-clw.log
-"
-        sleep 5
-        cat /tmp/heat-api-clw.log
-        check_start_clw=`cat /tmp/heat-api-clw.log | grep 'Starting Heat CloudWatch API on' | wc -l`
-        if [ "$check_start_clw" -ne "0" ]
-        then
-            echo "Heat API Cloudwatch successfully started"
         else
-            RES=1
-            echo "Heat API Cloudwatch didn't start"
+            echo "Heat Docker: engine loaded docker resource successfully"
         fi
-     ;;
-     *)
-        echo "test not defined, skipping..."
-     ;;
+    fi
+    ;;
+    heat-api-cfn|openstack-heat-api-cfn)
+    prepare_vm
+    screen -dmS heat-api-cfn
+    sleep 2
+    echo "Starting Heat API CFN..."
+    screen -S heat-api-cfn -p 0 -X stuff "heat-api-cfn --config-file $conf_file -d --log-file /tmp/heat-api-cfn.log 2>>/tmp/heat-api-cfn.log
+    "
+    sleep 5
+    cat /tmp/heat-api-cfn.log
+    check_start_cfn=`cat /tmp/heat-api-cfn.log | grep 'Starting Heat API on' | wc -l`
+    if [ "$check_start_cfn" -ne "0" ]
+        then
+        echo "Heat API CFN successfully started"
+    else
+        RES=1
+        echo "Heat API CFN didn't start"
+    fi
+    ;;
+    heat-api-cloudwatch|openstack-heat-api-cloudwatch)
+    prepare_vm
+    screen -dmS heat-api-clw
+    sleep 2
+    echo "Starting Heat API Cloudwatch..."
+    screen -S heat-api-clw -p 0 -X stuff "heat-api-cloudwatch --config-file $conf_file -d --log-file /tmp/heat-api-clw.log 2>>/tmp/heat-api-clw.log
+    "
+    sleep 5
+    cat /tmp/heat-api-clw.log
+    check_start_clw=`cat /tmp/heat-api-clw.log | grep 'Starting Heat CloudWatch API on' | wc -l`
+    if [ "$check_start_clw" -ne "0" ]
+        then
+        echo "Heat API Cloudwatch successfully started"
+    else
+        RES=1
+        echo "Heat API Cloudwatch didn't start"
+    fi
+    ;;
+    *)
+    echo "test not defined, skipping..."
+    ;;
 esac
 killall -15 screen
 exit $RES