Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

#!/usr/bin/env python3 

"""Actions module.""" 

 

import os 

import sys 

 

from charmhelpers.core import hookenv 

 

from lib_cron import CronHelper 

 

from lib_logrotate import LogrotateHelper 

 

sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib')) 

 

hooks = hookenv.Hooks() 

logrotate = LogrotateHelper() 

cron = CronHelper() 

 

 

@hooks.hook("update-logrotate-files") 

def update_logrotate_files(): 

"""Update the logrotate files.""" 

logrotate.read_config() 

logrotate.modify_configs() 

 

 

@hooks.hook("update-cronjob") 

def update_cronjob(): 

"""Update the cronjob file.""" 

cron.read_config() 

cron.install_cronjob() 

 

 

if __name__ == "__main__": 

"""Main function.""" 

hooks.execute(sys.argv)