Bug #72818 The --daemonize option in "mysqlfabric manage start" is broken
Submitted: 30 May 2014 15:16 Modified: 14 Jul 2014 23:20
Reporter: Alfranio Junior Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Fabric Severity:S3 (Non-critical)
Version:1.4.5, 1.5.2 OS:Linux
Assigned to: Alfranio Junior CPU Architecture:Any

[30 May 2014 15:16] Alfranio Junior
Description:
If you try to use the --daemonize option in "mysqlfabric manage start", the following error is produced:

$mysqlfabric manage start --daemonize
mysqlfabric: error: no such option: --daemonize

This happening because the options are defined upon the optional parameters found in the command's execute or dispatch methods. If the execute method exists, its optional parameters are used. Otherwise, the optional parameters in the dispatch method are used.

The daemonize is broken because an execute method was introduced in the Command class which is inherited by the other commands and thus any dispatch method is ignored.

This changed was introduced by the following patch:

revno: 227 [merge]
committer: Alfranio Correia <alfranio.correia@oracle.com>
branch nick: mysql-hub
timestamp: Mon 2014-04-14 19:25:34 +0100
message:
  merge mysql-hub-1.4 ---> mysql-hub-trunk
    ------------------------------------------------------------
    revno: 222.1.3
    committer: Alfranio Correia <alfranio.correia@oracle.com>
    branch nick: 1.4
    timestamp: Mon 2014-04-14 19:21:45 +0100
    message:
      Post-push fix for WL#7455 and BUG#71441:BUG#18109040.
      
      Fixed high pylint warnings introduced in the context
      of the aforementioned work.

How to repeat:
$mysqlfabric manage start --daemonize
mysqlfabric: error: no such option: --daemonize

Suggested fix:
=== modified file 'lib/mysql/fabric/command.py'
--- lib/mysql/fabric/command.py revid:v.narayanan@oracle.com-20140513100145-umm08s6e4i24hxnz
+++ lib/mysql/fabric/command.py 2014-05-30 14:49:49 +0000
@@ -392,12 +383,6 @@
         status = self.client.dispatch(self, *args)
         return self.command_status(status)

-    def execute(self):
-        """Any command derived from this class must redefine this
-        method.
-        """
-        raise _errors.ProgrammingError("The execute method is not defined.")
-
     @staticmethod
     def command_status(status, details=False):
         """Present the result reported by a command in a friendly-user way.
[30 May 2014 18:17] Martin Arrieta
Maybe the problem is that the option --daemonize is not defined .. 

Here is another possible fix:

$ bzr diff
=== modified file 'lib/mysql/fabric/services/manage.py'
--- lib/mysql/fabric/services/manage.py	2014-05-12 14:36:08 +0000
+++ lib/mysql/fabric/services/manage.py	2014-05-30 18:10:33 +0000
@@ -116,6 +116,13 @@
     """
     group_name = "manage"
     command_name = "start"
+
+    command_options =[{
+        'options': ["--daemonize"],
+        'dest': 'daemonize',
+        'default': False,
+        'action': "store_true"
+    }]

     def dispatch(self, daemonize=False):
         """Start the Fabric server.

Regards, 

Martin.
[30 May 2014 18:54] Alfranio Junior
Posted by developer:
 
Hi Martin,

I agree with you. In this case, I think it is better to have the options
explicitly defined in some cases rather than relying on this automatic
solution.

The suggested fix is good. I will use it.

Thx.
[14 Jul 2014 23:20] Philip Olson
Fixed as of the upcoming MySQL Utilities/Fabric 1.4.4 release, and here's the changelog entry:

In fabric, the "--daemonize" parameter was not recognized when passed in
with "manage start".

Thank you for the bug report.