Post

10 Skipping the staging area

10 Skipping the staging area

Command:

1
$ vim all_checks.py

File with code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3

import os
import sys

def check_reboot():
    """Returns True if the computer has a pending reboot."""
    return os.path.exists("/run/reboot-required")

def main():
    if check_reboot():
        print("Pending Reboot.")
        sys.exit(1)

main()

Command:

1
git commit -a -m "Call check_reboot from main, exit with 1 on error"

Code output:

1
2
3
[master 033f27a] Call check_reboot from main, exit with 1 on error

 1 file changed, 4 insertions(+), 1 deletion(-)

Command:

1
git log

Code output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
commit 033f27a8196987d61c4fd42930f2148b23434a03 (HEAD -> master)

Author: My name <me@example.com>

Date:   Mon Jul 15 14:39:18 2019 +0200

    Call check_reboot from main, exit with 1 on error

commit cc1acbf10fdea6cc07ebf827697666b6a35b0f36

Author: My name <me@example.com>

Date:   Thu Jul 11 17:19:32 2019 +0200

    Add a check_reboot function

commit 6cfc29966acda8213fcd8ac2735b31f3fdbc6c53

Author: My name <me@example.com>

Date:   Thu Jul 11 12:08:46 2019 +0200

    Create and empty all_checks.py
This post is licensed under CC BY 4.0 by the author.