Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/duplocloud/duploctl into bu…
Browse files Browse the repository at this point in the history
…gfix/DUPLO-13455
  • Loading branch information
zachchismdc committed Jan 4, 2024
2 parents 8044ea9 + 96e72fa commit 0260f3a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/duplo_resource/cronjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,20 @@ def update_image(self,
self.duplo.put(f"v3/subscriptions/{tenant_id}/k8s/cronJob/{name}", cronjob)
return {"message": f"Successfully updated image for cronjob '{name}'"}

@Command()
def update_schedule(self,
name: args.NAME,
cronschedule: args.CRONSCHEDULE):
"""Update the schedule of a cronjob.
Args:
name (str): The name of the cronjob to update.
schedule (str): The new schedule to use for the cronjob.
"""
tenant_id = self.tenant["TenantId"]
cronjob = self.find(name)
cronjob["spec"]["schedule"] = cronschedule
self.duplo.put(f"v3/subscriptions/{tenant_id}/k8s/cronJob/{name}", cronjob)
return {"message": f"Successfully updated cron-schedule for cronjob '{name}'"}


5 changes: 4 additions & 1 deletion src/duplocloud/args.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .types import Arg
from .argtype import Arg
import os
from .commander import available_resources
from importlib.metadata import version
Expand Down Expand Up @@ -44,6 +44,9 @@
SCHEDULE = Arg("schedule","-s",
help='The schedule to use')

CRONSCHEDULE = Arg("cronschedule",
help='The schedule to use')

ENABLE = Arg("enable","-y",
help='Enable or disable the feature',
type=bool,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/duplocloud/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import argparse
from importlib.metadata import entry_points
from .errors import DuploError
from .types import Arg
from .argtype import Arg

ENTRYPOINT="duplocloud.net"
FORMATS=f"formats.{ENTRYPOINT}"
Expand Down
2 changes: 1 addition & 1 deletion src/duplocloud/commander_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import argparse

from .commander import schema, resources, Command, get_parser, load_service, available_resources
from .types import Arg
from .argtype import Arg
from .errors import DuploError
from duplo_resource.service import DuploService
from .resource import DuploResource
Expand Down

0 comments on commit 0260f3a

Please sign in to comment.