cloud registration doesn't work if there's no user-data

Bug #344323 reported by Christopher Armstrong
2
Affects Status Importance Assigned to Milestone
Landscape Client
Fix Released
Medium
Christopher Armstrong
Landscape Server
Fix Released
Medium
Christopher Armstrong
landscape-client (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The case where the client is put into cloud mode manually (and an account_name and registration_password are specified) is broken: user-data is a 404 when it's not actually specified, and this causes us to fail to fetch the *rest* of the necessary cloud data, since a change which was recently made causes 404 fetches to raise exceptions instead of returning the content.

Here's what happens:

ubuntu@ip-10-250-159-210:~$ sudo tail -F /var/log/landscape/broker.log
2009-03-17 11:28:02,029 INFO [MainThread] Message exchange completed in 1.42s.
2009-03-17 11:28:34,838 INFO [MainThread] Broker stopped on 'system' bus with config /etc/landscape/client.conf
2009-03-17 11:28:35,461 INFO [MainThread] Broker started on 'system' bus with config /etc/landscape/client.conf
2009-03-17 11:28:35,492 ERROR [MainThread] Got error while fetching meta-data: <HTTPCodeError http_code=404>
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/twisted/internet/threads.py", line 24, in _putResultInDeferred
    result = f(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/landscape/lib/fetch.py", line 64, in fetch
    raise HTTPCodeError(http_code, body)
HTTPCodeError: Server returned HTTP code 404
2009-03-17 11:29:35,468 INFO [MainThread] Queueing message to register with account 'christopher.armstrong' as an EC2 instance.
2009-03-17 11:29:35,468 ERROR [MainThread] Error running event handler landscape.broker.registration.RegistrationHandler._handle_pre_exchange() for event type 'pre-exchange' with args () {}.
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/landscape/reactor.py", line 54, in fire
    results.append(handler(*args, **kwargs))
  File "/usr/lib/python2.5/site-packages/landscape/broker/registration.py", line 229, in _handle_pre_exchange
    message.update(self._ec2_data)
AttributeError: 'RegistrationHandler' object has no attribute '_ec2_data'
2009-03-17 11:29:35,470 INFO [MainThread] Starting urgent message exchange with https://staging.landscape.canonical.com/message-system.
2009-03-17 11:29:36,990 INFO [Dummy-1 ] Sent 488 bytes and received 70 bytes in 1.52s.
2009-03-17 11:29:36,994 INFO [MainThread] Switching to normal exchange mode.

First it's getting that 404, which causes it to not create the _ec2_data attribute, and then later when actually trying to send the register-cloud-vm message it blows up because that attribute isn't there.

Changed in landscape:
milestone: none → mountainview-pre-7
Thomas Herve (therve)
Changed in landscape-client:
assignee: nobody → radix
importance: Undecided → Medium
status: New → In Progress
Changed in landscape:
assignee: nobody → radix
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Thomas Herve (therve) wrote :

Here we go!

[1]
- # Mock registration-failed call
+ # Mock registration-failed call. why? I don't know.
         reactor_mock = self.mocker.patch(self.reactor)
         reactor_mock.fire("registration-failed")
         self.mocker.replay()

You created a docstring, so I suppose you know now?

The rest is great, +1.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

[1]

- # Mock registration-failed call
+ # Mock registration-failed call. why? I don't know.
         reactor_mock = self.mocker.patch(self.reactor)
         reactor_mock.fire("registration-failed")

This is apparently the only place where that registration-failed which you fire in the "else" case. If you comment this mocking, the tests pass without firing the event.

+1!

Revision history for this message
Christopher Armstrong (radix) wrote :

Thanks guys. I resolved your #1s by rewriting the code to not use mocker.

Merged!

Changed in landscape:
status: In Progress → Fix Committed
Changed in landscape-client:
status: In Progress → Fix Committed
Changed in landscape:
milestone: mountainview-pre-7 → mountainview-pre-8
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package landscape-client - 1.0.28-0ubuntu1.9.04.0

---------------
landscape-client (1.0.28-0ubuntu1.9.04.0) jaunty; urgency=low

  * Fix minor packaging issues in last release (LP: #343954)
    - Version number in landscape.VERSION is now correct
    - Fixed package version number to maintain convention
  * The following changes are in the 1.0.28 release:
    - Invalidate package cache when server UUID changes (LP: #339948)
    - Improve the "cloud mode" introduced in 1.0.26 to send more
      disambiguation data (LP: #343942) and allow the EC2 user data to specify
      the exchange and ping URLs (LP: #343947)
    - Allow importing of initial configurations (along with public SSL
      certificates) when running landscape-config (LP: #341705)
    - Support a non-root mode which allows running the client without the
      management functionality (LP: #82159)
    - Automatic cloud registration when there's no user-data to specify an OTP
      now works (LP: #344323)

 -- Christopher Armstrong <email address hidden> Thu, 19 Mar 2009 09:52:03 -0400

Changed in landscape-client:
status: New → Fix Released
Changed in landscape:
status: Fix Committed → Fix Released
Changed in landscape:
milestone: mountainview-pre-8 → mountainview
status: Fix Released → Fix Committed
Changed in landscape:
status: Fix Committed → Fix Released
Changed in landscape-client:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.