Skip to content

Commit

Permalink
Update to fix manager empty secrets bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jomann09 committed Feb 15, 2024
1 parent 82437b4 commit d050bb6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
./config.yml
./config.yaml
config.yml
build/bin/*
site
etc
build/rcagent.spec
build/package/config.yml
site
rcagent.pem
rcagent.key
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
02/14/2024 - 1.1.1
==================
- Fixed issue where empty secrets causes configs to re-apply every checkin

02/12/2024 - 1.1.0
==================
- Added integration with ReChecked Manager (https://rechecked.io/rechecked-manager/)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
6 changes: 3 additions & 3 deletions docs/status-api/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Parameter | Default | Description

```
{
"version": "1.1.0"
"version": "1.1.1"
}
```

Expand All @@ -154,7 +154,7 @@ Parameter | Default | Description
```
{
"exitcode": 0,
"output": "OK - rcagent version is 1.1.0",
"output": "OK - rcagent version is 1.1.1",
"perfdata": "",
"longoutput": ""
}
Expand All @@ -163,5 +163,5 @@ Parameter | Default | Description
=== "Plugin"

```
OK - rcagent version is 1.1.0
OK - rcagent version is 1.1.1
```
20 changes: 11 additions & 9 deletions internal/manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ func updateSecrets() bool {
f := config.GetConfigDirFilePath("manager/secrets.json")

// If there are no secrets then return now and don't add a secrets file
if len(json) == 0 {
os.Remove(f)
return true
}
if len(json) > 0 {

// Make sure the directory exists
os.MkdirAll(config.GetConfigDirFilePath("manager"), 0755)
// Make sure the directory exists
os.MkdirAll(config.GetConfigDirFilePath("manager"), 0755)

if err := os.WriteFile(f, json, 0600); err != nil {
config.Log.Error(err)
return false
if err := os.WriteFile(f, json, 0600); err != nil {
config.Log.Error(err)
return false
}

} else {
// Remove secrets file if it should be empty
os.Remove(f)
}

data := map[string]string{
Expand Down
14 changes: 7 additions & 7 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"FixedFileInfo": {
"FileVersion": {
"Major": 1,
"Minor": 0,
"Patch": 4,
"Minor": 1,
"Patch": 1,
"Build": 0
},
"ProductVersion": {
"Major": 1,
"Minor": 0,
"Patch": 4,
"Minor": 1,
"Patch": 1,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "ReChecked",
"FileDescription": "ReChecked system status and monitoring agent.",
"FileVersion": "v1.1.0.0",
"FileVersion": "v1.1.1.0",
"InternalName": "rcagent.exe",
"LegalCopyright": "(c) 2023 ReChecked",
"LegalCopyright": "(c) 2024 ReChecked",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "ReChecked Agent",
"ProductVersion": "v1.1.0.0",
"ProductVersion": "v1.1.1.0",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit d050bb6

Please sign in to comment.