Debian Codegraph @

test/integration/targets/ansible-vault/faux-editor.py

raw ◀ ▶
1 Debian patch touch this file
•1 #!/usr/bin/env python3
2 #
3 # Ansible is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # Ansible is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
15 #
16 # ansible-vault is a script that encrypts/decrypts YAML files. See
17 # https://docs.ansible.com/ansible/latest/user_guide/vault.html for more details.
18
19 from __future__ import annotations
20
21 import sys
22 import time
23 import os
24
25
26 def main(args):
27 path = os.path.abspath(args[1])
28
29 fo = open(path, 'r+')
30
31 content = fo.readlines()
32
33 content.append('faux editor added at %s\n' % time.time())
34
35 fo.seek(0)
36 fo.write(''.join(content))
37 fo.close()
38
39 return 0
40
41
42 if __name__ == '__main__':
43 sys.exit(main(sys.argv[:]))