Skip to content

Commit

Permalink
Logrotate: Fix flake checks
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
  • Loading branch information
fastiuk committed May 21, 2024
1 parent fb95e49 commit 110cb43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7772,7 +7772,7 @@ def logrotate(ctx, file):
@click.argument('disk_percentage', metavar='<disk-percentage>',
required=True, type=float)
def disk_percentage(ctx, disk_percentage):
"""Configuring logrotate disk-precentage file <syslog|debug> <disk_percentage>"""
"""Configuring logrotate disk-precentage"""
file = ctx.parent.params.get('file')
if 0 > disk_percentage > 100:
click.echo(f'Disk percentage {disk_percentage} is not in range [0 - 100]')
Expand All @@ -7784,13 +7784,13 @@ def disk_percentage(ctx, disk_percentage):
{'disk_percentage': disk_percentage})


@logrotate.command()
@logrotate.command(name='frequency')
@click.pass_context
@click.argument('frequency', metavar='<daily|weekly|monthly|yearly>',
required=True,
type=click.Choice(['daily', 'weekly', 'monthly', 'yearly']))
def frequency(ctx, frequency):
"""Configuring logrotate frequency file <syslog|debug> <frequency>"""
def logrotate_frequency(ctx, frequency):
"""Configuring logrotate rotation frequency"""
file = ctx.parent.params.get('file')
config_db = ConfigDBConnector()
config_db.connect()
Expand All @@ -7803,19 +7803,19 @@ def frequency(ctx, frequency):
@click.argument('max_number', metavar='<max-number>',
type=click.IntRange(0, 999999), required=True)
def max_number(ctx, max_number):
"""Configuring logrotate max-number file <syslog|debug> <max_number>"""
"""Configuring logrotate max-number of files"""
file = ctx.parent.params.get('file')
config_db = ConfigDBConnector()
config_db.connect()
config_db.mod_entry(swsscommon.CFG_LOGGING_TABLE_NAME, file,
{'max_number': max_number})


@logrotate.command()
@logrotate.command(name='size')
@click.pass_context
@click.argument('size', metavar='<size>', type=float, required=True)
def size(ctx, size):
"""Configuring logrotate size file <syslog|debug> <size>"""
def logrotate_size(ctx, size):
"""Configuring logrotate size of file"""
file = ctx.parent.params.get('file')
if 0.001 > size > 3500.0:
click.echo(f'Size {disk_percentage} is not in range [0.001 - 3500.0]')
Expand Down
2 changes: 1 addition & 1 deletion show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,7 @@ def logrotate(db):

table.append((key, disk_percentage, frequency, max_number, size))

hdrs = ['file', 'disk-percentage', 'frequency', 'max-number', 'size']
hdrs = ['file', 'disk-percentage', 'frequency', 'max-number', 'size']
click.echo(tabulate(table, headers=hdrs, tablefmt='simple', missingval=''))


Expand Down

0 comments on commit 110cb43

Please sign in to comment.