← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/remove-use-real-pserv into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/remove-use-real-pserv into lp:maas with lp:~jtv/maas/kill-pserv-api as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/remove-use-real-pserv/+merge/119858

Raphaël pointed to this one as something that still needed removing.  The fun about these big code removals is that you can pick any starting point and see what else comes along.  I'm sure we'll have a period of o-ho moments where we realize some other variable, method, or class is no longer needed.

More yet to come.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/remove-use-real-pserv/+merge/119858
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/remove-use-real-pserv into lp:maas.
=== modified file 'HACKING.txt'
--- HACKING.txt	2012-08-06 09:43:11 +0000
+++ HACKING.txt	2012-08-16 08:27:19 +0000
@@ -104,19 +104,6 @@
 .. _nose: http://readthedocs.org/docs/nose/en/latest/
 
 
-Running tests with a real Cobbler
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Once you have a Cobbler instance running somewhere there are some
-tests that can be run against it::
-
-    $ PSERV_TEST_COBBLER_URL=http://user:pass@localhost/cobbler_api \
-        bin/test.pserv provisioningserver.tests.test_api
-
-Adjust ``PSERV_TEST_COBBLER_URL`` as necessary. **Warning:** these
-tests will modify your Cobbler database.
-
-
 Running JavaScript tests
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -226,11 +213,6 @@
 
     $ sudo htdigest /etc/cobbler/users.digest Cobbler $USER
 
-Alternatively, if you're not interested in the Provisioning Server or
-Cobbler, set ``USE_REAL_PSERV`` to ``False`` in one of ``maas``'s
-settings files (typically ``src/maas/demo.py``), and a fake Provisioning
-Server will be used instead.
-
 Run the development webserver and watch all the logs go by::
 
     $ make run

=== modified file 'contrib/maas_local_settings.py'
--- contrib/maas_local_settings.py	2012-06-29 15:52:19 +0000
+++ contrib/maas_local_settings.py	2012-08-16 08:27:19 +0000
@@ -74,6 +74,3 @@
         'HOST': 'localhost',
     }
 }
-
-# The location of the Provisioning API XML-RPC endpoint.
-PSERV_URL = "http://maas:password@localhost:5241/api";

=== modified file 'src/maas/demo.py'
--- src/maas/demo.py	2012-07-25 15:25:42 +0000
+++ src/maas/demo.py	2012-08-16 08:27:19 +0000
@@ -39,9 +39,6 @@
 # Connect to the DNS server.
 DNS_CONNECT = True
 
-# For demo purposes, use a real provisioning server.
-USE_REAL_PSERV = True
-
 MAAS_CLI = abspath("bin/maas")
 
 RABBITMQ_PUBLISH = True

=== modified file 'src/maas/development.py'
--- src/maas/development.py	2012-07-26 08:10:52 +0000
+++ src/maas/development.py	2012-08-16 08:27:19 +0000
@@ -37,9 +37,6 @@
 # cluster is running in the branch.
 TEST_RUNNER = 'maastesting.runner.TestRunner'
 
-# Use a fake provisioning server for test/demo purposes.
-USE_REAL_PSERV = False
-
 # Don't connect to the DNS server in tests, this will be enabled on a case per
 # case basis.
 DNS_CONNECT = False

=== modified file 'src/maas/settings.py'
--- src/maas/settings.py	2012-08-06 20:48:51 +0000
+++ src/maas/settings.py	2012-08-16 08:27:19 +0000
@@ -11,7 +11,6 @@
 
 __metaclass__ = type
 
-from getpass import getuser
 import os
 from urlparse import urljoin
 
@@ -279,18 +278,6 @@
     'version': 1,
 }
 
-# The location of the Provisioning API XML-RPC endpoint.  This should
-# match the setting in etc/pserv.yaml.
-PSERV_URL = "http://%s:test@localhost:5241/api"; % getuser()
-
-# Time-out for socket operations against the Provisioning API.
-PSERV_TIMEOUT = 7.0  # seconds.
-
-# Use a real provisioning server?  If yes, the URL for the provisioning
-# server's API should be set in PSERV_URL.  If this is set to False, for
-# testing or demo purposes, MAAS will use an internal fake service.
-USE_REAL_PSERV = True
-
 # The location of the commissioning script that is executed on nodes as
 # part of commissioning.  Only override this if you know what you are
 # doing.

=== modified file 'src/maasserver/provisioning.py'
--- src/maasserver/provisioning.py	2012-08-16 08:27:19 +0000
+++ src/maasserver/provisioning.py	2012-08-16 08:27:19 +0000
@@ -20,7 +20,6 @@
 from urllib import urlencode
 import xmlrpclib
 
-from django.conf import settings
 from maasserver.components import (
     COMPONENT,
     discard_persistent_error,
@@ -75,9 +74,6 @@
         """,
     8002: """
         Unable to reach provisioning server (%(fault_string)s).
-
-        Check pserv.log and your PSERV_URL setting, and restart MAAS if
-        needed.
         """,
 }
 
@@ -267,23 +263,6 @@
             return attribute
 
 
-class ProvisioningTransport(xmlrpclib.Transport):
-    """An XML-RPC transport that sets a low socket timeout."""
-
-    @property
-    def timeout(self):
-        return settings.PSERV_TIMEOUT
-
-    def make_connection(self, host):
-        """See `xmlrpclib.Transport.make_connection`.
-
-        This also sets the desired socket timeout.
-        """
-        connection = xmlrpclib.Transport.make_connection(self, host)
-        connection.timeout = self.timeout
-        return connection
-
-
 def compose_cloud_init_preseed(token):
     """Compose the preseed value for a node in any state but Commissioning."""
     credentials = urlencode({

=== modified file 'src/maasserver/tests/test_provisioning.py'
--- src/maasserver/tests/test_provisioning.py	2012-08-16 08:27:19 +0000
+++ src/maasserver/tests/test_provisioning.py	2012-08-16 08:27:19 +0000
@@ -20,7 +20,6 @@
     DETAILED_PRESENTATIONS,
     present_detailed_user_friendly_fault,
     present_user_friendly_fault,
-    ProvisioningTransport,
     SHORT_PRESENTATIONS,
     )
 from maasserver.testing.factory import factory
@@ -197,15 +196,3 @@
         self.assertIn(
             "Unknown problem encountered with the Cobbler server.",
             friendly_text)
-
-
-class TestProvisioningTransport(TestCase):
-    """Tests for :class:`ProvisioningTransport`."""
-
-    def test_make_connection(self):
-        transport = ProvisioningTransport()
-        connection = transport.make_connection("nowhere.example.com")
-        # The connection has not yet been established.
-        self.assertIsNone(connection.sock)
-        # The desired timeout has been modified.
-        self.assertEqual(transport.timeout, connection.timeout)