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#!/usr/bin/python 

2# website-relation-joined - Set the hostname into remote nagios http consumers 

3# Copyright Canonical 2017 Canonical Ltd. All Rights Reserved 

4# 

5# This program is free software: you can redistribute it and/or modify 

6# it under the terms of the GNU General Public License as published by 

7# the Free Software Foundation, either version 3 of the License, or 

8# (at your option) any later version. 

9# 

10# This program is distributed in the hope that it will be useful, 

11# but WITHOUT ANY WARRANTY; without even the implied warranty of 

12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

13# GNU General Public License for more details. 

14# 

15# You should have received a copy of the GNU General Public License 

16# along with this program. If not, see <http://www.gnu.org/licenses/>. 

17 

18import common 

19 

20from charmhelpers.core.hookenv import config, log, relation_set 

21 

22 

23def main(): 

24 relation_data = {"hostname": common.get_local_ingress_address()} 

25 sslcfg = config()["ssl"] 

26 if sslcfg == "only": 

27 relation_data["port"] = 443 

28 else: 

29 relation_data["port"] = 80 

30 log("website-relation-joined data %s" % relation_data) 

31 relation_set(None, **relation_data) 

32 

33 

34if __name__ == "__main__": # pragma: no cover 

35 main()