Skip to content

Commit 656013f

Browse files
committed
RHINENG-17345: remove redundant parameter
1 parent 9a89688 commit 656013f

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

listener/upload.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func hostTemplate(tx *gorm.DB, accountID int, host *Host) *int64 {
363363

364364
// nolint: funlen
365365
// Stores or updates base system profile, returing internal system id
366-
func updateSystemPlatform(tx *gorm.DB, inventoryID string, accountID int, host *Host,
366+
func updateSystemPlatform(tx *gorm.DB, accountID int, host *Host,
367367
yumUpdates *YumUpdates, updatesReq *vmaas.UpdatesV3Request) (*models.SystemPlatform, error) {
368368
tStart := time.Now()
369369
defer utils.ObserveSecondsSince(tStart, messagePartDuration.WithLabelValues("update-system-platform"))
@@ -373,7 +373,7 @@ func updateSystemPlatform(tx *gorm.DB, inventoryID string, accountID int, host *
373373
if err != nil {
374374
return nil, errors.Wrap(err, "Serializing vmaas request")
375375
}
376-
376+
inventoryID := host.ID
377377
hash := sha256.Sum256(updatesReqJSON)
378378
jsonChecksum := hex.EncodeToString(hash[:])
379379
hash = sha256.Sum256(yumUpdates.GetRawParsed())
@@ -769,7 +769,7 @@ func processUpload(host *Host, yumUpdates *YumUpdates) (*models.SystemPlatform,
769769
utils.LogInfo("inventoryID", host.ID, "Received recently deleted system")
770770
return nil, nil
771771
}
772-
sys, err := updateSystemPlatform(tx, host.ID, accountID, host, yumUpdates, &updatesReq)
772+
sys, err := updateSystemPlatform(tx, accountID, host, yumUpdates, &updatesReq)
773773
if err != nil {
774774
return nil, errors.Wrap(err, "saving system into the database")
775775
}

listener/upload_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func createTestInvHost(t *testing.T) *Host {
4242

4343
now := time.Now()
4444
host := Host{
45+
ID: id,
4546
StaleTimestamp: &correctTime,
4647
Reporter: "puptoo",
4748
PerReporterStaleness: map[string]inventory.ReporterStaleness{
@@ -69,7 +70,7 @@ func TestUpdateSystemPlatform(t *testing.T) {
6970
Basearch: utils.PtrString("x86_64"),
7071
}
7172

72-
sys1, err := updateSystemPlatform(database.DB, id, accountID1, createTestInvHost(t), nil, &req)
73+
sys1, err := updateSystemPlatform(database.DB, accountID1, createTestInvHost(t), nil, &req)
7374
assert.Nil(t, err)
7475

7576
reporterID1 := 1
@@ -79,7 +80,7 @@ func TestUpdateSystemPlatform(t *testing.T) {
7980
host2 := createTestInvHost(t)
8081
host2.Reporter = "yupana"
8182
req.PackageList = []string{"package0", "package1"}
82-
sys2, err := updateSystemPlatform(database.DB, id, accountID2, host2, nil, &req)
83+
sys2, err := updateSystemPlatform(database.DB, accountID2, host2, nil, &req)
8384
assert.Nil(t, err)
8485

8586
reporterID2 := 3
@@ -300,7 +301,7 @@ func TestUpdateSystemPlatformYumUpdates(t *testing.T) {
300301

301302
req := vmaas.UpdatesV3Request{}
302303

303-
_, err = updateSystemPlatform(database.DB, id, accountID1, createTestInvHost(t), yumUpdates, &req)
304+
_, err = updateSystemPlatform(database.DB, accountID1, createTestInvHost(t), yumUpdates, &req)
304305
assert.Nil(t, err)
305306

306307
reporterID1 := 1
@@ -310,7 +311,7 @@ func TestUpdateSystemPlatformYumUpdates(t *testing.T) {
310311

311312
// check that yumUpdates has been updated
312313
yumUpdates.RawParsed = []byte("{}")
313-
_, err = updateSystemPlatform(database.DB, id, accountID1, createTestInvHost(t), yumUpdates, &req)
314+
_, err = updateSystemPlatform(database.DB, accountID1, createTestInvHost(t), yumUpdates, &req)
314315
assert.Nil(t, err)
315316
assertYumUpdatesInDB(t, id, yumUpdates)
316317

0 commit comments

Comments
 (0)