@operation
def repo(
    state, host, name, baseurl,
    present=True, description=None, gpgcheck=True, enabled=True
):

    # Description defaults to name
    description = description or name

    filename = '/etc/yum.repos.d/{0}.repo'.format(name)

    # If we don't want the repo, just remove any existing file
    if not present:
        return files.file(state, host, filename, present=False)

    # Build the repo file from string
    repo = '''
[{name}]
name={description}
baseurl={baseurl}
gpgcheck={gpgcheck}
enabled={enabled}
'''.format(
        name=name, baseurl=baseurl, description=description,
        gpgcheck=1 if gpgcheck else 0,
        enabled=1 if enabled else 0
    )

    repo = StringIO(repo)

    # Ensure this is the file on the server
    commands = files.put(state, host, repo, filename)

    return commands
Get the name of the currently running phase, or None.
dataset/ETHPy150Open Fizzadar/pyinfra/pyinfra/modules/yum.py/repo--crossover with--dataset/ETHPy150Open google/openhtf/openhtf/exe/test_state.py/TestState.GetLastRunPhaseName