Code

timestamp updates at jobdb are forbidden while status is 'processing'
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 15:06:27 +0000 (15:06 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 15:06:27 +0000 (15:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9029 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/GosaPackages.pm
gosa-si/tests/client.php

index 772955f122911d1ec279d508c37f70e678eccb36..14c5209aeff674a366cb23b7991f6274eda6e196 100644 (file)
@@ -531,25 +531,29 @@ sub update_status_jobdb_entry {
 
         # conditions
         # no timestamp update if status eq waiting
-        
+        my $res_hash = $main::job_db->select_dbentry("SELECT * FROM $table $where AND status='processing' ");
+        if( (0 != keys(%$res_hash)) && ($update =~ /timestamp/i) ) {
+            $error ++;
+            $out_xml = "<answer1>1</answer1><error_string>there is no timestamp update allowed while status is 'processing'</error_string>";
+        }
+
+        if( $error == 0 ) {
+            my $sql_statement = "UPDATE $table $update $where";
+            # execute db query
+            my $db_res = $main::job_db->update_dbentry($sql_statement);
 
-        my $sql_statement = "UPDATE $table $update $where";
-print STDERR "================================================\n";
-print STDERR "$sql_statement\n";
-        # execute db query
-        my $db_res = $main::job_db->update_dbentry($sql_statement);
+            # check success of db update
+            if( not $db_res > 0 ) { $error++; };
 
-        # check success of db update
-        if( not $db_res > 0 ) { $error++; };
+        }
     }
 
     if( $error == 0) {
-        $out_xml = "<xml><header>answer</header><source>$server_address</source><target>GOSA</target><answer1>0</answer1></xml>";
+        $out_xml = "<answer1>0</answer1>";
     }
-    my @out_msg_l = ( $out_xml );
-
-print STDERR $out_xml."\n";
-
+    
+    my $out_msg = sprintf("<xml><header>answer</header><source>%s</source><target>GOSA</target>%s</xml>", $server_address, $out_xml);
+    my @out_msg_l = ( $out_msg );
     return @out_msg_l;
 }
 
index f2c31685162f18f0c71deaf7c7a1be93774ee332..02efe6cb9300101e12c9155e96fc21e63a464108 100755 (executable)
@@ -30,6 +30,7 @@ if($sock->connected()){
 $data = "<xml> <header>gosa_reload_ldap_config</header> <source>GOSA</source><target>00:1B:77:04:8A:6C</target></xml>";
 
 # update  
+$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><timestamp>23450101000000</timestamp><result>XXXXXXXXXXXXXXx</result></update></xml>";
 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
 
 # query
@@ -60,7 +61,7 @@ $data = "<xml> <header>gosa_reload_ldap_config</header> <source>GOSA</source><ta
 
 
 #$data = "<xml><header>job_trigger_action_reinstall</header><source>GOSA</source><target>00:01:6c:9d:b9:fa</target><macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>20130101000000</timestamp></xml>";
-#$data = "<xml><header>job_trigger_action_reinstall</header><source>GOSA</source><target>00:01:6c:9d:b9:fa</target><macaddress>00:01:6c:9d:b9:fa</macaddress></xml>";
+#$data = "<xml><header>job_trigger_action_reinstall</header><source>GOSA</source><target>00:01:6c:9d:b9:fa</target><macaddress>00:01:6c:9d:b9:fa</macaddress><timestamp>98760101000000</timestamp></xml>";
 
 
     $sock->write($data);