mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
A check in order not to update twice
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
50dd136e9a
commit
808a1bc277
1 changed files with 12 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
THIS_FILE = pathlib.Path(__file__).resolve()
|
||||
CODE_ROOT = THIS_FILE.parent.parent.parent.parent
|
||||
|
@ -9,6 +10,9 @@ README_PATH = CODE_ROOT / "README.rst"
|
|||
|
||||
def main(version, sha256sum):
|
||||
in_contents = README_PATH.read_text()
|
||||
if version in in_contents:
|
||||
print(f"README file already contains an entry for version {version}")
|
||||
sys.exit(1)
|
||||
out_contents = ""
|
||||
found_anchor = False
|
||||
updated_version = False
|
||||
|
@ -32,6 +36,14 @@ def main(version, sha256sum):
|
|||
if in_contents != out_contents:
|
||||
README_PATH.write_text(out_contents)
|
||||
|
||||
ret = subprocess.run(
|
||||
["git", "diff", "--stat"], universal_newlines=True, capture_output=True
|
||||
)
|
||||
if "1 file changed, 1 insertion(+)" not in ret.stdout:
|
||||
print("Too Many Changes to the readme file")
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
|
|
Loading…
Add table
Reference in a new issue