Fix lint issues
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
37f118d73a
commit
d69ad9b5a3
9 changed files with 24 additions and 27 deletions
|
@ -149,7 +149,7 @@ func (r *Runtime) CreateContainer(c *Container, cgroupParent string) error {
|
|||
if cgroupParent != "" {
|
||||
if r.cgroupManager == "systemd" {
|
||||
logrus.Infof("Running conmon under slice %s and unitName %s", cgroupParent, createUnitName("ocid", c.name))
|
||||
if err := utils.RunUnderSystemdScope(cmd.Process.Pid, cgroupParent, createUnitName("ocid", c.name)); err != nil {
|
||||
if err = utils.RunUnderSystemdScope(cmd.Process.Pid, cgroupParent, createUnitName("ocid", c.name)); err != nil {
|
||||
logrus.Warnf("Failed to add conmon to sandbox cgroup: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
|
|||
c := &pb.Container{
|
||||
Id: cID,
|
||||
PodSandboxId: podSandboxID,
|
||||
CreatedAt: int64(created),
|
||||
CreatedAt: created,
|
||||
Labels: ctr.Labels(),
|
||||
Metadata: ctr.Metadata(),
|
||||
Annotations: ctr.Annotations(),
|
||||
|
|
|
@ -44,22 +44,22 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
|
|||
case oci.ContainerStateCreated:
|
||||
rStatus = pb.ContainerState_CONTAINER_CREATED
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
resp.Status.CreatedAt = created
|
||||
case oci.ContainerStateRunning:
|
||||
rStatus = pb.ContainerState_CONTAINER_RUNNING
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
resp.Status.CreatedAt = created
|
||||
started := cState.Started.UnixNano()
|
||||
resp.Status.StartedAt = int64(started)
|
||||
resp.Status.StartedAt = started
|
||||
case oci.ContainerStateStopped:
|
||||
rStatus = pb.ContainerState_CONTAINER_EXITED
|
||||
created := cState.Created.UnixNano()
|
||||
resp.Status.CreatedAt = int64(created)
|
||||
resp.Status.CreatedAt = created
|
||||
started := cState.Started.UnixNano()
|
||||
resp.Status.StartedAt = int64(started)
|
||||
resp.Status.StartedAt = started
|
||||
finished := cState.Finished.UnixNano()
|
||||
resp.Status.FinishedAt = int64(finished)
|
||||
resp.Status.ExitCode = int32(cState.ExitCode)
|
||||
resp.Status.FinishedAt = finished
|
||||
resp.Status.ExitCode = cState.ExitCode
|
||||
}
|
||||
|
||||
resp.Status.State = rStatus
|
||||
|
|
|
@ -201,8 +201,8 @@ func (s *sandbox) netNsCreate() error {
|
|||
if err := s.netns.symlinkCreate(s.name); err != nil {
|
||||
logrus.Warnf("Could not create nentns symlink %v", err)
|
||||
|
||||
if err := s.netns.ns.Close(); err != nil {
|
||||
return err
|
||||
if err1 := s.netns.ns.Close(); err1 != nil {
|
||||
return err1
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
@ -72,7 +72,7 @@ func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxReque
|
|||
|
||||
pod := &pb.PodSandbox{
|
||||
Id: sb.id,
|
||||
CreatedAt: int64(created),
|
||||
CreatedAt: created,
|
||||
State: rStatus,
|
||||
Labels: sb.labels,
|
||||
Annotations: sb.annotations,
|
||||
|
|
|
@ -407,11 +407,7 @@ func (s *Server) setPodSandboxMountLabel(id, mountLabel string) error {
|
|||
return err
|
||||
}
|
||||
storageMetadata.SetMountLabel(mountLabel)
|
||||
err = s.storage.SetContainerMetadata(id, storageMetadata)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return s.storage.SetContainerMetadata(id, storageMetadata)
|
||||
}
|
||||
|
||||
func getSELinuxLabels(selinuxOptions *pb.SELinuxOption) (processLabel string, mountLabel string, err error) {
|
||||
|
|
|
@ -44,7 +44,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
|
|||
resp := &pb.PodSandboxStatusResponse{
|
||||
Status: &pb.PodSandboxStatus{
|
||||
Id: sandboxID,
|
||||
CreatedAt: int64(created),
|
||||
CreatedAt: created,
|
||||
Linux: &pb.LinuxPodSandboxStatus{
|
||||
Namespaces: &pb.Namespace{
|
||||
Network: netNsPath,
|
||||
|
|
|
@ -113,10 +113,7 @@ func (s *Server) loadContainer(id string) error {
|
|||
return fmt.Errorf("error updating status for container %s: %v", ctr.ID(), err)
|
||||
}
|
||||
s.addContainer(ctr)
|
||||
if err = s.ctrIDIndex.Add(id); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return s.ctrIDIndex.Add(id)
|
||||
}
|
||||
|
||||
func configNetNsPath(spec rspec.Spec) (string, error) {
|
||||
|
|
|
@ -110,7 +110,9 @@ func main() {
|
|||
logrus.Errorf("error opening storage: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer store.Shutdown(false)
|
||||
defer func() {
|
||||
_, _ = store.Shutdown(false)
|
||||
}()
|
||||
|
||||
storage.Transport.SetStore(store)
|
||||
ref, err = storage.Transport.ParseStoreReference(store, imageName)
|
||||
|
@ -133,7 +135,9 @@ func main() {
|
|||
logrus.Errorf("error loading signature policy: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer policyContext.Destroy()
|
||||
defer func() {
|
||||
_ = policyContext.Destroy()
|
||||
}()
|
||||
options := ©.Options{}
|
||||
|
||||
if importFrom != "" {
|
||||
|
@ -161,9 +165,9 @@ func main() {
|
|||
}
|
||||
}
|
||||
if addName != "" {
|
||||
destImage, err := storage.Transport.GetStoreImage(store, ref)
|
||||
if err != nil {
|
||||
logrus.Errorf("error finding image: %v", err)
|
||||
destImage, err1 := storage.Transport.GetStoreImage(store, ref)
|
||||
if err1 != nil {
|
||||
logrus.Errorf("error finding image: %v", err1)
|
||||
os.Exit(1)
|
||||
}
|
||||
names := append(destImage.Names, imageName, addName)
|
||||
|
|
Loading…
Reference in a new issue