Skip to content
This repository has been archived by the owner on Apr 28, 2018. It is now read-only.

Commit

Permalink
Added private BETA repository support
Browse files Browse the repository at this point in the history
  • Loading branch information
dsokoloski committed Oct 29, 2013
1 parent 7ccdbef commit 20160d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
19 changes: 14 additions & 5 deletions clearcenter-marketplace.py
Expand Up @@ -10,20 +10,21 @@
import shutil

from urlparse import urlparse
from yum.plugins import PluginYumExit, TYPE_CORE
from yum.plugins import PluginYumExit, TYPE_INTERACTIVE
from yum.yumRepo import YumRepository as Repository
from xml.etree.ElementTree import parse

requires_api_version = '2.3'
plugin_type = (TYPE_CORE,)
plugin_type = (TYPE_INTERACTIVE,)

class wcRepo:
def __init__(self, arch):
def __init__(self, arch, enablebeta):

self.url = sdn_url
self.request = sdn_request
self.method = sdn_method
self.basearch = arch
self.enablebeta = enablebeta

if os.getenv('SDN_URL') != None:
self.url = os.getenv('SDN_URL')
Expand Down Expand Up @@ -90,7 +91,7 @@ def fetch(self):
params = {
'method': self.method, 'hostkey': hostkey,
'vendor': osvendor, 'osname': osname, 'osversion': osversion,
'arch': self.basearch }
'arch': self.basearch, 'enablebeta': str(self.enablebeta) }
request = "%s?%s" %(self.request, urllib.urlencode(params))

hc = httplib.HTTPSConnection(self.url)
Expand Down Expand Up @@ -146,6 +147,12 @@ def parse_kv_line(self, line):
kv[k] = v.rstrip()
return kv

def config_hook(conduit):
parser = conduit.getOptParser()
parser.add_option('', '--enablebeta', dest='enablebeta',
action='store_true', default=False,
help="enable one ore more ClearOS BETA repositories")

def init_hook(conduit):
global sdn_url, sdn_request, sdn_method

Expand All @@ -160,7 +167,9 @@ def prereposetup_hook(conduit):
global wc_repos

conduit.info(2, 'ClearCenter Marketplace: fetching repositories...')
wc_repo = wcRepo(conduit._base.arch.basearch)

opts, commands = conduit.getCmdLine()
wc_repo = wcRepo(conduit._base.arch.basearch, opts.enablebeta)

try:
wc_repos = wc_repo.fetch()
Expand Down
5 changes: 4 additions & 1 deletion yum-marketplace-plugin.spec
@@ -1,5 +1,5 @@
Name: yum-marketplace-plugin
Version: 1.4
Version: 1.5
Release: 1%{?dist}
Summary: Yum plugin to access ClearCenter Marketplace
Group: System Environment/Base
Expand Down Expand Up @@ -34,6 +34,9 @@ rm -rf %{buildroot}
/usr/lib/yum-plugins/clearcenter-marketplace.*

%changelog
* Tue Oct 29 2013 ClearCenter <developer@clearcenter.com> - 1.5-1
- Added private BETA repository support

* Thu Dec 06 2012 ClearCenter <developer@clearcenter.com> - 1.3-3
- Bumped web service version to 1.1

Expand Down

0 comments on commit 20160d6

Please sign in to comment.