Restructure installer.py and updatecheck.py

This commit is contained in:
Greg Neagle
2017-01-06 13:24:25 -08:00
parent ad1d523e24
commit b45c7132c1
12 changed files with 85 additions and 77 deletions

View File

@@ -0,0 +1 @@
from .core import *

View File

@@ -15,7 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
installer.py
installer.core
munki module to automatically install pkgs, mpkgs, and dmgs
(containing pkgs and mpkgs) from a defined folder.
"""
@@ -24,18 +25,20 @@ import datetime
import os
import subprocess
import adobeutils
import catalogs
import copyfromdmg
import munkicommon
import munkistatus
import pkginstalls
import pkgutils
import powermgr
import processes
import profiles
import FoundationPlist
from removepackages import removepackages
from . import dmg
from . import pkg
from ..updatecheck import catalogs
from .. import adobeutils
from .. import munkicommon
from .. import munkistatus
from .. import pkgutils
from .. import powermgr
from .. import processes
from .. import profiles
from .. import FoundationPlist
from ..removepackages import removepackages
# PyLint cannot properly find names inside Cocoa libraries, so issues bogus
# No name 'Foo' in module 'Bar' warnings. Disable them.
@@ -221,7 +224,7 @@ def installWithInfo(
restartflag = True
retcode = 0
elif installer_type == "copy_from_dmg":
retcode = copyfromdmg.copy_from_dmg(
retcode = dmg.copy_from_dmg(
itempath, item.get('items_to_copy'))
if retcode == 0:
if (item.get("RestartAction") == "RequireRestart" or
@@ -230,7 +233,7 @@ def installWithInfo(
elif installer_type == "appdmg":
munkicommon.display_warning(
"install_type 'appdmg' is deprecated. Use 'copy_from_dmg'.")
retcode = copyfromdmg.copy_app_from_dmg(itempath)
retcode = dmg.copy_app_from_dmg(itempath)
elif installer_type == 'profile':
# profiles.install_profile returns True/False
retcode = 0
@@ -291,14 +294,14 @@ def installWithInfo(
fullpkgpath = os.path.join(
mountpoints[0], item['package_path'])
if os.path.exists(fullpkgpath):
(retcode, needtorestart) = pkginstalls.install(
(retcode, needtorestart) = pkg.install(
fullpkgpath, display_name, choicesXMLfile,
suppressBundleRelocation, installer_environment)
else:
# no relative path to pkg on dmg, so just install all
# pkgs found at the root of the first mountpoint
# (hopefully there's only one)
(retcode, needtorestart) = pkginstalls.installall(
(retcode, needtorestart) = pkg.installall(
mountpoints[0], display_name, choicesXMLfile,
suppressBundleRelocation, installer_environment)
if (needtorestart or
@@ -308,7 +311,7 @@ def installWithInfo(
munkicommon.unmountdmg(mountpoints[0])
elif (munkicommon.hasValidPackageExt(itempath) or
itempath.endswith(".dist")):
(retcode, needtorestart) = pkginstalls.install(
(retcode, needtorestart) = pkg.install(
itempath, display_name, choicesXMLfile,
suppressBundleRelocation, installer_environment)
if (needtorestart or

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
copyfromdmg.py
installer.dmg
Created by Greg Neagle on 2017-01-03.
@@ -27,10 +27,10 @@ import stat
import subprocess
import xattr
from . import display
from . import dmgutils
from . import osutils
from . import pkgutils
from .. import display
from .. import dmgutils
from .. import osutils
from .. import pkgutils
def copy_items_from_mountpoint(mountpoint, itemlist):

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
pkginstalls.py
installer.pkg
Created by Greg Neagle on 2017-01-03.
@@ -27,15 +27,15 @@ import pwd
import subprocess
import time
from . import display
from . import dmgutils
from . import launchd
from . import munkilog
from . import munkistatus
from . import osutils
from . import processes
from . import pkgutils
from . import FoundationPlist
from .. import display
from .. import dmgutils
from .. import launchd
from .. import munkilog
from .. import munkistatus
from .. import osutils
from .. import processes
from .. import pkgutils
from .. import FoundationPlist
def remove_bundle_relocation_info(pkgpath):

View File

@@ -0,0 +1 @@
from .core import *

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
catalogs.py
updatecheck.catalogs
Created by Greg Neagle on 2017-01-01.
@@ -24,13 +24,14 @@ Functions for working with Munki catalogs
import os
from . import display
from . import download
from . import info
from . import pkgutils
from . import prefs
from . import utils
from . import FoundationPlist
from .. import display
from .. import info
from .. import pkgutils
from .. import prefs
from .. import utils
from .. import FoundationPlist
def make_catalog_db(catalogitems):

View File

@@ -15,21 +15,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
compare.py
updatecheck.compare
Created by Greg Neagle on 2016-12-13.
Comparsion/checking functions used by updatecheck.py
Comparsion/checking functions used by updatecheck
"""
import os
from . import display
from . import munkihash
from . import info
from . import pkgutils
from . import utils
from . import FoundationPlist
from .. import display
from .. import munkihash
from .. import info
from .. import pkgutils
from .. import utils
from .. import FoundationPlist
# we use lots of camelCase-style names. Deal with it.

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
updatecheck.py
updatecheck.core
Created by Greg Neagle on 2008-11-13.
@@ -29,14 +29,15 @@ import os
from . import catalogs
from . import compare
from . import download
from . import fetch
from . import installationstate
from . import keychain
from . import licensing
from . import manifestutils
from . import munkicommon
from . import munkistatus
from . import FoundationPlist
from .. import fetch
from .. import keychain
from .. import munkicommon
from .. import munkistatus
from .. import FoundationPlist
# Disable PyLint complaining about 'invalid' camelCase names

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
download.py
updatecheck.download
Created by Greg Neagle on 2016-12-31.
@@ -27,13 +27,13 @@ import os
import urllib2
import urlparse
from . import display
from . import fetch
from . import info
from . import munkihash
from . import osutils
from . import prefs
from . import reports
from .. import display
from .. import fetch
from .. import info
from .. import munkihash
from .. import osutils
from .. import prefs
from .. import reports
def enough_disk_space(item_pl, installlist=None, uninstalling=False, warn=True):

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
installationstate.py
updatecheck.installationstate
Created by Greg Neagle on 2017-01-01.
@@ -26,10 +26,11 @@ import os
from . import catalogs
from . import compare
from . import display
from . import profiles
from . import scriptutils
from . import utils
from .. import display
from .. import profiles
from .. import scriptutils
from .. import utils
def installed_state(item_pl):

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
licensing.py
updatecheck.licensing
Created by Greg Neagle on 2017-01-01.
@@ -23,10 +23,10 @@ Created by Greg Neagle on 2017-01-01.
from urllib import quote_plus
from . import display
from . import fetch
from . import prefs
from . import FoundationPlist
from .. import display
from .. import fetch
from .. import prefs
from .. import FoundationPlist
def update_available_license_seats(installinfo):

View File

@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
manifestutils.py
updatecheck.manifestutils
Created by Greg Neagle on 2016-12-16.
@@ -26,10 +26,10 @@ Functions for working with manifest files
import os
import urllib2
from . import fetch
from . import keychain
from . import munkicommon
from . import FoundationPlist
from .. import fetch
from .. import keychain
from .. import munkicommon
from .. import FoundationPlist
PRIMARY_MANIFEST_TAG = '_primary_manifest_'