Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
smradius
smradius
Commits
09ae3f2d
Commit
09ae3f2d
authored
Feb 04, 2017
by
Nigel Kukard
Browse files
Fixed spelling with Topup
parent
d0d9e46b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/smradius/modules/features/mod_feature_capping.pm
View file @
09ae3f2d
...
...
@@ -641,20 +641,20 @@ sub _doAutoTopup
# Booleanize the attribute and check if its enabled
if
(
my
$enabled
=
booleanize
(
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-Enabled
")))
{
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoToups for %s is enabled
',
$type
);
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups for %s is enabled
',
$type
);
}
else
{
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] AutoToups for %s is not enabled
',
$type
);
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups for %s is not enabled
',
$type
);
return
;
}
# Do sanity checks on the auto-topup amount
my
$autoTopupAmount
=
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-Amount
");
if
(
!
defined
(
$autoTopupAmount
))
{
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s-Amount must have a value
',
$typeKey
);
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s-Amount must have a value
',
$typeKey
);
return
;
}
if
(
!
isNumber
(
$autoTopupAmount
)){
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s-Amount must be a number and be > 0, instead it was
'
.
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s-Amount must be a number and be > 0, instead it was
'
.
'
\'
%s
\'
, IGNORING SMRadius-AutoTopup-%s-Enabled
',
$typeKey
,
$autoTopupAmount
,
$typeKey
);
return
;
}
...
...
@@ -662,7 +662,7 @@ sub _doAutoTopup
# Do sanity checks on the auto-topup threshold
my
$autoTopupThreshold
=
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-Threshold
");
if
(
defined
(
$autoTopupThreshold
)
&&
!
isNumber
(
$autoTopupThreshold
)){
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s-Threshold must be a number and be > 0, instead it was
'
.
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s-Threshold must be a number and be > 0, instead it was
'
.
'
\'
%s
\'
, IGNORING SMRadius-AutoTopup-%s-Threshold
',
$typeKey
,
$autoTopupAmount
,
$typeKey
);
$autoTopupThreshold
=
undef
;
}
...
...
@@ -670,7 +670,7 @@ sub _doAutoTopup
# Check that if the auto-topup limit is defined, that it is > 0
my
$autoTopupLimit
=
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-Limit
");
if
(
defined
(
$autoTopupLimit
)
&&
!
isNumber
(
$autoTopupLimit
))
{
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s-Limit must be a number and be > 0, instead it was
'
.
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s-Limit must be a number and be > 0, instead it was
'
.
'
\'
%s
\'
, IGNORING SMRadius-AutoTopup-%s-Enabled
',
$typeKey
,
$autoTopupAmount
,
$typeKey
);
return
;
}
...
...
@@ -683,12 +683,12 @@ sub _doAutoTopup
# Check if we're still within our usage limit and return
if
((
$usageLimit
+
$autoTopupsAdded
-
$accountingUsage
)
>
$autoTopupThreshold
)
{
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s: CHECK => usageLimit(%s) + autoTopupsAdded(%s) -
'
.
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s: CHECK => usageLimit(%s) + autoTopupsAdded(%s) -
'
.
'
accountingUsage(%s) < autoTopupThreshold(%s) = not eligble for auto-topup yet
',
$typeKey
,
$usageLimit
,
$autoTopupsAdded
,
$accountingUsage
,
$autoTopupThreshold
);
return
;
}
else
{
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoToup-%s: CHECK => usageLimit(%s) + autoTopupsAdded(%s) -
'
.
$server
->
log
(
LOG_DEBUG
,'
[MOD_FEATURE_CAPPING] SMRadius-AutoTo
p
up-%s: CHECK => usageLimit(%s) + autoTopupsAdded(%s) -
'
.
'
accountingUsage(%s) < autoTopupThreshold(%s) = eligble, processing
',
$typeKey
,
$usageLimit
,
$autoTopupsAdded
,
$accountingUsage
,
$autoTopupThreshold
);
}
...
...
@@ -759,15 +759,15 @@ sub _doAutoTopup
# Grab notify destinations
my
$notify
;
if
(
!
defined
(
$notify
=
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-Notify
")))
{
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoToups notify destination is not specified, NOT notifying
');
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups notify destination is not specified, NOT notifying
');
goto
END
;
}
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoToups notify destination is
\'
%s
\'
',
$notify
);
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups notify destination is
\'
%s
\'
',
$notify
);
# Grab notify template
my
$notifyTemplate
;
if
(
!
defined
(
$notifyTemplate
=
_getAttribute
(
$server
,
$user
,"
SMRadius-AutoTopup-
$typeKey
-NotifyTemplate
")))
{
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoToups notify template is not specified, NOT notifying
');
$server
->
log
(
LOG_INFO
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups notify template is not specified, NOT notifying
');
goto
END
;
}
...
...
@@ -806,7 +806,7 @@ sub _doAutoTopup
if
(
!
defined
(
$notifyMsg
))
{
my
$errorMsg
=
$error
->
info
();
$errorMsg
=~
s/\r?\n/\\n/g
;
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] AutoToups notify template parsing failed: %s
',
$errorMsg
);
$server
->
log
(
LOG_WARN
,'
[MOD_FEATURE_CAPPING] AutoTo
p
ups notify template parsing failed: %s
',
$errorMsg
);
next
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment