File tree 2 files changed +28
-16
lines changed
2 files changed +28
-16
lines changed Original file line number Diff line number Diff line change 22
22
import time
23
23
24
24
# project
25
+ from utils .platform import Platform
25
26
from utils .process import is_my_process
26
27
from utils .subprocess_output import subprocess
27
28
from config import get_logging_config
@@ -231,22 +232,26 @@ def daemonize(self):
231
232
232
233
def start (self , foreground = False ):
233
234
log .info ("Starting" )
234
- pid = self .pid ()
235
+ if not Platform .is_windows ():
236
+ pid = self .pid ()
237
+
238
+ if pid :
239
+ # Check if the pid in the pidfile corresponds to a running process
240
+ # and if psutil is installed, check if it's a datadog-agent one
241
+ if is_my_process (pid ):
242
+ log .error ("Not starting, another instance is already running"
243
+ " (using pidfile {0})" .format (self .pidfile ))
244
+ sys .exit (1 )
245
+ else :
246
+ log .warn ("pidfile doesn't contain the pid of an agent process."
247
+ ' Starting normally' )
235
248
236
- if pid :
237
- # Check if the pid in the pidfile corresponds to a running process
238
- # and if psutil is installed, check if it's a datadog-agent one
239
- if is_my_process (pid ):
240
- log .error ("Not starting, another instance is already running"
241
- " (using pidfile {0})" .format (self .pidfile ))
242
- sys .exit (1 )
243
- else :
244
- log .warn ("pidfile doesn't contain the pid of an agent process."
245
- ' Starting normally' )
249
+ if not foreground :
250
+ self .daemonize ()
251
+ self .write_pidfile ()
252
+ else :
253
+ log .debug ("Skipping pidfile check for Windows" )
246
254
247
- if not foreground :
248
- self .daemonize ()
249
- self .write_pidfile ()
250
255
self .run ()
251
256
252
257
def stop (self ):
Original file line number Diff line number Diff line change @@ -44,7 +44,12 @@ def get_registry_conf(agentConfig):
44
44
if option != '' :
45
45
registry_conf [attribute ] = option
46
46
except (ImportError , WindowsError ) as e :
47
- log .error ('Unable to get config keys from Registry: %s' , e )
47
+ # don't log this as an error. Since the keys are deleted after
48
+ # they're used, they're almost certain to not be there.
49
+ # however, log as `info` so it will show by default after install
50
+ # (i.e. before user has had a chance to change the config file)
51
+ # so it can be seen if necessary
52
+ log .info ('Unable to get config keys from Registry (this is probably OK): %s' , e )
48
53
49
54
return registry_conf
50
55
@@ -87,7 +92,9 @@ def get_sdk_integration_paths():
87
92
except WindowsError as e :
88
93
log .error ('Unable to get keys from Registry for %s: %s' , integration_name , e )
89
94
except WindowsError as e :
90
- log .error ('Unable to get config keys from Registry: %s' , e )
95
+ # don't log this as an error. Unless someone has installed a standalone
96
+ # integration, this key won't be present.
97
+ log .debug ('Unable to get config keys from Registry: %s' , e )
91
98
92
99
return integrations
93
100
You can’t perform that action at this time.
0 commit comments