INNER CODE UNIT · Python

parse_bool

okd-project/okd · Guides/UPI/okd4-terraform-openstack/inventory/terraform.py:184

def parse_bool(string_form):
    if type(string_form) is bool:
        return string_form

    token = string_form.lower()[0]

    if token == 't':
        return True
    elif token == 'f':
        return False
    else:
        raise ValueError('could not convert %r to a bool' % string_form)


@parses('packet_device')
def packet_device(resource, tfvars=None):
    raw_attrs = resource['primary']['attributes']
    name = raw_attrs['hostname']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…