Skip to content

Commit

Permalink
fix(dbm-services): 忽略采集windows主机的空磁盘 TencentBlueKing#6800
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq committed Sep 10, 2024
1 parent c94e463 commit f0c1ea8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/go_code_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ jobs:
name: Build and Lint
runs-on: ubuntu-20.04
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Check code
uses: actions/checkout@v4
- run: goimports -w .
- name: Run go mod tidy on all modules
run: find . -name go.mod -execdir go mod tidy \;
# If there are any diffs from goimports or go mod tidy, fail.
- name: Verify no changes from goimports and go mod tidy.
run: |
if [ -n "$(git status --porcelain)" ]; then
echo 'To fix this check, run "goimports -w . && find . -name go.mod -execdir go mod tidy \;"'
git status # Show the files that failed to pass the check.
exit 1
fi
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@v0.24.0
- name: Check code
uses: actions/checkout@v4
- run: goimports -w .
- name: Run go mod tidy on all modules
run: find . -name go.mod -execdir go mod tidy \;
# If there are any diffs from goimports or go mod tidy, fail.
- name: Verify no changes from goimports and go mod tidy.
run: |
if [ -n "$(git status --porcelain)" ]; then
echo 'To fix this check, run "goimports -w . && find . -name go.mod -execdir go mod tidy \;"'
git status # Show the files that failed to pass the check.
exit 1
fi
# TODO
# - name: go vet
Expand Down
2 changes: 1 addition & 1 deletion dbm-services/common/db-resource/internal/svr/bk/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func GetDiskInfo(hosts []IPList, bk_biz_id int, hostOsMap map[string]string) (re
maps.Copy(ipFailedLogMap, ipFailedLogMapWin)
for _, d := range ipLogs.ScriptTaskLogs {
var dl PowerShellResCollection
jsonBody := jsonRe.FindString(d.LogContent)
jsonBody := d.LogContent
logger.Info("%s shell grab json body: %s", d.Ip, jsonBody)
if err = json.Unmarshal([]byte(jsonBody), &dl); err != nil {
logger.Error("unmarshal log content failed %s", err.Error())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$diskInfo = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3" | ForEach-Object {
$diskInfo = Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3" | Where-Object { $_.FreeSpace -lt $_.Size } | ForEach-Object {
[PSCustomObject]@{
DriveLetter = $_.DeviceID
TotalSize = $_.Size
Expand Down

0 comments on commit f0c1ea8

Please sign in to comment.