Skip to content

Commit

Permalink
Simpler yet!
Browse files Browse the repository at this point in the history
Another suggestion from @william-gr
  • Loading branch information
Brandon Schneider committed Oct 9, 2018
1 parent 78f8594 commit 3289eed
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/middlewared/middlewared/plugins/jail.py
Expand Up @@ -924,22 +924,8 @@ def get_version(self):
"""
Uses system.version and parses it out for the RELEASE branch we need
"""
try:
version = self.middleware.call_sync(
'cache.get', 'iocage_branch')

return version
except KeyError:
freebsd_version = su.run(['freebsd-version'],
stdout=su.PIPE,
stderr=su.STDOUT)
r = freebsd_version.stdout.decode().rstrip().split('-', 1)[0]

version = f'{round(float(r.split("-")[0]), 1)}-RELEASE'
self.middleware.call_sync(
'cache.put', 'iocage_branch', version,
604800
)
r = os.uname().release
version = f'{round(float(r.split("-")[0]), 1)}-RELEASE'

return version

Expand Down

0 comments on commit 3289eed

Please sign in to comment.