@@ -26,9 +26,10 @@ class ManualAdjust extends BaseTask {
2626 }
2727
2828 async _start ( ) {
29+ const opts = this . _program . opts ( ) ;
2930 this . _utapiClient = new UtapiClient ( {
30- host : this . _program . host ,
31- port : this . _program . port ,
31+ host : opts . host ,
32+ port : opts . port ,
3233 disableRetryCache : true ,
3334 } ) ;
3435 await super . _start ( ) ;
@@ -42,35 +43,36 @@ class ManualAdjust extends BaseTask {
4243 async _execute ( ) {
4344 const timestamp = Date . now ( ) ;
4445
45- const objectDelta = this . _program . objects ;
46- const sizeDelta = this . _program . storage ;
46+ const opts = this . _program . opts ( ) ;
47+ const objectDelta = opts . objects ;
48+ const sizeDelta = opts . storage ;
4749
48- if ( ! this . _program . bucket . length && ! this . _program . account . length && ! this . _program . user . length ) {
50+ if ( ! opts . bucket . length && ! opts . account . length && ! opts . user . length ) {
4951 throw Error ( 'You must provided at least one of --bucket, --account or --user' ) ;
5052 }
5153
5254 logger . info ( 'writing adjustments' ) ;
53- if ( this . _program . bucket . length ) {
55+ if ( opts . bucket . length ) {
5456 logger . info ( 'adjusting buckets' ) ;
5557 await async . eachSeries (
56- this . _program . bucket ,
58+ opts . bucket ,
5759 async bucket => this . _pushAdjustmentMetric ( {
5860 bucket, objectDelta, sizeDelta, timestamp,
5961 } ) ,
6062 ) ;
6163 }
6264
63- if ( this . _program . account . length ) {
65+ if ( opts . account . length ) {
6466 logger . info ( 'adjusting accounts' ) ;
6567 await async . eachSeries (
66- this . _program . account ,
68+ opts . account ,
6769 async account => this . _pushAdjustmentMetric ( {
6870 account, objectDelta, sizeDelta, timestamp,
6971 } ) ,
7072 ) ;
7173 }
7274
73- if ( this . _program . user . length ) {
75+ if ( opts . user . length ) {
7476 logger . info ( 'adjusting users' ) ;
7577 await async . eachSeries (
7678 this . _program . user ,
0 commit comments