def remove_domain_from_fqdn(opts, newid):
    '''
    Depending on the values of `minion_id_remove_domain`,
    remove all domains or a single domain from a FQDN, effectivly generating a hostname.
    '''
    opt_domain = opts.get('minion_id_remove_domain')
    if opt_domain is True:
        if '.' in newid:
            # Remove any domain
            newid, xdomain = newid.split('.', 1)
            log.debug('Removed any domain (%s) from minion id.', xdomain)
    else:
        # Must be string type
        if newid.upper().endswith('.' + opt_domain.upper()):
            # Remove single domain
            newid = newid[:-len('.' + opt_domain)]
            log.debug('Removed single domain %s from minion id.', opt_domain)
    return newid
def remove_domain_from_fqdn ( opts , newid ) : opt_domain = opts . get ( 'minion_id_remove_domain' ) if opt_domain is True : if '.' in newid : newid , xdomain = newid . split ( '.' , 1 ) log . debug ( 'Removed any domain (%s) from minion id.' , xdomain ) else : if newid . upper ( ) . endswith ( '.' + opt_domain . upper ( ) ) : newid = newid [ : - len ( '.' + opt_domain ) ] log . debug ( 'Removed single domain %s from minion id.' , opt_domain ) return newid
Depending on the values of `minion_id_remove_domain`,
    remove all domains or a single domain from a FQDN, effectivly generating a hostname.