当前位置: 首页>>代码示例>>Python>>正文


Python rhnAction.schedule_server_action函数代码示例

本文整理汇总了Python中spacewalk.server.rhnAction.schedule_server_action函数的典型用法代码示例。如果您正苦于以下问题:Python schedule_server_action函数的具体用法?Python schedule_server_action怎么用?Python schedule_server_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了schedule_server_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: subscribe_to_tools_channel

def subscribe_to_tools_channel(server_id, kickstart_session_id):
    log_debug(3)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row['org_id']
    scheduler = row['scheduler']
    ks_type_id = row['virtualization_type']
    ks_type = _get_ks_virt_type(ks_type_id)

    if ks_type == 'para_host':
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type='kickstart_host.add_tools_channel',
            action_name='Subscribe server to the Tools channel.',
            delta_time=0, scheduler=scheduler, org_id=org_id,
        )
    elif ks_type == 'para_guest':
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type='kickstart_guest.add_tools_channel',
            action_name='Subscribe guest to the Tools channel.',
            delta_time=0, scheduler=scheduler, org_id=org_id,
        )
    else:
        action_id = None
    return action_id
开发者ID:m47ik,项目名称:uyuni,代码行数:25,代码来源:server_kickstart.py

示例2: schedule_virt_pkg_install

def schedule_virt_pkg_install(server_id, kickstart_session_id):
    log_debug(3)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row['org_id']
    scheduler = row['scheduler']
    ks_type_id = row['virtualization_type']
    log_debug(1, "VIRTUALIZATION_TYPE: %s" % str(ks_type_id))
    ks_type = _get_ks_virt_type(ks_type_id)
    log_debug(1, "VIRTUALZIATION_TYPE_LABEL: %s" % str(ks_type))

    if ks_type == 'para_host':
        log_debug(1, "SCHEDULING VIRT HOST PACKAGE INSTALL...")
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type='kickstart_host.schedule_virt_host_pkg_install',
            action_name="Schedule install of rhn-virtualization-host package.",
            delta_time=0, scheduler=scheduler, org_id=org_id,
        )
    elif ks_type == 'para_guest':
        log_debug(1, "SCHEDULING VIRT GUEST PACKAGE INSTALL...")
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type='kickstart_guest.schedule_virt_guest_pkg_install',
            action_name="Schedule install of rhn-virtualization-guest package.",
            delta_time=0, scheduler=scheduler, org_id=org_id,
        )
    else:
        log_debug(1, "NOT A VIRT KICKSTART")
        action_id = None

    return action_id
开发者ID:m47ik,项目名称:uyuni,代码行数:31,代码来源:server_kickstart.py

示例3: subscribe_to_tools_channel

def subscribe_to_tools_channel(server_id, kickstart_session_id):
    log_debug(3)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row["org_id"]
    scheduler = row["scheduler"]
    ks_type_id = row["virtualization_type"]
    ks_type = _get_ks_virt_type(ks_type_id)

    if ks_type == "para_host":
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type="kickstart_host.add_tools_channel",
            action_name="Subscribe server to RHN Tools channel.",
            delta_time=0,
            scheduler=scheduler,
            org_id=org_id,
        )
    elif ks_type == "para_guest":
        action_id = rhnAction.schedule_server_action(
            server_id,
            action_type="kickstart_guest.add_tools_channel",
            action_name="Subscribe guest to RHN Tools channel.",
            delta_time=0,
            scheduler=scheduler,
            org_id=org_id,
        )
    else:
        action_id = None
    return action_id
开发者ID:kidaa30,项目名称:spacewalk,代码行数:29,代码来源:server_kickstart.py

示例4: schedule_deploy

def schedule_deploy(server_id, action_id, dry_run=0):
    log_debug(2, server_id, action_id)
    s = rhnServer.search(server_id)

    # Schedule an rhncfg install
    new_action_id = server_kickstart.schedule_rhncfg_install(server_id,
        action_id, scheduler=None)

    new_action_id_2 = rhnAction.schedule_server_action(
        server_id,
        action_type='configfiles.deploy',
        action_name="Activation Key Config Auto-Deploy",
        delta_time=0, scheduler=None,
        org_id=s.server['org_id'],
        prerequisite=new_action_id,
        )

    if (not dry_run):
        h = rhnSQL.prepare(_query_copy_revs_from_shadow_action)
        h.execute(action_id=action_id, new_action_id=new_action_id_2,
            server_id=server_id)
    else:
        log_debug(4, "dry run requested")

    log_debug(4, "scheduled config deploy for activation key")

    raise ShadowAction("Config deploy scheduled")
