[trivial] Resync helpers to pickup fstab fixes

This commit is contained in:
James Page 2014-06-19 11:11:47 +01:00
parent f715cbacbb
commit 1bf1eb2257
4 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,6 @@
# Common python helper functions used for OpenStack charms.
from collections import OrderedDict
import apt_pkg as apt
import subprocess
import os
import socket
@ -132,6 +131,7 @@ def get_os_version_codename(codename):
def get_os_codename_package(package, fatal=True):
'''Derive OpenStack release codename from an installed package.'''
import apt_pkg as apt
apt.init()
# Tell apt to build an in-memory cache to prevent race conditions (if
@ -325,6 +325,7 @@ def openstack_upgrade_available(package):
"""
import apt_pkg as apt
src = config('openstack-origin')
cur_vers = get_os_version_package(package)
available_vers = get_os_version_install_source(src)

View File

@ -48,9 +48,11 @@ class Fstab(file):
file.__init__(self, self._path, 'r+')
def _hydrate_entry(self, line):
# NOTE: use split with no arguments to split on any
# whitespace including tabs
return Fstab.Entry(*filter(
lambda x: x not in ('', None),
line.strip("\n").split(" ")))
line.strip("\n").split()))
@property
def entries(self):

View File

@ -12,7 +12,6 @@ import random
import string
import subprocess
import hashlib
import apt_pkg
from collections import OrderedDict
@ -318,6 +317,7 @@ def cmp_pkgrevno(package, revno, pkgcache=None):
0 => Installed revno is the same as supplied arg
-1 => Installed revno is less than supplied arg
'''
import apt_pkg
if not pkgcache:
apt_pkg.init()
pkgcache = apt_pkg.Cache()

View File

@ -13,7 +13,6 @@ from charmhelpers.core.hookenv import (
config,
log,
)
import apt_pkg
import os
@ -117,6 +116,7 @@ class BaseFetchHandler(object):
def filter_installed_packages(packages):
"""Returns a list of packages that require installation"""
import apt_pkg
apt_pkg.init()
# Tell apt to build an in-memory cache to prevent race conditions (if