Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify TORELEASE before performing jail upgrade. #509

Merged
merged 5 commits into from
Jul 6, 2017
Merged

Verify TORELEASE before performing jail upgrade. #509

merged 5 commits into from
Jul 6, 2017

Conversation

egypcio
Copy link
Member

@egypcio egypcio commented Jul 4, 2017

In case we use FreeBSD dists to try performing an upgrade on a jail, TORELEASE must be specified; although it must be checked to ensure if we are able to use it with freebsd-update(8). Only release branches like "BETA", "RC", and "RELEASE" are supported.

Check it even before trying to mount the jail prevents accidents (mounting jail rootfs, an additional fs), and "exit 1" ensures no unnecessary calls and traffic to FreeBSD's update servers will be performed.

  • Added silly orthography and info update to a comment from a previous commit.

egypcio added 2 commits July 4, 2017 19:58
…a release branch. (verify it even before trying to mount the jail prevents accidents, and "exit 1" ensures no unnecessary calls and traffic to FreeBSD's update servers will be performed)
@moufjenkins
Copy link

Can one of the admins verify this patch?

1 similar comment
@moufjenkins
Copy link

Can one of the admins verify this patch?

@egypcio egypcio changed the title Verify TORELEASEbefore performing jail upgrade. Only release branches like "BETA", "RC", and "RELEASE" are supported by freebsd-update(8). Verify TORELEASE before performing jail upgrade. Only release branches like "BETA", "RC", and "RELEASE" are supported by freebsd-update(8). Jul 4, 2017
@egypcio egypcio changed the title Verify TORELEASE before performing jail upgrade. Only release branches like "BETA", "RC", and "RELEASE" are supported by freebsd-update(8). Verify TORELEASE before performing jail upgrade. Jul 4, 2017
@egypcio
Copy link
Member Author

egypcio commented Jul 5, 2017

Host system running Poudriere with proposed patch:

# uname -iKmoUr
FreeBSD 12.0-CURRENT amd64 GENERIC-NODEBUG 1200037 1200037
# poudriere version
3.0-2426-g98689acb

Creating one jail using FreeBSD dists:

# poudriere jail -c -j onze -v 11.0-RELEASE
[00:00:00] ====>> Creating onze fs... done
[00:00:00] ====>> Using pre-distributed MANIFEST for FreeBSD 11.0-RELEASE amd64
[00:00:00] ====>> Fetching base for FreeBSD 11.0-RELEASE amd64
   ...
[00:01:55] ====>> Jail onze 11.0-RELEASE-p1 amd64 is ready to be used

# poudriere jail -l | grep onze
onze     11.0-RELEASE-p1  amd64 ftp    2017-07-05 11:51:01 /zim/poudriere/jails/onze

Upgrading previously created jail:

# poudriere jail -u -j onze -t 11.1-BETA2
    ...
# poudriere jail -u -j onze -t 11.1-RC1
    ...
# poudriere jail -l | grep onze
onze     11.1-RC1         amd64 ftp    2017-07-04 11:17:16 /zim/poudriere/jails/onze

Refusing to upgrade the jail to a snapshot branch (using 'ftp' method; freebsd-update):

# poudriere jail -u -j onze -t 12.0-CURRENT
[00:00:00] ====>> Upgrading using ftp
[00:00:00] ====>> Error: Only release branches are supported by freebsd-update(8).
[00:00:00] ====>> Error: Please try to upgrade to a new BETA, RC or RELEASE version.

@bdrewery
Copy link
Member

bdrewery commented Jul 5, 2017

I'll look today.

@bdrewery
Copy link
Member

bdrewery commented Jul 6, 2017

Can you rebase this without b1469c4?

@@ -198,6 +198,16 @@ update_jail() {
msg "Upgrading using ${METHOD}"
case ${METHOD} in
ftp|http|ftp-archive)
# In case we use FreeBSD dists and TORELEASE is present, check if it's a release branch.
if [ ! -z ${TORELEASE} ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use -n here rather than ! -z and please quote ${TORELEASE}: -n "${TORELEASE}"

if [ ! -z ${TORELEASE} ]; then
case ${TORELEASE} in
*-ALPHA*|*-CURRENT|*-PRERELEASE|*-STABLE)
msg_error "Only release branches are supported by freebsd-update(8)."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of freebsd-update(8) by poudriere is an implementation detail that is not documented and may change in the future; the user only knows they are using -m ftp (or http/ftp-archive) here, so we should not reference freebsd-update(8).
Please change freebsd-update(8) here to reference ${METHOD} such as Only release branches are supported with method ${METHOD}"

*-ALPHA*|*-CURRENT|*-PRERELEASE|*-STABLE)
msg_error "Only release branches are supported by freebsd-update(8)."
msg_error "Please try to upgrade to a new BETA, RC or RELEASE version."
exit 1 ;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put ;; on next line to follow other style for multi-line case statements.

@@ -218,15 +228,14 @@ update_jail() {
chmod +x ${JAILMNT}/usr/sbin/freebsd-update.fixed
if [ -z "${TORELEASE}" ]; then
# We're running inside the jail so basedir is /.
# If we start using -b this needs to match it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase out this commit, it was handled separately from this PR.

…e change requests to the way TORELEASE was checked, remove mention to freebsd-update(8) and use ';;' in a new line.
@egypcio
Copy link
Member Author

egypcio commented Jul 6, 2017

@bdrewery, thank you for the feedback/review. I just applied your requests, and rebased the branch. Do you mind to see if it's okay now? Please let me know.

@bdrewery bdrewery merged commit f6f4014 into freebsd:master Jul 6, 2017
@bdrewery bdrewery modified the milestones: 3.2, 3.1.20 Jul 6, 2017
bdrewery pushed a commit that referenced this pull request Jul 6, 2017
bdrewery pushed a commit that referenced this pull request Jul 6, 2017
In case we use FreeBSD dists and TORELEASE is present, check if it's a release
branch. (verify it even before trying to mount the jail prevents accidents, and
"exit 1" ensures no unnecessary calls and traffic to FreeBSD's update servers
will be performed)

add *-STABLE to the list of possible snapshot versions.

Issue #509
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants