Skip to content

Commit

Permalink
MG-359 unnecessary logs and removing service file
Browse files Browse the repository at this point in the history
  • Loading branch information
mageddo committed Jul 22, 2017
1 parent 0c60ece commit 693a0ab
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 75 deletions.
1 change: 0 additions & 1 deletion builder
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ case $1 in
go build -v -o ../build/dns-proxy-server \
-ldflags "-X github.com/mageddo/dns-proxy-server/flags.version=$VERSION" && \
cp -r ../static ../build/ && \
cp ../dns-proxy-service ../build/dns-proxy-service && \
cd ../build/ && \
tar -cvf dns-proxy-server-$VERSION.tgz * && \
cd ../
Expand Down
67 changes: 0 additions & 67 deletions dns-proxy-service

This file was deleted.

2 changes: 1 addition & 1 deletion src/github.com/mageddo/dns-proxy-server/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func SetCurrentDNSServerToMachineAndLockIt() error {
func SetCurrentDNSServerToMachine() error {

ip, err := getCurrentIpAddress()
log.Logger.Infof("m=SetCurrentDNSServerToMachine, status=begin, ip=%s, err=%s", ip, err)
log.Logger.Infof("m=SetCurrentDNSServerToMachine, status=begin, ip=%s, err=%v", ip, err)
if err != nil {
return err
}
Expand Down
8 changes: 5 additions & 3 deletions src/github.com/mageddo/dns-proxy-server/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func NewService(ctx context.Context) *Service {
func (sc *Service) Install() {

setupServiceFlag := *flags.SetupService

if len(setupServiceFlag) == 0 {
return
}
sc.logger.Infof("setupservice=%s, version=%s", setupServiceFlag, flags.GetRawCurrentVersion())
var err error
switch setupServiceFlag {
Expand Down Expand Up @@ -80,13 +82,13 @@ func (sc *Service) SetupFor(servicePath, serviceName string, script *Script) err
if err != nil {
sc.logger.Debugf("status=stop-service, msg=out=%s", string(out))
}
out, err, code := utils.Exec("service", serviceName, "start")
_, err, _ = utils.Exec("service", serviceName, "start")
if err != nil {
err := fmt.Sprintf("status=start-service, msg=%v", err)
sc.logger.Warning(err)
return errors.New(err)
}
sc.logger.Infof("status=success, servicePath=%s, out=%s, err=%v, code=%d", servicePath, string(out), err, code)
sc.logger.Infof("status=success, servicePath=%s", servicePath)
return nil

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func TestSetupFor_NormalModeInstallStartSuccess(t *testing.T) {
sc := NewService(ctx)
cmd := "'bash -c \"echo hi && sleep 20\"'"
err := sc.SetupFor(DNS_PROXY_SERVER_PATH, DNS_PROXY_SERVER_SERVICE, &Script{cmd})
if err != nil {
t.Error(err)
}
assert.Nil(t, err)

bytes, err := ioutil.ReadFile(DNS_PROXY_SERVER_PATH)
assert.Nil(t, err)
Expand Down

0 comments on commit 693a0ab

Please sign in to comment.