开发者ID:T-D-Oe,项目名称:spacewalk,代码行数:27,代码来源:activation.py

示例5: schedule_kickstart_delta

def schedule_kickstart_delta(server_id, kickstart_session_id,
                             installs, removes):
    log_debug(3, server_id, kickstart_session_id)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row['org_id']
    scheduler = row['scheduler']

    action_id = rhnAction.schedule_server_action(
        server_id,
        action_type='packages.runTransaction', action_name="Package delta",
        delta_time=0, scheduler=scheduler, org_id=org_id,
    )

    package_delta_id = rhnSQL.Sequence('rhn_packagedelta_id_seq').next()

    h = rhnSQL.prepare(_query_insert_package_delta)
    h.execute(package_delta_id=package_delta_id)

    h = rhnSQL.prepare(_query_insert_action_package_delta)
    h.execute(action_id=action_id, package_delta_id=package_delta_id)

    h = rhnSQL.prepare(_query_insert_package_delta_element)
    col_names = ['n', 'v', 'r', 'e']
    __execute_many(h, installs, col_names, operation='insert', a=None,
                   package_delta_id=package_delta_id)
    __execute_many(h, removes, col_names, operation='delete', a=None,
                   package_delta_id=package_delta_id)

    update_ks_session_table(kickstart_session_id, 'package_synch_scheduled',
                            action_id, server_id)

    return action_id
开发者ID:m47ik,项目名称:uyuni,代码行数:32,代码来源:server_kickstart.py

示例6: schedule_config_deploy

def schedule_config_deploy(server_id, action_id, kickstart_session_id, server_profile):
    """ schedule a configfiles.deploy action dependent on the current action """
    log_debug(3, server_id, action_id, kickstart_session_id)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row["org_id"]
    scheduler = row["scheduler"]
    deploy_configs = row["deploy_configs"] == "Y" and ks_activation_key_deploy_config(kickstart_session_id)

    if not deploy_configs:
        # Nothing more to do here
        update_ks_session_table(kickstart_session_id, "complete", next_action_id=None, server_id=server_id)
        return None

    if server_profile:
        # Have to schedule a package deploy action
        aid = schedule_rhncfg_install(server_id, action_id, scheduler, server_profile)
    else:
        aid = action_id

    next_action_id = rhnAction.schedule_server_action(
        server_id,
        action_type="configfiles.deploy",
        action_name="Deploy config files",
        delta_time=0,
        scheduler=scheduler,
        org_id=org_id,
        prerequisite=aid,
    )
    # Deploy all of the config files that are part of this server's config
    # channels
    h = rhnSQL.prepare(_query_schedule_config_files)
    h.execute(server_id=server_id, action_id=next_action_id)
    update_ks_session_table(kickstart_session_id, "configuration_deploy", next_action_id, server_id)
    return next_action_id
开发者ID:kidaa30,项目名称:spacewalk,代码行数:34,代码来源:server_kickstart.py

示例7: schedule_kickstart_delta

def schedule_kickstart_delta(server_id, kickstart_session_id, installs, removes):
    log_debug(3, server_id, kickstart_session_id)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row["org_id"]
    scheduler = row["scheduler"]

    action_id = rhnAction.schedule_server_action(
        server_id,
        action_type="packages.runTransaction",
        action_name="Package delta",
        delta_time=0,
        scheduler=scheduler,
        org_id=org_id,
    )

    package_delta_id = rhnSQL.Sequence("rhn_packagedelta_id_seq").next()

    h = rhnSQL.prepare(_query_insert_package_delta)
    h.execute(package_delta_id=package_delta_id)

    h = rhnSQL.prepare(_query_insert_action_package_delta)
    h.execute(action_id=action_id, package_delta_id=package_delta_id)

    h = rhnSQL.prepare(_query_insert_package_delta_element)
    col_names = ["n", "v", "r", "e"]
    __execute_many(h, installs, col_names, operation="insert", a=None, package_delta_id=package_delta_id)
    __execute_many(h, removes, col_names, operation="delete", a=None, package_delta_id=package_delta_id)

    update_ks_session_table(kickstart_session_id, "package_synch_scheduled", action_id, server_id)

    return action_id
