Esempio n. 1
0
def check_obligatory_params():
    l = get_obligatory_params()
    ll = map(lambda x: x[0],
             filter(lambda x: x[1] is None,
                    l.items()))
    if len(ll):
        return c.print_and_exit(c.write_log('Not set: %s' % ','.join(ll),
                                            'e'),
                                1)
    return l
Esempio n. 2
0
def check_version(version):
    def do_check():
        return version in map(lambda x: x.text,
                               ET.fromstring(c.get_url(
                                   format_base_nexus_url(check_obligatory_params()) +
                                   '/maven-metadata.xml')).findall('versioning/versions/*'))
    if not do_check():
       return c.print_and_exit(c.write_log('No such version in this repo',
                                         'e'),
                               3)
    return version
Esempio n. 3
0
def get_artifacts():
    arts = map(lambda x: x.text,
               ET.fromstring(c.get_url(
                   format_version_nexus_url(
                       check_version(
                           reduce_to_mcv_2())))).findall('data/*/text'))

    lv = sorted(
            filter(lambda x: x is not None,
               list(set(map(
                      lambda x: c.get_or_none(re.split(version_splitter(), x),
                                1),
                      arts)))),
        key=lambda x: x.split('-')[-1])
    if get_behavior() == 'E':
        iv = c.getenv_or_exit('VERSION')
        return filter(lambda x: iv in x, arts) if iv in lv else \
            c.print_and_exit(c.write_log('No such version',
                                     'e'),
                           3)
    else:
        return filter(lambda x: lv[-1] in x, arts)