'Implements interface.'

def add_config(self, options, script):

    name = (options.jenkins_master_name or None)
    address = (options.jenkins_master_address or None)
    user = (options.jenkins_master_user or None)
    if options.jenkins_master_credentials:
        password_file = os.path.basename(options.jenkins_master_credentials)
    elif os.environ.get('JENKINS_MASTER_PASSWORD', None):
        password_file = 'jenkins_{name}_password'.format(name=options.jenkins_master_name)
    else:
        password_file = None
    if (((name is None) != (address is None)) or ((name is None) != (user is None))):
        raise ValueError('Either    all    of    --jenkins_master_name,    --jenkins_master_address,    --jenkins_master_user    or    none    of    them    must    be    supplied.')
    if (name is None):
        return
    if (password_file is None):
        raise ValueError('No    --jenkins_master_credentials    or    JENKINS_MASTER_PASSWORD    environment    variable    was    supplied.')
    script.append('hal    -q    --log=info    config    ci    jenkins    enable')
    script.append('hal    -q    --log=info    config    ci    jenkins    master    add    {name}    --address    {address}    --username    {user}    --password    <    {password_file}'.format(name=options.jenkins_master_name, address=options.jenkins_master_address, user=options.jenkins_master_user, password_file=os.path.basename(password_file)))
