CentOS 7: Want a functional loggerhead

Kevin R. Bulgrien kevin.bulgrien at freedomcte.com
Fri Oct 9 14:45:41 UTC 2015


> -----Original Message-----
> From: Richard Wilbur [mailto:richard.wilbur at gmail.com]
> Sent: Friday, October 09, 2015 1:45 AM
> To: Kevin R. Bulgrien <kevin.bulgrien at freedomcte.com>
> Cc: bazaar <bazaar at lists.canonical.com>
> Subject: Re: CentOS 7: Want a functional loggerhead
>
> On Thu, Oct 8, 2015 at 4:20 PM, Kevin R. Bulgrien
> <kevin.bulgrien at freedomcte.com> wrote:
> >>  $ cat /etc/redhat-release && /home/app/bin/serve-branches ~/bzr/blah
> [...]
> >
> >   https://bugs.launchpad.net/loggerhead/+bug/1097567
>
> Upon reading the above bug reference, what happens if you invoke as:
>
> $ cd /home/bzr/blah && bzr serve --http
>
> (This presumes you have loggerhead linked in as a bzr plugin.)

In my present configuration:

  $ cd /home/bzr/blah
  $ bzr help commands | grep serve
  serve             Run the bzr server.
  $ export PYTHONPATH=/home/app/lib/python2.7/site-packages; bzr serve --http
  bzr: ERROR: no such option: --http

  $ bzr serve
  listening on port: 4155

  $ lynx http://127.0.0.1:4155

  errorGeneric bzr smart protocol error: bad request 'GET / HTTP/1.0\r'

Hmm, okay, I guess that means read the help...

  $ bzr serve --help
  Purpose: Run the bzr server.
  Usage:   bzr serve

  Options:
  ...
  protocol:
    --protocol=ARG      Protocol to serve.
    --bzr               The Bazaar smart server protocol over TCP. (default
                        port: 4155)

  $ bzr serve --protocol=http
  bzr: ERROR: Bad value "http" for option "protocol".

In site-packages/loggerhead/main.py...

  def main(args):
      load_plugins()
      ...
      if not config.get_option('protocol'):
          protocol = 'http'
      else:
          protocol = config.get_option('protocol')

      if protocol == 'http':
          httpserver.serve(app, host=host, port=port)
      else:
      ...

No 'Bad value "http" for option "protocol".' Message there, so I'm in
The wrong place I guess.

site-packages/bzrlib/plugins/loggerhead/__init__.py...

  ...
      def serve_http(transport, host=None, port=None, inet=None):
  ...
      if transport_server_registry is not None:
          transport_server_registry.register('http', serve_http, help=HELP)
      else:
        ...
        class cmd_serve(bzrlib.builtins.cmd_serve):
            __doc__ = _original_command.__doc__

            takes_options = _original_command.takes_options + [
                Option('http', help=HELP)]
            ...

Now I'm feeling like I'm getting over my head as I see things to handle
--http, but it isn't.  I don't know if something is going wrong related
to set `export PYTHONPATH=/home/app/lib/python2.7/site-packages;` or
not.

Uh, oh...

  $ cd /home/app/lib/python2.7/site-packages/bzrlib/plugins/loggerhead
  $ grep --after-context=1 "^bzr_compatible" info.py
  bzr_compatible_versions = [
      (1, 17, 0), (1, 18, 0), (2, 0, 0), (2, 1, 0), (2, 2, 0), (2, 3, 0)]
  $ bzr --version | head -1
  Bazaar (bzr) 2.5.1

I have to append ", (2, 5, 1)" to that value, but if I move the .pyc files
out of the way, they are never rebuilt.  Is the plugin code even running?

Oh... yes indeed, the alternate local plugin path is messing with me...

$ export PYTHONPATH='/home/app/lib/python2.7/site-packages'; \
  export 
BZR_PLUGINS_AT='loggerhead@/home/app/lib/python2.7/site-packages/bzrlib/plugins/loggerhead'; 
\
  bzr serve --http
serving on 0.0.0.0:8080 view at http://127.0.0.1:8080

$ lynx http://127.0.0.1:8080

Yes, that works, but... is that because it is using --allow-writes even
though I did not specify to do so?  See the plugin __init__.py snippet
below.  I wonder how transport.is_readonly() is set.

In responding to this query, and since I had issues, I see places where
readonly+ is prepended to the base directory:

  site-packages/loggerhead/main.py

    def get_config_and_path(args):
        ...

        if not config.get_option('allow_writes'):
            base = 'readonly+' + base

        return config, base

  site-packages/bzrlib/plugins/loggerhead/__init__.py

    ...
        if not transport.is_readonly():
            argv.insert(0, '--allow-writes')
    ...
                    if allow_writes:
                        transport = get_transport(path)
                    else:
                        transport = get_transport('readonly+' + path)
                    serve_http(transport, host, port)

---
Kevin Bulgrien






More information about the bazaar mailing list