Beispiel #1
0
# Add a config option to the launchpad namespace.  This is effectively the
# default setting for the config option.  Overridden by config files, and then
# cli options.
launchpad.config['foo'] = 'bar'

# Add a cli option to the launchpad namespace.  This overrides the
# coresponding config option if passed
launchpad.options.add_option('-F',
                             '--foo',
                             action='store',
                             dest='foo',
                             help='example launchpad option')

# Officialize and register the namespace
register_namespace(launchpad)


@register_hook(name='ircbot_process_hook')
def new_bug_notify_ircbot_process_hook(config, log, irc):
    """
    Monitor LaunchPad for new bugs, and post to irc.
    """

    lp_ids = []
    first_run = True

    while True:
        log.debug('checking LaunchPad for new bugs')

        lp = Launchpad.login_anonymously('ius-tools', 'production')
Beispiel #2
0
ircbot.config['nick'] = 'iusbot'
ircbot.config['ping_cycle'] = 60
ircbot.config['recv_bytes'] = 2048 
ircbot.config['process_user'] = '******'
ircbot.config['pid_file'] = '/var/run/ius-tools/ircbot.pid'

# command line options
ircbot.options.add_option('--irc-channel', action='store', dest='channel',
    help='the irc channel to join')
ircbot.options.add_option('--irc-nick', action='store', dest='nick',
    help='the irc nick to register as')
ircbot.options.add_option('--run-once', action='store', dest='run_once',
    help='just run a specific ircbot process hook once')

# Officialize and register the namespace
register_namespace(ircbot)

@register_hook()
def post_options_hook(*args, **kw):
    config = get_config()
    if not os.path.exists(config['ircbot']['pid_file']):
        os.makedirs(config['ircbot']['pid_file'])

@register_hook(name='ircbot_process_hook')
def interactive_ircbot_process_hook(config, log, irc):
    """
    This process hook listens on the IRC channel, and responds to interactive
    requests.  NOTE: only one process can do regular 'polls' on the channel.
    """
    while True:
        res = irc.poll()
Beispiel #3
0
from cement.core.namespace import CementNamespace, register_namespace

# Setup the 'example' namespace object
example = CementNamespace(
            label='example3', 
            controller='Example3Controller',
            description='Example Plugin for Cement Test',
            required_api='0.7-0.8:20100210',
            provider='cement_test'
            )
example.config['foo'] = 'bar'
example.options.add_option('-F', '--foo', action='store',
    dest='foo', default=None, help='Example Foo Option'
    )

register_namespace(example)

@register_hook(weight=99)
def my_example_hook():
    return 99

@register_hook(name='my_example_hook')
def some_other_hook_name():
    return 0

@register_hook(weight=-100)
def my_example_hook():
    return -100


Beispiel #4
0
# Setup the 'example' namespace object
example = CementNamespace(label='example3',
                          controller='Example3Controller',
                          description='Example Plugin for Cement Test',
                          required_api='0.7-0.8:20100210',
                          provider='cement_test')
example.config['foo'] = 'bar'
example.options.add_option('-F',
                           '--foo',
                           action='store',
                           dest='foo',
                           default=None,
                           help='Example Foo Option')

register_namespace(example)


@register_hook(weight=99)
def my_example_hook():
    return 99


@register_hook(name='my_example_hook')
def some_other_hook_name():
    return 0


@register_hook(weight=-100)
def my_example_hook():
    return -100
Beispiel #5
0
    label='version_tracker', 
    description='Version Tracker Plugin for IUS Tools',
    version=VERSION,
    controller='VersionTrackerController',
    provider='iustools'
    )

# Directory where Package Configuration is kept
version_tracker.config['pkg_dir'] = '/usr/share/ius-tools/version_tracker/pkgs/'
version_tracker.config['ius_baseurl'] = 'http://dl.iuscommunity.org/pub/ius'

# Layout for output
version_tracker.config['layout'] = '%-30s %-15s %-15s %s'
version_tracker.config['layout_titles'] = ('name', 'ius ver', 'upstream ver', 'status')
    
