0001-BUGFIX.patch

Taizo ITO, 03/01/2010 12:46 PM

Download (4.1 KB)

 
b/karesansui/gadget/tree.py
36 36
    def _GET(self, *param, **params):
37 37
        models = findbyhostall(self.orm)
38 38
        uris = available_virt_uris()
39

  
40
        try:
41
            conf = env.get('KARESANSUI_CONF')
42
            _K2V = K2V(conf)
43
            config = _K2V.read()
44
        except (IOError, KaresansuiGadgetException):
45
            raise KaresansuiGadgetException
46

  
47
        self.view.application_uniqkey = config['application.uniqkey']
48

  
49
        #import pdb; pdb.set_trace()
50
        from karesansui.lib.file.configfile import LighttpdPortConf
51
        from karesansui.lib.const import LIGHTTPD_PORT_CONFIG
52
        try:
53
            conf_file = config['lighttpd.etc.dir'] + '/' + LIGHTTPD_PORT_CONFIG
54
            port_number = int(LighttpdPortConf(conf_file).read())
55
        except:
56
            port_number = 443
57

  
39 58
        try:
40 59
            hosts = []
41 60
            for model in models:
......
48 67
                self.kvc = KaresansuiVirtConnection(uri)
49 68
                host = MergeHost(self.kvc, model)
50 69
                host.info['model'].is_ssl = is_ssl(host.info['model'].hostname)
70
                #host.info['model'].is_ssl = is_ssl(host.info['model'].hostname,port_number)
71
                host.info['model'].port_number = port_number
51 72
                hosts.append(host)
52 73

  
53 74
            self.view.machines = hosts
......
55 76
            self.kvc.close()
56 77
            raise KaresansuiGadgetException
57 78

  
58
        try:
59
            conf = env.get('KARESANSUI_CONF')
60
            _K2V = K2V(conf)
61
            config = _K2V.read()
62
        except (IOError, KaresansuiGadgetException):
63
            raise KaresansuiGadgetException
64

  
65
        self.view.application_uniqkey = config['application.uniqkey']
66

  
67 79
        return True
68 80

  
69 81
urls = (
b/karesansui/templates/default/tree/tree.part
58 58
host_id = host.info['model'].id
59 59
host_name = host.info['model'].name
60 60

  
61
port_number = ""
61 62
if host.info['model'].is_ssl:
62 63
    protocol = "https://"
63 64
else:
64 65
    protocol = "http://"
66
    if host.info['model'].port_number != 80:
67
      port_number = ":%d" % host.info['model'].port_number
65 68

  
66
host_uri = "%s%s/karesansui/v1/host/%s" % \
67
    (protocol, host.info['model'].hostname, host.info['model'].id)
69
host_uri = "%s%s%s/karesansui/v1/host/%s" % \
70
    (protocol, host.info['model'].hostname, port_number, host.info['model'].id)
68 71
%>
69 72
                        <li>
70 73
        % if host.info['model'].uniq_key == application_uniqkey:
......
88 91
guest_id = guest.info['model'].id
89 92
guest_name = guest.info['model'].name
90 93
guest_status = guest.info['virt'].status()
91
guest_uri = "%s%s/karesansui/v1/host/%s/guest/%s" % \
92
    (protocol, host.info['model'].hostname, host.info['model'].id, guest.info['model'].id)
94
guest_uri = "%s%s%s/karesansui/v1/host/%s/guest/%s" % \
95
    (protocol, host.info['model'].hostname, port_number, host.info['model'].id, guest.info['model'].id)
93 96
%>
94 97
                                <div id="tree-guest${guest_id}" class="tmtree-l2">
95 98
                                    <div class="tree-left">
96
-