Example #1
0
def create_waptwua_package(waptconfigfile,wuagroup='default',wapt_server_user=None,wapt_server_passwd=None,key_password=None):
    """Create/update - upload a package to enable waptwua and set windows_updates_rules
    based on the content of database.
    """
    wapt = common.Wapt(config_filename=waptconfigfile,disable_update_server_status=True)
    wapt.dbpath = r':memory:'
    wapt.use_hostpackages = False
    wapt.filter_on_host_cap = False
    # be sure to be up to date
    wapt.update(register=False)
    packagename = '{}-waptwua-{}'.format(wapt.config.get('global','default_package_prefix'),wuagroup)
    """
    packages = wapt.is_available(packagename)
    if not packages:
        # creates a new package based on waptwua template
        res = wapt.make_group_template(packagename,directoryname = mkdtemp('wapt'),section='waptwua')
    else:
        res = wapt.edit_package(packagename,target_directory = mkdtemp('wapt'),use_local_sources = False)
    """
    group_entry = wapt.make_group_template(packagename,directoryname = mkdtemp('wapt'),section='waptwua')
    build_res = wapt.build_upload(group_entry.sourcespath,
        private_key_passwd = key_password,
        wapt_server_user=wapt_server_user,
        wapt_server_passwd=wapt_server_passwd,
        inc_package_release=True)
    group_entry.delete_localsources()
    packagefilename = group_entry.localpath
    if isfile(packagefilename):
        remove_file(packagefilename)
    return build_res
Example #2
0
def create_waptwua_package(waptconfigfile,
                           wuagroup='default',
                           wapt_server_user=None,
                           wapt_server_passwd=None,
                           key_password=None):
    """Create/update - upload a package to enable waptwua and set windows_updates_rules
    based on the content of database.
    """

    try:
        import waptconsole
        progress_hook = waptconsole.UpdateProgress
        private_key_password_callback = waptconsole.GetPrivateKeyPassword
    except ImportError as e:

        def print_progress(show=False, n=0, max=100, msg=''):
            if show:
                print('%s %s/%s\r' % (msg, n, max), end='')
            else:
                if not msg:
                    msg = 'Done'
                print("%s%s" % (msg, ' ' * (80 - len(msg))))

        progress_hook = print_progress
        private_key_password_callback = None

    wapt = common.Wapt(config_filename=waptconfigfile,
                       disable_update_server_status=True)
    wapt.dbpath = r':memory:'
    wapt.use_hostpackages = False
    wapt.filter_on_host_cap = False
    # be sure to be up to date
    wapt.update(register=False)
    wapt.private_key_password_callback = private_key_password_callback

    packagename = '{}-waptwua-{}'.format(
        wapt.config.get('global', 'default_package_prefix'), wuagroup)
    """
    packages = wapt.is_available(packagename)
    if not packages:
        # creates a new package based on waptwua template
        res = wapt.make_group_template(packagename,directoryname = mkdtemp('wapt'),section='waptwua')
    else:
        res = wapt.edit_package(packagename,target_directory = mkdtemp('wapt'),use_local_sources = False)
    """
    group_entry = wapt.make_group_template(packagename,
                                           directoryname=mkdtemp('wapt'),
                                           section='waptwua')
    build_res = wapt.build_upload(group_entry.sourcespath,
                                  private_key_passwd=key_password,
                                  wapt_server_user=wapt_server_user,
                                  wapt_server_passwd=wapt_server_passwd,
                                  inc_package_release=True)
    group_entry.delete_localsources()
    packagefilename = group_entry.localpath
    if isfile(packagefilename):
        remove_file(packagefilename)
    return build_res
Example #3
0
def create_waptwua_package(waptconfigfile,
                           wuagroup='default',
                           wapt_server_user=None,
                           wapt_server_passwd=None,
                           key_password=None):
    """Create/update - upload a package to enable waptwua and set windows_updates_rules
    based on the content of database.
    """
    wapt = common.Wapt(config_filename=waptconfigfile,
                       disable_update_server_status=True)
    wapt.dbpath = r':memory:'
    wapt.use_hostpackages = False
    wapt.filter_on_host_cap = False
    # be sure to be up to date
    wapt.update(register=False)
    packagename = '{}-waptwua-{}'.format(
        wapt.config.get('global', 'default_package_prefix'), wuagroup)
    """
    packages = wapt.is_available(packagename)
    if not packages:
        # creates a new package based on waptwua template
        res = wapt.make_group_template(packagename,directoryname = mkdtemp('wapt'),section='waptwua')
    else:
        res = wapt.edit_package(packagename,target_directory = mkdtemp('wapt'),use_local_sources = False)
    """
    group_entry = wapt.make_group_template(packagename,
                                           directoryname=mkdtemp('wapt'),
                                           section='waptwua')
    build_res = wapt.build_upload(group_entry.sourcespath,
                                  private_key_passwd=key_password,
                                  wapt_server_user=wapt_server_user,
                                  wapt_server_passwd=wapt_server_passwd,
                                  inc_package_release=True)
    group_entry.delete_localsources()
    packagefilename = group_entry.localpath
    if isfile(packagefilename):
        remove_file(packagefilename)
    return build_res