# Officialize and register the namespace
register_namespace(version_tracker)

# Plugin options
version_tracker.config['launchpad'] = None
version_tracker.options.add_option('--launchpad', action='store_true', dest='launchpad',
    help='if you wish the tool to add Launchpad tickets', default=None)
version_tracker.config['email'] = None
version_tracker.options.add_option('--email', action='store_true', dest='email',
    help='send output in email to configured recipients', default=None)

# Configuration for --email Email notifications
version_tracker.config['fromaddr'] = '*****@*****.**'
version_tracker.config['toaddr'] = '*****@*****.**'
version_tracker.config['subject'] = '[ius-community] IUS Version Tracker'
Beispiel #6
0
"""Bootstrap the package namespace."""

from cement.core.namespace import CementNamespace, register_namespace

package = CementNamespace(
    label='package', 
    controller='PackageController',
    )

package.options.add_option('-p', '--pkg', action='store', dest='full_package', 
    default=None, help='package name-version-release-arch', metavar="PKG")
package.options.add_option('--pkg-name', action='store', dest='name', 
    default=None, help='package name')
package.options.add_option('--pkg-summary', action='store', dest='summary', 
    default=None, help='package summary')
package.options.add_option('--pkg-desc', action='store', dest='description', 
    default=None, help='package description')
package.options.add_option('--pkg-version', action='store', dest='version', 
    default=None, help='package version')
package.options.add_option('--pkg-release', action='store', dest='release', 
    default=None, help='package release')
package.options.add_option('--pkg-arch', action='store', dest='arch', 
    default=None, help='package arch')
package.options.add_option('--pkg-epoch', action='store', dest='epoch', 
    default=None, help='package epoch')
package.options.add_option('--pkg-provider', action='store', dest='provider', 
    default=None, help='package provider')

# Officialize and register the namespace
register_namespace(package)
Beispiel #7
0
admin.config['smtp_from'] = '*****@*****.**'
admin.config['smtp_host'] = 'localhost'
admin.config['smtp_port'] = 25
admin.config['smtp_user'] = ''
admin.config['smtp_password'] = ''
admin.config['smtp_tls'] = False
admin.config['smtp_keyfile'] = '/etc/pki/tls/private/localhost.key'
admin.config['smtp_certfile'] = '/etc/pki/tls/certs/localhost.crt'
admin.config['smtp_subject_prefix'] = '[ius] '
admin.config['gpg_key_file_path'] = '/usr/share/ius-tools/IUS-COMMUNITY-GPG-KEY'
admin.config['eua_file_path'] = '/usr/share/ius-tools/IUS-COMMUNITY-EUA'

# Add a cli option to the admin namespace.  This overrides the 
# coresponding config option if passed
admin.options.add_option('--tag', action='store', dest='tag_label',
    help='tag label')
admin.options.add_option('--sign', action='store_true', dest='sign',
    help='sign stable packages')
admin.options.add_option('--clean', action='store_true', dest='clean',
    help='clean destination repo before creation (used with gen-repo)')
admin.options.add_option('--delete', action='store_true', dest='delete',
    help='delete old files from remote destination')
admin.options.add_option('--passphrase', action='store', 
    dest='gpg_passphrase', help='gpg key passphrase')
    
# Officialize and register the namespace
register_namespace(admin)



Beispiel #8
0
    controller='LaunchPadController',
    provider='iustools'
    )

# Add a config option to the launchpad namespace.  This is effectively the
# default setting for the config option.  Overridden by config files, and then
# cli options.
launchpad.config['foo'] = 'bar'

# Add a cli option to the launchpad namespace.  This overrides the 
# coresponding config option if passed
launchpad.options.add_option('-F', '--foo', action='store', dest='foo',
    help='example launchpad option')

# Officialize and register the namespace
register_namespace(launchpad)


