Skip to content

Commit

Permalink
dryer version of the policy hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mokko committed Jul 28, 2024
1 parent 88b5174 commit ba5c76a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
10 changes: 3 additions & 7 deletions src/mpapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import argparse
from mpapi.filterUnpublished import filter_
from mpapi.getAttachments import GetAttachments, get_attachment
from mpapi.mink import Mink
from mpapi.module import Module
from mpapi.client import MpApi
from mpapi.constants import get_credentials
from mpapi.mink import Mink, arg as mink_arg
from mpapi.module import Module
from mpapi.validate import Validate
from pathlib import Path
import sys
Expand Down Expand Up @@ -190,11 +190,7 @@ def getItem():


def mink():
parser = argparse.ArgumentParser(description="Commandline frontend for MpApi.py")
parser.add_argument("-j", "--job", help="job to run") # , required=True
parser.add_argument("-c", "--conf", help="config file", default="jobs.toml")
args = _setup_args(parser)
Mink(job=args.job, conf=args.conf, baseURL=baseURL, pw=pw, user=user)
mink_arg()


def updateItem():
Expand Down
39 changes: 21 additions & 18 deletions src/mpapi/mink.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
pack : pack together several (clean) files
"""

import argparse
import datetime
import logging
from mpapi.chunky import Chunky
from mpapi.client import MpApi
from mpapi.constants import load_conf
from mpapi.constants import load_conf, get_credentials
from mpapi.module import Module
from mpapi.sar import Sar
from pathlib import Path
Expand All @@ -36,6 +37,24 @@
chunkSize = 1000


def arg():
# since fvh is blocked by Windows group policy

user, pw, baseURL = get_credentials()

parser = argparse.ArgumentParser(description="Commandline frontend for MpApi.py")
parser.add_argument("-j", "--job", help="job to run") # , required=True
parser.add_argument("-c", "--conf", help="config file", default="jobs.toml")
parser.add_argument(
"-v", "--version", help="Display version information", action="store_true"
)
args = parser.parse_args()
if args.version:
print(f"Version: {__version__}")
sys.exit(0)
Mink(job=args.job, conf=args.conf, baseURL=baseURL, pw=pw, user=user)


class Mink:
def __init__(
self, *, conf: str, job: str, baseURL: str, user: str, pw: str
Expand Down Expand Up @@ -351,20 +370,4 @@ def _parse_conf(self, job: str, fn: Path) -> dict:


if __name__ == "__main__":
# since fvh is blocked by Windows group policy
import argparse
from mpapi.constants import get_credentials

user, pw, baseURL = get_credentials()

parser = argparse.ArgumentParser(description="Commandline frontend for MpApi.py")
parser.add_argument("-j", "--job", help="job to run") # , required=True
parser.add_argument("-c", "--conf", help="config file", default="jobs.toml")
parser.add_argument(
"-v", "--version", help="Display version information", action="store_true"
)
args = parser.parse_args()
if args.version:
print(f"Version: {__version__}")
sys.exit(0)
Mink(job=args.job, conf=args.conf, baseURL=baseURL, pw=pw, user=user)
arg()

0 comments on commit ba5c76a

Please sign in to comment.