Skip to content

Commit 621c182

Browse files
authored
fix:install prometheus and npe (#881)
1 parent 03fa330 commit 621c182

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

deploy/standalone/vm/install-linux.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,7 @@ function installPolarisLimiter() {
227227
echo -e "polaris-limiter-release.tar.gz has been decompressed, skip."
228228
fi
229229

230-
cd ${polaris_limiter_dirname} || (
231-
echo "no such directory ${polaris_limiter_dirname}"
232-
exit -1
233-
)
230+
pushd ${polaris_limiter_dirname}
234231

235232
# 备份 polaris-limiter.yaml
236233
cp polaris-limiter.yaml polaris-limiter.yaml.bak
@@ -242,10 +239,7 @@ function installPolarisLimiter() {
242239

243240
/bin/bash ./tool/start.sh
244241
echo -e "install polaris limiter finish."
245-
cd ${install_path} || (
246-
echo "no such directory ${install_path}"
247-
exit -1
248-
)
242+
popd
249243
}
250244

251245
function checkPort() {
@@ -255,7 +249,6 @@ function checkPort() {
255249
echo "" >&2
256250
exit 1
257251
fi
258-
keyLength=$(echo ${key} | awk '{print length($0)}')
259252
lineNumStr=$(cat ${proFilePath} | wc -l)
260253
lineNum=$((${lineNumStr}))
261254
for ((i = 1; i <= ${lineNum}; i++)); do
@@ -265,6 +258,8 @@ function checkPort() {
265258
if [ "${pid}" != "" ]; then
266259
echo "port ${port} already used, you can modify port.properties to adjust port"
267260
exit -1
261+
else
262+
echo "port ${port} is checked ,and is not used"
268263
fi
269264
done
270265
}

store/sqldb/config_file_group.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package sqldb
1919

2020
import (
2121
"database/sql"
22+
"errors"
2223
"fmt"
2324
"strconv"
2425
"strings"
@@ -28,6 +29,10 @@ import (
2829
"github.com/polarismesh/polaris/store"
2930
)
3031

32+
var (
33+
ErrMultipleConfigFileGroupFound error = errors.New("multiple config_file_group found")
34+
)
35+
3136
type configFileGroupStore struct {
3237
db *BaseDB
3338
}
@@ -180,6 +185,14 @@ func (fg *configFileGroupStore) GetConfigFileGroupById(id uint64) (*model.Config
180185
return nil, err
181186
}
182187

188+
if len(cfgs) == 0 {
189+
return nil, nil
190+
}
191+
192+
if len(cfgs) > 1 {
193+
return nil, ErrMultipleConfigFileGroupFound
194+
}
195+
183196
return cfgs[0], nil
184197
}
185198

0 commit comments

Comments
 (0)