@register_hook(name='ircbot_process_hook')
def new_bug_notify_ircbot_process_hook(config, log, irc):
    """
    Monitor LaunchPad for new bugs, and post to irc.
    """

    lp_ids = []
    first_run = True

    while True:
        log.debug('checking LaunchPad for new bugs')
        
        lp = Launchpad.login_anonymously('ius-tools', 'production')
Beispiel #9
0
errata.options.add_option('--rpms', action='store', dest='rpms', 
    default=None, help="rpm(s) path (i.e '/path/to/*.rpm') [quoted]", metavar="PATH")    
errata.options.add_option('--srpm', action='store', dest='srpm', 
    default=None, help='source rpm path (i.e /path/to/foo-1.2-3.srpm)', metavar="PATH")    
errata.options.add_option('--channels-file', action='store', 
    dest='channels_file', default=None, 
    help='channels list file (one per line)', metavar="PATH")
errata.options.add_option('--synopsis', action='store', dest='synopsis', 
    default=None, help="errata synopsis (summary)", metavar="TEXT")    
errata.options.add_option('--topic', action='store', dest='topic', 
    default=None, help="errata topic", metavar="TEXT")    
errata.options.add_option('--product', action='store', dest='product', 
    default=None, help="errata product", metavar="TEXT")    
errata.options.add_option('--description', action='store', dest='description', 
    default=None, help="errata description", metavar="TEXT")    
errata.options.add_option('--references', action='store', dest='references', 
    default=None, help="errata references", metavar="TEXT")    
errata.options.add_option('--notes', action='store', dest='notes', 
    default=None, help="errata notes", metavar="TEXT")    
errata.options.add_option('--solution', action='store', dest='solution', 
    default=None, help="errata solution", metavar="TEXT")    
errata.options.add_option('--keywords', action='store', dest='keywords', 
    default=None, help="errata keywords (comma separated)", metavar="STR")    
errata.options.add_option('--type', action='store', dest='advisory_type', 
    default=None, help="errata type [bug, enhancement, security]", metavar="STR")    
errata.options.add_option('--publish', action='store_true', dest='publish', 
    default=None, help="whether to publish errata")    

# Officialize and register the namespace
register_namespace(errata)
Beispiel #10
0
# command line options
ircbot.options.add_option('--irc-channel',
                          action='store',
                          dest='channel',
                          help='the irc channel to join')
ircbot.options.add_option('--irc-nick',
                          action='store',
                          dest='nick',
                          help='the irc nick to register as')
ircbot.options.add_option('--run-once',
                          action='store',
                          dest='run_once',
                          help='just run a specific ircbot process hook once')

# Officialize and register the namespace
register_namespace(ircbot)


@register_hook()
def post_options_hook(*args, **kw):
    config = get_config()
    if not os.path.exists(config['ircbot']['pid_file']):
        os.makedirs(config['ircbot']['pid_file'])


@register_hook(name='ircbot_process_hook')
def interactive_ircbot_process_hook(config, log, irc):
    """
    This process hook listens on the IRC channel, and responds to interactive
    requests.  NOTE: only one process can do regular 'polls' on the channel.
    """
Beispiel #11
0
    'gpg_key_file_path'] = '/usr/share/ius-tools/IUS-COMMUNITY-GPG-KEY'
admin.config['eua_file_path'] = '/usr/share/ius-tools/IUS-COMMUNITY-EUA'

# Add a cli option to the admin namespace.  This overrides the
# coresponding config option if passed
admin.options.add_option('--tag',
                         action='store',
                         dest='tag_label',
                         help='tag label')
admin.options.add_option('--sign',
                         action='store_true',
                         dest='sign',
                         help='sign stable packages')
admin.options.add_option(
    '--clean',
    action='store_true',
    dest='clean',
    help='clean destination repo before creation (used with gen-repo)')
admin.options.add_option('--delete',
                         action='store_true',
                         dest='delete',
                         help='delete old files from remote destination')