开发者ID:kidaa30,项目名称:spacewalk,代码行数:31,代码来源:server_kickstart.py

示例8: schedule_config_deploy

def schedule_config_deploy(server_id, action_id, kickstart_session_id,
        server_profile):
    log_debug(3, server_id, action_id, kickstart_session_id)
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row['org_id']
    scheduler = row['scheduler']
    deploy_configs = (row['deploy_configs'] == 'Y')

    if not deploy_configs:
        # Nothing more to do here
        update_ks_session_table(kickstart_session_id, 'complete',
            next_action_id=None, server_id=server_id)
        return None

    if server_profile:
        # Have to schedule a package deploy action
        aid = schedule_rhncfg_install(server_id, action_id, scheduler,
            server_profile)
    else:
        aid = action_id

    next_action_id = rhnAction.schedule_server_action(
        server_id,
        action_type='configfiles.deploy',
        action_name='Deploy config files',
        delta_time=0, scheduler=scheduler, org_id=org_id,
        prerequisite=aid,
    )
    # Deploy all of the config files that are part of this server's config
    # channels
    h = rhnSQL.prepare(_query_schedule_config_files)
    h.execute(server_id=server_id, action_id=next_action_id)
    update_ks_session_table(kickstart_session_id, 'configuration_deploy',
        next_action_id, server_id)
    return next_action_id
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:35,代码来源:server_kickstart.py

示例9: schedule_kickstart_sync

def schedule_kickstart_sync(server_id, kickstart_session_id):
    row = get_kickstart_session_info(kickstart_session_id, server_id)
    org_id = row['org_id']
    scheduler = row['scheduler']

    # Create a new action
    action_id = rhnAction.schedule_server_action(
        server_id,
        action_type='kickstart.schedule_sync',
        action_name="Schedule a package sync",
        delta_time=0, scheduler=scheduler, org_id=org_id,
    )
    return action_id
开发者ID:m47ik,项目名称:uyuni,代码行数:13,代码来源:server_kickstart.py

示例10: schedule_package_install

def schedule_package_install(server_id, action_id, scheduler, packages):
    if not packages:
        # Nothing to do
        return action_id
    new_action_id = rhnAction.schedule_server_action(
        server_id, action_type='packages.update',
        action_name="Package update to enable configuration deployment",
        delta_time=0, scheduler=scheduler, prerequisite=action_id,
    )
    # Add entries to rhnActionPackage
    action_ids = [new_action_id] * len(packages)
    h = rhnSQL.prepare(_query_insert_action_packages)
    h.executemany(action_id=action_ids, package_id=packages)
    return new_action_id
开发者ID:m47ik,项目名称:uyuni,代码行数:14,代码来源:server_kickstart.py

示例11: deploy_configs_if_needed

def deploy_configs_if_needed(server):
    server_id = server['id']
    log_debug(4, server_id)
    # determine if there are actually any files to be deployed...
    revisions = {}

    h = rhnSQL.prepare(_query_token_latest_revisions)
    h.execute(server_id=server_id)

    while 1:
        row = h.fetchone_dict()
        if not row:
            break

        # only care about the 1st revision of a particular path due to
        # sql ordering...
        if not revisions.has_key(row['path']):
            revisions[row['path']] = row['revision_id']

    if not len(revisions):
        return None

    # Get the latest action scheduled for this token
    last_action_id = rhnFlags.get('token_last_action_id')

    action_id = rhnAction.schedule_server_action(
        server_id,
        action_type='activation.schedule_deploy',
        action_name="Activation Key Config File Deployment",
        delta_time=0, scheduler=None,
        org_id=server['org_id'],
        prerequisite=last_action_id,
    )

    # This action becomes the latest now
    rhnFlags.set('token_last_action_id', action_id)

    log_debug(4, "scheduled activation key config deploy")

    h = rhnSQL.prepare(_query_add_revision_to_action)
    # XXX should use executemany() or execute_bulk
    for revision_id in revisions.values():
        log_debug(5, action_id, revision_id)
        h.execute(server_id=server_id,
                  action_id=action_id,
                  config_revision_id=revision_id)

    return action_id
