Skip to content

Commit c02b29e

Browse files
committed
Adjust formatting so that help and type leads the contents
Signed-off-by: Monica Hanson <[email protected]>
1 parent eb227f4 commit c02b29e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

iptables.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def gather_tables():
5555
iptables_packet_lines.append('%s_packets_total{table="%s",chain="%s",line_number=%s,target="%s",prot="%s",in="%s",out="%s",src="%s",dest="%s",opt="%s"} %s' % (ip_proto,table,l_chain_name,l_line_number,l_target,l_prot,l_in,l_out,l_src,l_dest,l_options,l_packets))
5656
iptables_byte_lines.append('%s_bytes_total{table="%s",chain="%s",line_number=%s,target="%s",prot="%s",in="%s",out="%s",src="%s",dest="%s",opt="%s"} %s' % (ip_proto,table,l_chain_name,l_line_number,l_target,l_prot,l_in,l_out,l_src,l_dest,l_options,l_bytes))
5757

58-
iptables_packet_lines.append(f'# HELP {ip_proto}_packets_total packet counters for {ip_proto} rules.')
59-
iptables_packet_lines.append(f'# TYPE {ip_proto}_packets_total counter')
58+
packet_lines_helper = f'# HELP {ip_proto}_packets_total packet counters for {ip_proto} rules.'
59+
packet_lines_type = f'# TYPE {ip_proto}_packets_total counter'
6060

61-
iptables_byte_lines.append(f'# HELP {ip_proto}_bytes_total byte counters for {ip_proto} rules.')
62-
iptables_byte_lines.append(f'# TYPE {ip_proto}_bytes_total counter')
61+
byte_lines_helper = f'# HELP {ip_proto}_bytes_total byte counters for {ip_proto} rules.'
62+
byte_lines_type = f'# TYPE {ip_proto}_bytes_total counter'
6363

64-
return '\n'.join(iptables_packet_lines) + '\n' + '\n'.join(iptables_byte_lines)
64+
return f"{packet_lines_helper}\n{packet_lines_type}\n{'\n'.join(iptables_packet_lines)}\n{byte_lines_helper}\n{byte_lines_type}\n{'\n'.join(iptables_byte_lines)}"
6565

6666
if __name__ == "__main__":
6767
print(gather_tables())

0 commit comments

Comments
 (0)