@@ -286,14 +286,9 @@ def start(self):
286286 raise RuntimeError ('Ignoring {start}; server already listening on ip address (0.0.0.0).' )
287287
288288 self ._load_config (generate_missing = True )
289- try :
290- if self .profile_config [self .profile :'type' ] == 'unmanaged' :
291- if not os .path .isfile (os .path .join (self .env ['cwd' ], self .profile_config [self .profile :'run_as' ])):
292- raise RuntimeError ('%s does not exist' % self .profile_config [self .profile :'run_as' ])
293- elif not self .profile_current :
294- raise RuntimeError ('Assigned jar does not match copy in profile directory' )
295- except TypeError :
296- raise RuntimeError ('Ignoring {start}; profile is not set' )
289+ if not self .profile_current :
290+ raise RuntimeError ('Assigned jar does not match copy in profile directory' )
291+
297292 self ._command_direct (self .command_start , self .env ['cwd' ])
298293
299294 @server_exists (True )
@@ -659,6 +654,12 @@ def compare(profile):
659654
660655 try :
661656 current = self .profile
657+ if current == 'unmanaged' :
658+ path_ = os .path .join (self .env ['cwd' ], self .profile_config [self .profile :'run_as' ])
659+ if not os .path .isfile (path ):
660+ raise RuntimeError ('%s does not exist' % path_ )
661+ else :
662+ return True
662663 return compare (current )
663664 except TypeError :
664665 raise RuntimeError ('Server is not assigned a valid profile.' )
@@ -987,9 +988,6 @@ def list_servers(cls, base_directory):
987988 """
988989 from itertools import chain
989990
990- if not base_directory :
991- raise ValueError ('Must specify which base_directory to list servers for.' )
992-
993991 return list (set (chain (
994992 cls ._list_subdirs (os .path .join (base_directory , cls .DEFAULT_PATHS ['servers' ])),
995993 cls ._list_subdirs (os .path .join (base_directory , cls .DEFAULT_PATHS ['backup' ]))
@@ -1168,9 +1166,6 @@ def list_servers_start_at_boot(cls, base_directory):
11681166 @classmethod
11691167 def list_profiles (cls , base_directory ):
11701168 """Lists all profiles found in profile.config at the base_directory root"""
1171- if not base_directory :
1172- raise ValueError ('Must provide base_directory to list profiles for.' )
1173-
11741169 pc = config_file (os .path .join (base_directory , 'profiles' , 'profile.config' ))
11751170 return pc [:]
11761171
@@ -1257,16 +1252,17 @@ def _list_files(directory):
12571252 @classmethod
12581253 def _make_skeleton (cls , base_directory ):
12591254 """Creates the default paths at base_directory"""
1260- if not base_directory :
1261- raise ValueError ('Skeleton must have base_directory provided.' )
1262-
12631255 for d in cls .DEFAULT_PATHS :
12641256 try :
12651257 os .makedirs (os .path .join (base_directory , d ))
12661258 except OSError :
12671259 pass
12681260
1269- with open (os .path .join (base_directory , cls .DEFAULT_PATHS ['profiles' ], 'profile.config' ), 'a' ): pass
1261+ try :
1262+ path_ = os .path .join (base_directory , cls .DEFAULT_PATHS ['profiles' ], 'profile.config' )
1263+ with open (path_ , 'a' ): pass
1264+ except IOError :
1265+ raise IOError ('Unable to write to %s' % path_ )
12701266
12711267 @staticmethod
12721268 def minutes_since_midnight ():
0 commit comments