admin.options.add_option('--passphrase',
                         action='store',
                         metavar='STR',
                         dest='gpg_passphrase',
                         help='gpg key passphrase')

# Officialize and register the namespace
register_namespace(admin)
Beispiel #12
0
channel.options.add_option('--chan-summary', action='store', dest='summary',
    default=None, help='channel summary')
channel.options.add_option('--chan-desc', action='store', dest='description',
    default=None, help='channel summary', metavar="DESC")
channel.options.add_option('--chan-maint-name', action='store', 
    dest='maintainer_name', default=None, help="channel maintainer's name",
    metavar="NAME")
channel.options.add_option('--chan-maint-email', action='store', 
    dest='maintainer_email', default=None, help="channel maintainer's email",
    metavar="EMAIL")
channel.options.add_option('--chan-maint-phone', action='store', 
    dest='maintainer_phone', default=None, help="channel maintainer's phone",
    metavar="PHONE")
channel.options.add_option('--chan-gpg-url', action='store', dest='gpg_key_url',
    default=None, help="channel gpg key url")
channel.options.add_option('--chan-gpg-id', action='store', dest='gpg_key_id',
    default=None, help="channel gpg key id")
channel.options.add_option('--chan-gpg-fp', action='store', dest='gpg_key_fp',
    default=None, help="channel gpg key finger print")
channel.options.add_option('--chan-eol', action='store', dest='end_of_life',
    default=None, help="channel end of life")
channel.options.add_option('--chan-parent', action='store', 
    dest='parent_channel_label', default=None, help="channel parent label",
    metavar='LABEL')
channel.options.add_option('--rpms', action='store', dest='rpms', 
    default=None, help="rpm(s) path (i.e '/path/to/*.rpm') [quoted]", metavar="PATH")    
channel.options.add_option('--srpms', action='store', dest='srpms', 
    default=None, help='source rpms path (i.e /path/to/*.srpm)', metavar="PATH")    
# Officialize and register the namespace
register_namespace(channel)
Beispiel #13
0
    version=VERSION,
    controller='VersionTrackerController',
    provider='iustools')

# Directory where Package Configuration is kept
version_tracker.config[
    'pkg_dir'] = '/usr/share/ius-tools/version_tracker/pkgs/'
version_tracker.config['ius_baseurl'] = 'http://dl.iuscommunity.org/pub/ius'

# Layout for output
version_tracker.config['layout'] = '%-30s %-15s %-15s %s'
version_tracker.config['layout_titles'] = ('name', 'ius ver', 'upstream ver',
                                           'status')

# Officialize and register the namespace
register_namespace(version_tracker)

# Plugin options
version_tracker.config['launchpad'] = None
version_tracker.options.add_option(
    '--launchpad',
    action='store_true',
    dest='launchpad',
    help='if you wish the tool to add Launchpad tickets',
    default=None)
version_tracker.config['email'] = None
version_tracker.options.add_option(
    '--email',
    action='store_true',
    dest='email',
    help='send output in email to configured recipients',
Beispiel #14
0
from cement.core.hook import register_hook
from cement.core.namespace import CementNamespace, register_namespace, \
                                  get_config
                                  

config = get_config()
mirror = CementNamespace(
    label='mirror', 
    controller='MirrorController'
    )

mirror.config['verify'] = False
mirror.config['mirror_dir'] = os.path.join(config['datadir'], 'mirror')
mirror.options.add_option('-V', '--verify', action='store_true',
    dest='verify', default=None, help='Verify MD5 of files (costly)')
mirror.options.add_option('--channel', action='store',
    dest='channel', default=None, help='channel to sync/mirror')    
register_namespace(mirror)
    
@register_hook()
def validate_config_hook(*args, **kwargs):
    config = get_config('mirror')
    required_settings = ['mirror_dir']
    for s in required_settings:
        if not config.has_key(s):
            raise CementConfigError, "config['mirror']['%s'] value missing!" % s
    
    if not os.path.exists(config['mirror_dir']):
        os.makedirs(config['mirror_dir'])