Revision 613532643934 () - Diff

Link to this snippet: https://friendpaste.com/31BqBSiH9IeUuL5S4Dyq8Z
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
env_user = "toto"

def function(use_sudo=False):
run('mycommand', use_sudo)

def function2(use_sudo=False):
run('mycommand', use_sudo)


if env_user != "root": use_sudo = True

function(use_sudo)

function2(use_sudo)


# INSTEAD OF:


def function():
if env_user == "root":
run('mycommand')
else:
sudo('mycommand')


def function2():
if env_user == "root":
run('mycommand')
else:
sudo('mycommand')

function()

function2()