Beispiel #1
0
    def testWriteServicesRecordFile(self):
        file_path = os.path.join(os.path.dirname(__file__), "data/services-out.xml")
        services = [Service(name="foo"), Service(name="baz")]

        service_record_file = ServicesRecordFile(file_path)
        service_record_file.write(services)
        contents = FileManager.read_file(file_path)

        self.assertEqual("<services><service>foo</service><service>baz</service></services>", contents)
        os.remove(file_path)
Beispiel #2
0
    def testWriteServicesRecordFile(self):
        file_path = os.path.join(os.path.dirname(__file__), "data/services-out.xml")
        services  = [Service(name='foo'),
                     Service(name='baz')]

        service_record_file = ServicesRecordFile(file_path)
        service_record_file.write(services)
        contents = FileManager.read_file(file_path)

        self.assertEqual("<services><service>foo</service><service>baz</service></services>", contents)
        os.remove(file_path)
Beispiel #3
0
    def backup(self, basedir, include=[], exclude=[]):
        """run backup on each of the services included"""
        services = []

        for service in include:
            if snap.config.options.log_level_at_least('verbose'):
                snap.callback.snapcallback.message("Backing up service " + service);
            service_instance = self.load_service(service)
            # check if service is running / available on machine b4 backing up
            if service_instance.is_available():
                sservice = service_instance.backup(basedir)
                services.append(Service(name=service))

        record = ServicesRecordFile(basedir + "/services.xml")
        record.write(services)
Beispiel #4
0
    def backup(self, basedir, include=[], exclude=[]):
        """run backup on each of the services included"""
        services = []

        for service in include:
            if snap.config.options.log_level_at_least('verbose'):
                snap.callback.snapcallback.message("Backing up service " +
                                                   service)
            service_instance = self.load_service(service)
            # check if service is running / available on machine b4 backing up
            if service_instance.is_available():
                sservice = service_instance.backup(basedir)
                services.append(Service(name=service))

        record = ServicesRecordFile(basedir + "/services.xml")
        record.write(services)