Esempio n. 1
0
    def _status_config(self):
        status_config_path = get_status_config_path(self.config)
        if not exists(status_config_path):
            write_status_config(status_config_path)

        parser = ConfigParser()
        with open(status_config_path) as f:
            parser.readfp(f)
        return parser
Esempio n. 2
0
    def _status_config(self):
        status_config_path = get_status_config_path(self.config)
        if not exists(status_config_path):
            write_status_config(status_config_path)

        parser = ConfigParser()
        with open(status_config_path) as f:
            parser.readfp(f)
        return parser
Esempio n. 3
0
    def _set_status(self, new_status):
        new_status = new_status.upper()
        if not new_status in self.states:
            raise ValueError("Invalid state '%s'." % new_status)

        status_config = self._status_config()

        if not status_config.has_section(STATUS_SECTION):
            status_config.add_section(STATUS_SECTION)
        status_config.set(STATUS_SECTION, "state", new_status)
        write_status_config(get_status_config_path(self.config), status_config)
Esempio n. 4
0
    def _set_status(self, new_status):
        new_status = new_status.upper()
        if not new_status in self.states:
            raise ValueError("Invalid state '%s'." % new_status)

        status_config = self._status_config()

        if not status_config.has_section(STATUS_SECTION):
            status_config.add_section(STATUS_SECTION)
        status_config.set(STATUS_SECTION, "state", new_status)
        write_status_config(get_status_config_path(self.config), status_config)