def perspective_persist(self, profile='jcli-prod', scope='all'):
        try:
            if scope in ['all', 'groups']:
                # Persist groups configuration
                path = '%s/%s.router-groups' % (self.config.store_path, profile)
                self.log.info('Persisting current Groups configuration to [%s] profile in %s',
                              profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.groups, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['groups'] = True

            if scope in ['all', 'users']:
                # Persist users configuration
                path = '%s/%s.router-users' % (self.config.store_path, profile)
                self.log.info('Persisting current Users configuration to [%s] profile in %s',
                              profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.users, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['users'] = True
                for u in self.users:
                    u.mt_credential.quotas_updated = False

            if scope in ['all', 'moroutes']:
                # Persist moroutes configuration
                path = '%s/%s.router-moroutes' % (self.config.store_path, profile)
                self.log.info('Persisting current MORoutingTable to [%s] profile in %s', profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.mo_routing_table, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['moroutes'] = True

            if scope in ['all', 'mtroutes']:
                # Persist mtroutes configuration
                path = '%s/%s.router-mtroutes' % (self.config.store_path, profile)
                self.log.info('Persisting current MTRoutingTable to [%s] profile in %s', profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.mt_routing_table, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['mtroutes'] = True

            if scope in ['all', 'mointerceptors']:
                # Persist mointerceptors configuration
                path = '%s/%s.router-mointerceptors' % (self.config.store_path, profile)
                self.log.info('Persisting current MOInterceptionTable to [%s] profile in %s',
                              profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.mo_interception_table, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['mointerceptors'] = True

            if scope in ['all', 'mtinterceptors']:
                # Persist mtinterceptors configuration
                path = '%s/%s.router-mtinterceptors' % (self.config.store_path, profile)
                self.log.info('Persisting current MTInterceptionTable to [%s] profile in %s',
                              profile, path)

                fh = open(path, 'w')
                # Write configuration with datetime stamp
                fh.write('Persisted on %s [Jasmin %s]\n' % (time.strftime("%c"), jasmin.get_release()))
                fh.write(pickle.dumps(self.mt_interception_table, self.pickleProtocol))
                fh.close()

                # Set persistance state to True
                self.persistenceState['mtinterceptors'] = True

        except __HOLE__:
            self.log.error('Cannot persist to %s', path)
            return False
        except Exception, e:
            self.log.error('Unknown error occurred while persisting configuration: %s', e)
            return False

        return True
dataset/ETHPy150Open jookies/jasmin/jasmin/routing/router.py/RouterPB.perspective_persist