Skip to content

Commit

Permalink
Add --server and --[no]verify options to iocage update (#37)
Browse files Browse the repository at this point in the history
They work just like they do for iocage fetch.
  • Loading branch information
asomers authored Oct 14, 2024
1 parent ac65566 commit eacc0ba
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
15 changes: 14 additions & 1 deletion iocage.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd September 12, 2020
.Dd February 25, 2021
.Dt IOCAGE 8
.Os
.Sh NAME
Expand Down Expand Up @@ -212,6 +212,9 @@
.\" == UPDATE ==
.Nm
.Cm update
.Op Fl s | -server
.Op Fl NV | -noverify
.Op Fl V | -verify
.Ar UUID | NAME
.\" == UPGRADE ==
.Nm
Expand Down Expand Up @@ -1018,6 +1021,16 @@ Runs
.Cm freebsd-update
to update the specified jail to the latest patch level.
.Pp
Options:
.Bl -tag -width "[-s | --server TEXT]"
.It Op Fl NV | -noverify
Disable verifying the SSL cert for HTTP fetching.
.It Op Fl s | -server Ar TEXT
Define the server from which to fetch the RELEASE.
.It Op Fl V | -verify
Enable verifying the SSL cert for HTTP fetching.
.El
.Pp
Example:
.Pp
.Dl # iocage update examplejail1
Expand Down
12 changes: 10 additions & 2 deletions iocage_cli/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@
help='Decide whether or not to update the pkg repositories and '
'all installed packages in jail( this has no effect for plugins ).'
)
@click.option(
"--server", "-s", default="download.freebsd.org",
help="Server to fetch from."
)
@click.option(
"--verify/--noverify", "-V/-NV", default=True,
help="Enable or disable verifying SSL cert for HTTP fetching."
)
@click.argument('jail', required=True)
def cli(jail, pkgs):
def cli(jail, **kwargs):
"""Update the supplied jail to the latest patchset"""
skip_jails = bool(jail != 'ALL')
ioc.IOCage(jail=jail, skip_jails=skip_jails).update(pkgs=pkgs)
ioc.IOCage(jail=jail, skip_jails=skip_jails).update(**kwargs)
4 changes: 3 additions & 1 deletion iocage_lib/iocage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ def update_all(self, pkgs=False):
self.jail = jail
self.update(pkgs)

def update(self, pkgs=False):
def update(self, pkgs=False, server=None, verify=True):
"""Updates a jail to the latest patchset."""
if self._all:
self.update_all(pkgs)
Expand Down Expand Up @@ -2014,6 +2014,8 @@ def update(self, pkgs=False):
try:
ioc_fetch.IOCFetch(
release,
server,
verify=verify,
callback=self.callback
).fetch_update(*params)
finally:
Expand Down

0 comments on commit eacc0ba

Please sign in to comment.