Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CORE-7417 add skip conversion parameter #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions kudu/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
default="zip",
help="Extension of the file that's going to be uploaded, default 'zip'",
)
@click.option("--skip_conversion", "-s", is_flag=True, default=False, required=False, help="Skip Conversion Engine")
@click.pass_context
def create(ctx, instance, body, filename=None, path=None, extension="zip"):
def create(ctx, instance, body, filename=None, path=None, extension="zip",skip_conversion=False):
base_name = (
os.path.splitext(filename)[0]
if filename
Expand All @@ -35,7 +36,7 @@ def create(ctx, instance, body, filename=None, path=None, extension="zip"):

file_data = get_file_data(path, base_name, category=extension)
file_id = create_file(
ctx.obj["token"], instance, body, extension, filename=filename
ctx.obj["token"], instance, body, extension, filename=filename, skip_conversion=skip_conversion
)
url = "/files/%d/upload-url/" % file_id
response = request("get", url, token=ctx.obj["token"])
Expand All @@ -46,13 +47,14 @@ def create(ctx, instance, body, filename=None, path=None, extension="zip"):
update_file_metadata(ctx, file_id)


def create_file(token, app_id, file_body, category, filename=None):
def create_file(token, app_id, file_body, category, filename=None, skip_conversion=False):
payload = {
"app": app_id,
"body": file_body,
"downloadUrl": "https://admin.pitcher.com/downloads/Pitcher%20HTML5%20Folder.zip",
"category": category,
"dont_convert": True,
"skip_conversion": skip_conversion,
}

if filename:
Expand Down
Loading