mirror of
https://github.com/rancher/os.git
synced 2025-09-01 14:48:55 +00:00
Fix golint errors
This commit is contained in:
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
func NewSystemClient() (dockerClient.APIClient, error) {
|
||||
return NewClient(config.DOCKER_SYSTEM_HOST)
|
||||
return NewClient(config.SystemDockerHost)
|
||||
}
|
||||
|
||||
func NewDefaultClient() (dockerClient.APIClient, error) {
|
||||
return NewClient(config.DOCKER_HOST)
|
||||
return NewClient(config.DockerHost)
|
||||
}
|
||||
|
||||
func NewClient(endpoint string) (dockerClient.APIClient, error) {
|
||||
|
@@ -25,8 +25,8 @@ func NewClientFactory(opts composeClient.Options) (project.ClientFactory, error)
|
||||
userOpts := opts
|
||||
systemOpts := opts
|
||||
|
||||
userOpts.Host = config.DOCKER_HOST
|
||||
systemOpts.Host = config.DOCKER_SYSTEM_HOST
|
||||
userOpts.Host = config.DockerHost
|
||||
systemOpts.Host = config.SystemDockerHost
|
||||
|
||||
userClient, err := composeClient.Create(userOpts)
|
||||
if err != nil {
|
||||
@@ -46,11 +46,11 @@ func NewClientFactory(opts composeClient.Options) (project.ClientFactory, error)
|
||||
|
||||
func (c *ClientFactory) Create(service project.Service) dockerclient.APIClient {
|
||||
if IsSystemContainer(service.Config()) {
|
||||
waitFor(&c.systemOnce, c.systemClient, config.DOCKER_SYSTEM_HOST)
|
||||
waitFor(&c.systemOnce, c.systemClient, config.SystemDockerHost)
|
||||
return c.systemClient
|
||||
}
|
||||
|
||||
waitFor(&c.userOnce, c.userClient, config.DOCKER_HOST)
|
||||
waitFor(&c.userOnce, c.userClient, config.DockerHost)
|
||||
return c.userClient
|
||||
}
|
||||
|
||||
|
@@ -29,13 +29,13 @@ func appendEnv(array []string, key, value string) []string {
|
||||
|
||||
func environmentFromCloudConfig(cfg *config.CloudConfig) map[string]string {
|
||||
environment := cfg.Rancher.Environment
|
||||
if cfg.Rancher.Network.HttpProxy != "" {
|
||||
environment["http_proxy"] = cfg.Rancher.Network.HttpProxy
|
||||
environment["HTTP_PROXY"] = cfg.Rancher.Network.HttpProxy
|
||||
if cfg.Rancher.Network.HTTPProxy != "" {
|
||||
environment["http_proxy"] = cfg.Rancher.Network.HTTPProxy
|
||||
environment["HTTP_PROXY"] = cfg.Rancher.Network.HTTPProxy
|
||||
}
|
||||
if cfg.Rancher.Network.HttpsProxy != "" {
|
||||
environment["https_proxy"] = cfg.Rancher.Network.HttpsProxy
|
||||
environment["HTTPS_PROXY"] = cfg.Rancher.Network.HttpsProxy
|
||||
if cfg.Rancher.Network.HTTPSProxy != "" {
|
||||
environment["https_proxy"] = cfg.Rancher.Network.HTTPSProxy
|
||||
environment["HTTPS_PROXY"] = cfg.Rancher.Network.HTTPSProxy
|
||||
}
|
||||
if cfg.Rancher.Network.NoProxy != "" {
|
||||
environment["no_proxy"] = cfg.Rancher.Network.NoProxy
|
||||
|
@@ -63,7 +63,7 @@ func (s *Service) requiresSyslog() bool {
|
||||
}
|
||||
|
||||
func (s *Service) requiresUserDocker() bool {
|
||||
return s.Config().Labels[config.SCOPE] != config.SYSTEM
|
||||
return s.Config().Labels[config.ScopeLabel] != config.System
|
||||
}
|
||||
|
||||
func appendLink(deps []project.ServiceRelationship, name string, optional bool, p *project.Project) []project.ServiceRelationship {
|
||||
@@ -93,8 +93,8 @@ func (s *Service) shouldRebuild(ctx context.Context) (bool, error) {
|
||||
}
|
||||
name := containerInfo.Name[1:]
|
||||
|
||||
origRebuildLabel := containerInfo.Config.Labels[config.REBUILD]
|
||||
newRebuildLabel := s.Config().Labels[config.REBUILD]
|
||||
origRebuildLabel := containerInfo.Config.Labels[config.RebuildLabel]
|
||||
newRebuildLabel := s.Config().Labels[config.RebuildLabel]
|
||||
rebuildLabelChanged := newRebuildLabel != origRebuildLabel
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"origRebuildLabel": origRebuildLabel,
|
||||
@@ -113,8 +113,8 @@ func (s *Service) shouldRebuild(ctx context.Context) (bool, error) {
|
||||
}
|
||||
if outOfSync {
|
||||
if s.Name() == "console" {
|
||||
origConsoleLabel := containerInfo.Config.Labels[config.CONSOLE]
|
||||
newConsoleLabel := s.Config().Labels[config.CONSOLE]
|
||||
origConsoleLabel := containerInfo.Config.Labels[config.ConsoleLabel]
|
||||
newConsoleLabel := s.Config().Labels[config.ConsoleLabel]
|
||||
if newConsoleLabel != origConsoleLabel {
|
||||
return true, nil
|
||||
}
|
||||
@@ -154,13 +154,13 @@ func (s *Service) Up(ctx context.Context, options options.Up) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if labels[config.CREATE_ONLY] == "true" {
|
||||
if labels[config.CreateOnlyLabel] == "true" {
|
||||
return s.checkReload(labels)
|
||||
}
|
||||
if err := s.Service.Up(ctx, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if labels[config.DETACH] == "false" {
|
||||
if labels[config.DetachLabel] == "false" {
|
||||
if err := s.wait(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -170,7 +170,7 @@ func (s *Service) Up(ctx context.Context, options options.Up) error {
|
||||
}
|
||||
|
||||
func (s *Service) checkReload(labels map[string]string) error {
|
||||
if labels[config.RELOAD_CONFIG] == "true" {
|
||||
if labels[config.ReloadConfigLabel] == "true" {
|
||||
return project.ErrRestart
|
||||
}
|
||||
return nil
|
||||
@@ -223,7 +223,6 @@ func (s *Service) rename(ctx context.Context) error {
|
||||
if len(info.Name) > 0 && info.Name[1:] != s.Name() {
|
||||
logrus.Debugf("Renaming container %s => %s", info.Name[1:], s.Name())
|
||||
return client.ContainerRename(context.Background(), info.ID, s.Name())
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -6,6 +6,5 @@ import (
|
||||
)
|
||||
|
||||
func IsSystemContainer(serviceConfig *composeConfig.ServiceConfig) bool {
|
||||
return serviceConfig.Labels[config.SCOPE] == config.SYSTEM
|
||||
|
||||
return serviceConfig.Labels[config.ScopeLabel] == config.System
|
||||
}
|
||||
|
Reference in New Issue
Block a user