Skip to content

Commit

Permalink
fixed conditional and added constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
joel5vega committed Jan 19, 2024
1 parent 64f57e9 commit 8c1182a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/sugar/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,23 @@ def _set_default_group(self):
#Check if services item is given
def _check_services_item(self):
return bool(self.config.get('services'))
<<<<<<< HEAD

>>>>>>> add flag function to check if service is present
=======

# set default group main
def _set_default_group(self):
#must set the default group
self.config_data["groups"] = {
"main": self.config_data["services"]
}
self.config_group = self.config_data["groups"]["main"]
del self.config_data["services"]

return

>>>>>>> fixed conditional and added constructor
def _filter_service_group(self):
groups = self.config['groups']

Expand Down Expand Up @@ -231,7 +246,26 @@ def _load_compose_app(self):
self.compose_args.append('compose')

def _load_compose_args(self):
<<<<<<< HEAD
self._filter_service_group()
=======
#check if either services or groups are present
if not (self.config.get('services') and self.config.get('groups')):
KxgrLogs.raise_error(
f'either `services` OR `groups` flag must be given',
KxgrErrorType.KXGR_INVALID_CONFIGURATION,
)
#check if both services and groups are present
if self.config.get('services') and self.config.get('groups'):
KxgrLogs.raise_error(
f'`services` and `groups` flag given. Just use one of them is allowed.',
KxgrErrorType.KXGR_INVALID_CONFIGURATION,
)
if self.config.get('services'):
self._set_default_group()
else:
self._filter_service_group()
>>>>>>> fixed conditional and added constructor

if 'env-file' in self.service_group:
self.compose_args.extend(
Expand Down

0 comments on commit 8c1182a

Please sign in to comment.