Skip to content

Commit 6b9ddf6

Browse files
committed
lxc features properties are now pointers
1 parent e6cd3f7 commit 6b9ddf6

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [v0.6.1]
11+
### PVE API client
12+
#### Fixed
13+
- Fixed app version.
14+
- LXC features properties are now pointes.
15+
1016
## [v0.6.0]
1117
### PVE API wrapper
1218
#### Added
@@ -117,9 +123,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
117123
- Proxmox api token credentials support.
118124
- Proxmox api version endpoint.
119125

120-
[unreleased]: https://github.com/iolave/go-proxmox/compare/v0.6.0...staging
126+
[unreleased]: https://github.com/iolave/go-proxmox/compare/v0.6.1...staging
127+
[v0.6.0]: https://github.com/iolave/go-proxmox/releases/tag/v0.6.1
121128
[v0.6.0]: https://github.com/iolave/go-proxmox/releases/tag/v0.6.0
122-
[v0.5.1]: https://github.com/iolave/go-proxmox/releases/tag/v0.5.1
123129
[v0.5.0]: https://github.com/iolave/go-proxmox/releases/tag/v0.5.0
124130
[v0.4.0]: https://github.com/iolave/go-proxmox/releases/tag/v0.4.0
125131
[v0.3.0]: https://github.com/iolave/go-proxmox/releases/tag/v0.3.0

internal/server/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
const (
99
NAME = "pve-api-wrapper"
1010
// TODO: read and implement this https://akrabat.com/setting-the-version-of-a-go-application-when-building/
11-
VERSION = "v0.5.1"
11+
VERSION = "v0.6.1"
1212
)
1313

1414
type App struct {

pkg/pve/pve_lxc.go

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,31 +125,42 @@ func (n *LxcNet) String() string {
125125
// TODO: Add mount support
126126
// mount
127127
type LXCFeatures struct {
128-
ForceRWSys bool
129-
Fuse bool
130-
KeyCTL bool
131-
MKNod bool
132-
Nesting bool
128+
ForceRWSys *bool
129+
Fuse *bool
130+
KeyCTL *bool
131+
MKNod *bool
132+
Nesting *bool
133133
// TODO: Mount
134134
}
135135

136136
func (f *LXCFeatures) String() string {
137137
s := ""
138138
var intbool int
139-
intbool = helpers.BoolToInt(f.ForceRWSys)
140-
s = fmt.Sprintf("%s,force_rw_sys=%d", s, intbool)
141139

142-
intbool = helpers.BoolToInt(f.Fuse)
143-
s = fmt.Sprintf("%s,fuse=%d", s, intbool)
140+
if f.ForceRWSys != nil {
141+
intbool = helpers.BoolToInt(*f.ForceRWSys)
142+
s = fmt.Sprintf("%s,force_rw_sys=%d", s, intbool)
143+
}
144144

145-
intbool = helpers.BoolToInt(f.KeyCTL)
146-
s = fmt.Sprintf("%s,keyctl=%d", s, intbool)
145+
if f.Fuse != nil {
146+
intbool = helpers.BoolToInt(*f.Fuse)
147+
s = fmt.Sprintf("%s,fuse=%d", s, intbool)
148+
}
147149

148-
intbool = helpers.BoolToInt(f.MKNod)
149-
s = fmt.Sprintf("%s,mknod=%d", s, intbool)
150+
if f.KeyCTL != nil {
151+
intbool = helpers.BoolToInt(*f.KeyCTL)
152+
s = fmt.Sprintf("%s,keyctl=%d", s, intbool)
153+
}
150154

151-
intbool = helpers.BoolToInt(f.Nesting)
152-
s = fmt.Sprintf("%s,nesting=%d", s, intbool)
155+
if f.MKNod != nil {
156+
intbool = helpers.BoolToInt(*f.MKNod)
157+
s = fmt.Sprintf("%s,mknod=%d", s, intbool)
158+
}
159+
160+
if f.Nesting != nil {
161+
intbool = helpers.BoolToInt(*f.Nesting)
162+
s = fmt.Sprintf("%s,nesting=%d", s, intbool)
163+
}
153164

154165
return s
155166
}
@@ -641,4 +652,3 @@ func (s *PVELxcService) GetInterfaceByName(node string, id int, name string) (re
641652
}
642653
return res, fmt.Errorf("vmid '%d' or interface '%s' not found", id, name)
643654
}
644-

0 commit comments

Comments
 (0)