开发者ID:flavio,项目名称:spacewalk,代码行数:48,代码来源:server_token.py

示例12: schedule_package_install

    def schedule_package_install(self):
        """
            Public function that schedules self.package for installation during the next rhn_check.
        """
        org_id, scheduler = self._get_action_info(self.this_action_id)

        self.new_action_id = rhnAction.schedule_server_action(
            self.server_id,
            action_type="packages.update",
            action_name="Scheduling install of RHN's virtualization host packages.",
            delta_time=0,
            scheduler=scheduler,
            org_id=org_id
        )

        self._add_package_to_install_action(self.new_action_id)
开发者ID:TJM,项目名称:spacewalk,代码行数:16,代码来源:utils.py

示例13: schedule_pkg_install

def schedule_pkg_install(server_id, action_id, dry_run=0):
    s = rhnServer.search(server_id)

    new_action_id = rhnAction.schedule_server_action(
        server_id,
        action_type='packages.update',
        action_name="Activation Key Package Auto-Install",
        delta_time=0, scheduler=None,
        org_id=s.server['org_id'],
        )

    if (not dry_run):
        h = rhnSQL.prepare(_query_copy_pkgs_from_shadow_action)
        h.execute(action_id=action_id, new_action_id=new_action_id)
    else:
        log_debug(4, "dry run requested")

    log_debug(4, "scheduled pkg install for activation key")

    raise ShadowAction("Package install scheduled")
开发者ID:T-D-Oe,项目名称:spacewalk,代码行数:20,代码来源:activation.py

示例14: look_at_actions

def look_at_actions(server_id):
    h = rhnSQL.prepare(_query_action_lookup)
    h.execute(server_id=server_id)
    return h.fetchall_dict()


if __name__ == "__main__":
    myserver = TestServer()
    #myserver.upload_packages('/home/devel/wregglej/rpmtest')
    #handler = rhnHandler()
    #print handler.auth_system( myserver.getSystemId() )
    #up2date = myserver.getUp2date()
    #id = myserver.getSystemId()
    #print up2date.solvedep( id, ['libcaps.so'] )
    #print "Done!"
    #rhnserver = rhnServer.Server(myserver.testuser, org_id=myserver.org_id)

    fake_key = create_activation_key(org_id=myserver.org_id, user_id=myserver.testuser.getid(), channels=[myserver.label], server_id=myserver.getServerId())
    fake_action = rhnAction.schedule_server_action(myserver.getServerId(), "packages.update", action_name="Testing", delta_time=9999, org_id=myserver.org_id)
    fake_token = rhnServer.search_token(fake_key._token)

    print look_at_actions(myserver.getServerId())

    rhnFlags.set("registration_token", fake_token)
    myserver.testserver.use_token()

    print look_at_actions(myserver.getServerId())

    rhnAction.invalidate_action(myserver.getServerId(), fake_action)
    rhnSQL.rollback()
开发者ID:Kilian-Petsch,项目名称:spacewalk,代码行数:30,代码来源:TestServer.py

示例15: rhnActionDaemonConfig

#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
from spacewalk.server import rhnSQL, rhnAction

rhnSQL.initDB('rhnuser/[email protected]')

server_id = 1003486768
try:
    action_id = rhnAction.schedule_server_action(server_id, 'rhnsd.configure')

    h = rhnSQL.prepare("""
        insert into rhnActionDaemonConfig (action_id, interval)
        values (:action_id, 10)
    """)
    h.execute(action_id=action_id)

except:
    rhnSQL.rollback()
    raise
rhnSQL.commit()
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:30,代码来源:test_action_rhnsd_config.py


注:本文中的spacewalk.server.rhnAction.schedule_server_action函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。