Revision 22a6d232 image_creator/util.py

b/image_creator/util.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
import pbs
35
from clint.textui import puts, puts_err, colored, progress
35 36

  
36 37

  
37 38
def get_command(command):
......
46 47
        return pbs.__getattr__(command)
47 48
    except pbs.CommadNotFount as e:
48 49
        return find_sbin_command(command, e)
50

  
51

  
52
def error(msg):
53
    puts_err(colored.red("Error: %s\n" % msg))
54

  
55

  
56
def warn(msg):
57
    puts_err(colored.yellow("Warning: %s" % msg))
58

  
59

  
60
def success(msg):
61
    puts(colored.green(msg))
62

  
63

  
64
def progress_generator(label='', n=100):
65
    position = 0
66
    for i in progress.bar(range(n), label):
67
        if i < position:
68
            continue
69
        position = yield
70
    yield  # suppress the StopIteration exception
71

  
72

  
73
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff