~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/lxc/lxd/lxd/daemon.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        "io"
13
13
        "net"
14
14
        "net/http"
 
15
        "net/url"
15
16
        "os"
16
17
        "os/exec"
17
18
        "runtime"
94
95
        imagesDownloadingLock sync.RWMutex
95
96
 
96
97
        tlsConfig *tls.Config
 
98
 
 
99
        proxy func(req *http.Request) (*url.URL, error)
97
100
}
98
101
 
99
102
// Command is the basic structure for every API call.
107
110
        delete        func(d *Daemon, r *http.Request) Response
108
111
}
109
112
 
 
113
func (d *Daemon) updateProxy() {
 
114
        d.proxy = shared.ProxyFromConfig(
 
115
                d.configValues["core.proxy_https"],
 
116
                d.configValues["core.proxy_http"],
 
117
                d.configValues["core.proxy_ignore_hosts"],
 
118
        )
 
119
}
 
120
 
110
121
func (d *Daemon) httpGetSync(url string, certificate string) (*lxd.Response, error) {
111
122
        var err error
112
123
 
128
139
        tr := &http.Transport{
129
140
                TLSClientConfig: tlsConfig,
130
141
                Dial:            shared.RFC3493Dialer,
131
 
                Proxy:           http.ProxyFromEnvironment,
 
142
                Proxy:           d.proxy,
132
143
        }
133
144
 
134
145
        myhttp := http.Client{
180
191
        tr := &http.Transport{
181
192
                TLSClientConfig: tlsConfig,
182
193
                Dial:            shared.RFC3493Dialer,
183
 
                Proxy:           http.ProxyFromEnvironment,
 
194
                Proxy:           d.proxy,
184
195
        }
185
196
        myhttp := http.Client{
186
197
                Transport: tr,
830
841
                }
831
842
        }()
832
843
 
 
844
        /* Load all config values from the database */
 
845
        _, err = d.ConfigValuesGet()
 
846
        if err != nil {
 
847
                return err
 
848
        }
 
849
 
 
850
        /* set the initial proxy function based on config values in the DB */
 
851
        d.updateProxy()
 
852
 
833
853
        /* Auto-update images */
834
854
        d.resetAutoUpdateChan = make(chan bool)
835
855
        go func() {
1142
1162
                return true
1143
1163
        case "core.https_allowed_headers":
1144
1164
                return true
 
1165
        case "core.proxy_https":
 
1166
                return true
 
1167
        case "core.proxy_http":
 
1168
                return true
 
1169
        case "core.proxy_ignore_hosts":
 
1170
                return true
1145
1171
        case "core.trust_password":
1146
1172
                return true
1147
1173
        case "storage.lvm_vg_name":