• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / iot-manager / 1401702106

05 Aug 2024 08:32PM UTC coverage: 87.577%. Remained the same
1401702106

push

gitlab-ci

web-flow
Merge pull request #295 from mendersoftware/dependabot/docker/docker-dependencies-03b04ac819

chore: bump golang from 1.22.4-alpine3.19 to 1.22.5-alpine3.19 in the docker-dependencies group

3264 of 3727 relevant lines covered (87.58%)

11.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/cmd/reencrypt.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package cmd
16

17
import (
18
        "context"
19

20
        "github.com/mendersoftware/go-lib-micro/log"
21

22
        "github.com/mendersoftware/iot-manager/model"
23
        "github.com/mendersoftware/iot-manager/store"
24
)
25

26
const defaultLimit = int64(100)
27

28
func Reencrypt(dataStore store.DataStore) error {
3✔
29
        ctx := context.Background()
3✔
30
        l := log.FromContext(ctx)
3✔
31

3✔
32
        skip := int64(0)
3✔
33
        for {
7✔
34
                filter := model.IntegrationFilter{
4✔
35
                        Skip:  skip,
4✔
36
                        Limit: defaultLimit,
4✔
37
                }
4✔
38
                integrations, err := dataStore.GetIntegrations(ctx, filter)
4✔
39
                if err != nil {
5✔
40
                        return err
1✔
41
                } else if len(integrations) == 0 {
5✔
42
                        break
1✔
43
                }
44
                for _, integration := range integrations {
4✔
45
                        if integration.Credentials.Type == model.CredentialTypeSAS {
4✔
46
                                l.Infof("Re-encrypting credentials for integration %s", integration.ID)
2✔
47
                                err = dataStore.SetIntegrationCredentials(ctx,
2✔
48
                                        integration.ID, integration.Credentials)
2✔
49
                                if err != nil {
3✔
50
                                        return err
1✔
51
                                }
1✔
52
                        }
53
                }
54
                skip += defaultLimit
1✔
55
        }
56
        return nil
1✔
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc