Refactor url build in wwclient with url.URL
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
040fdd8c45
commit
73c70da4ef
@@ -61,6 +61,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- `wwctl conatiner list --kernel` shows the kernel detected for each container. #1283
|
||||
- `wwctl container list --size` shows the uncompressed size of each container. `--compressed` shows the compressed size, and `--chroot` shows the size of the container source on the server. #954, #1117
|
||||
- Add a logrotate config for `warewulfd.log`. #1311
|
||||
### Changed
|
||||
|
||||
- Refactor URL handling in wwclient to consistently escape arguments.
|
||||
|
||||
## v4.5.6, unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||
if tag == "Unknown" {
|
||||
dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output()
|
||||
if err == nil {
|
||||
chassisAssetTag := url.QueryEscape(strings.TrimSpace(string(dmiOut)))
|
||||
chassisAssetTag := strings.TrimSpace(string(dmiOut))
|
||||
if chassisAssetTag != "" {
|
||||
tag = chassisAssetTag
|
||||
}
|
||||
@@ -221,9 +221,19 @@ func updateSystem(ipaddr string, port int, wwid string, tag string, localUUID uu
|
||||
counter := 0
|
||||
for {
|
||||
var err error
|
||||
getString := fmt.Sprintf("http://%s:%d/provision/%s?assetkey=%s&uuid=%s&stage=runtime&compress=gz", ipaddr, port, wwid, tag, localUUID)
|
||||
wwlog.Debug("Making request: %s", getString)
|
||||
resp, err = Webclient.Get(getString)
|
||||
values := &url.Values{}
|
||||
values.Set("assetkey", tag)
|
||||
values.Set("uuid", localUUID.String())
|
||||
values.Set("stage", "runtime")
|
||||
values.Set("compress", "gz")
|
||||
getURL := &url.URL{
|
||||
Scheme: "http",
|
||||
Host: fmt.Sprintf("%s:%d", ipaddr, port),
|
||||
Path: fmt.Sprintf("provision/%s", wwid),
|
||||
RawQuery: values.Encode(),
|
||||
}
|
||||
wwlog.Debug("Making request: %s", getURL)
|
||||
resp, err = Webclient.Get(getURL.String())
|
||||
if err == nil {
|
||||
break
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user