Skip to content

Commit

Permalink
WRN-2239: release-version option is back.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasAubry committed Apr 16, 2018
1 parent f3be716 commit 47a4ea6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ python -m openwebvulndb.wordpress vane_export -i ~/vane/data/
# Export the Vane 2.0 WordPress Scanner vulnerability data.
# Add Vane 2 data as an asset of a release on the GitHub repository configured in the virtual environment.
# The environment variables required are:
# - VANE2_REPO_NAME=name-of-the-repository
# - VANE2_REPO_OWNER=github-username
# - VANE2_REPO_PASSWORD=password-or-personal-access-token
# With no argument, the data will be added to the latest release. To create a new release for the data,
# use the --create-release option. The current date will be used for the release number.
# use the --create-release option. The current date will be used for the release number. A custom version number can
# be specified with --release-version
# --target-commitish can be ignored for now, as the default is master.
python -m openwebvulndb.wordpress vane2_export [--create-release] [--target-commitish branch|commit]
python -m openwebvulndb.wordpress vane2_export [--create-release] [--target-commitish branch|commit] [--release-version]
# Re-load CVE data
python -m openwebvulndb.wordpress load_cve
Expand Down
10 changes: 7 additions & 3 deletions openwebvulndb/wordpress/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def vane_export(vane_importer, storage, input_path):
rebuild.write()


def vane2_export(storage, aiohttp_session, loop, create_release=False, target_commitish=None):
def vane2_export(storage, aiohttp_session, loop, create_release=False, target_commitish=None, release_version=None):
export_path = EXPORT_PATH
os.makedirs(export_path, exist_ok=True)
exporter = Exporter(storage)
Expand Down Expand Up @@ -90,7 +90,7 @@ def vane2_export(storage, aiohttp_session, loop, create_release=False, target_co
os.environ["VANE2_REPO_NAME"])
try:
loop.run_until_complete(github_release.release_data(export_path, "vane2_data_", create_release,
target_commitish, str(date.today())))
target_commitish, release_version or str(date.today())))
logger.info("Vane data successfully released.")
except (Exception, RuntimeError, ValueError) as e:
logger.exception(e)
Expand Down Expand Up @@ -166,6 +166,8 @@ def change_version_format(storage):
parser.add_argument("--create-release", dest="create_release", action="store_true", help="Create a new GitHub release")
parser.add_argument("--target-commitish", dest="target_commitish", help="Branch name or SHA number of the commit used "
"for the new release", default="master")
parser.add_argument("--release-version", dest="release_version", help="Version number for the new release. The "
"current is used by default.")
parser.add_argument("--interval", dest="interval", help="The interval in days since the last update of plugins and "
"themes versions. 30 days by default", default=30, type=int)
parser.add_argument("-w", "--wp-only", dest="wp_only", help="Only populate versions for WordPress core, skip plugins "
Expand All @@ -183,8 +185,10 @@ def change_version_format(storage):
dest_folder=args.dest_folder,
create_release=args.create_release,
target_commitish=args.target_commitish,
release_version=args.release_version,
interval=args.interval,
wp_only=args.wp_only)
wp_only=args.wp_only,
)
local.call(operations[args.action])
except KeyboardInterrupt:
pass
Expand Down

0 comments on commit 47a4ea6

Please sign in to comment.