(self)
| 884 | del cls.opts |
| 885 | |
| 886 | def update_module(self): |
| 887 | self.count += 1 |
| 888 | with salt.utils.files.fopen(self.module_path, "wb") as fh: |
| 889 | fh.write( |
| 890 | salt.utils.stringutils.to_bytes( |
| 891 | submodule_template.format(self.module_name, count=self.count) |
| 892 | ) |
| 893 | ) |
| 894 | fh.flush() |
| 895 | os.fsync(fh.fileno()) # flush to disk |
| 896 | |
| 897 | # pyc files don't like it when we change the original quickly |
| 898 | # since the header bytes only contain the timestamp (granularity of seconds) |
| 899 | # TODO: don't write them? Is *much* slower on re-load (~3x) |
| 900 | # https://docs.python.org/2/library/sys.html#sys.dont_write_bytecode |
| 901 | remove_bytecode(self.module_path) |
| 902 | |
| 903 | def rm_module(self): |
| 904 | os.unlink(self.module_path) |
no test coverage detected