def test_get_cloudinitd_service(self):
        from epumgmt.defaults.cloudinitd_load import get_cloudinitd_service

        try:
            get_cloudinitd_service(None, None)
        except ProgrammingError:
            no_cloudinitd_programming_error = True

        assert no_cloudinitd_programming_error

        try:
            get_cloudinitd_service(self.cloudinitd, None)
        except ProgrammingError:
            no_service_name_programming_error = True

        assert no_service_name_programming_error

        nonexistant_svc = "notreal"

        try:
            service = get_cloudinitd_service(self.cloudinitd, nonexistant_svc)
        except IncompatibleEnvironment:
            no_service_incompatible_env = True

        assert no_service_incompatible_env
Beispiel #2
0
 def _find_controllers_from_svc(self, service_type):
     """Return a list of service contact addresses for all the EPU controllers in this
     cloudinit.d "svc" that was launched.
     """
     svc = get_cloudinitd_service(self.cloudinitd, service_type)
     allkeys = svc.get_keys_from_bag()
     controllers = []
     for key in allkeys:
         if key.startswith(self.controller_prefix):
             controllers.append(svc.get_attr_from_bag(key))
     return controllers