MCPcopy
hub / github.com/saltstack/salt / update_module

Method update_module

tests/unit/test_loader.py:788–798  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

786 del cls.opts
787
788 def update_module(self):
789 with salt.utils.files.fopen(self.module_path, "wb") as fh:
790 fh.write(salt.utils.stringutils.to_bytes(virtual_alias_module_template))
791 fh.flush()
792 os.fsync(fh.fileno()) # flush to disk
793
794 # pyc files don't like it when we change the original quickly
795 # since the header bytes only contain the timestamp (granularity of seconds)
796 # TODO: don't write them? Is *much* slower on re-load (~3x)
797 # https://docs.python.org/2/library/sys.html#sys.dont_write_bytecode
798 remove_bytecode(self.module_path)
799
800 @property
801 def module_path(self):

Callers 1

test_virtual_aliasMethod · 0.95

Calls 4

remove_bytecodeFunction · 0.85
writeMethod · 0.45
flushMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected