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