Skip to content

Commit

Permalink
Merge pull request #13 from DMTF/1.0.0-Tagging
Browse files Browse the repository at this point in the history
1.0.0 Versioning
  • Loading branch information
mraineri authored Mar 2, 2018
2 parents cd80140 + adbe969 commit de35878
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
7 changes: 1 addition & 6 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

# Original Contribution:
* Majec Systems


# Other Key Contributions:


* Majec Systems
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

# Change Log

## [1.0.0] - 2018-03-02
- Added tag validation
- Removed restriction on BeautifulSoup version
- Added timeout option
- Added support to alias a file from a local directory

## [0.9.0] - 2017-04-06
- Initial Public Release
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# Redfish Reference Checker - Version 0.9
Copyright 2016-2018 Distributed Management Task Force, Inc. All rights reserved.

# Redfish Reference Checker

## About

RedfishReferenceTool.py is a python3 tool that checks for valid reference URLs in CSDL xml files.

## Pre-requisites

The following requirements may be installed via the command line:

pip3 install -r requirements.txt
Expand All @@ -16,25 +19,21 @@ The requirements for this tool are as follows:
* lxml - https://pypi.python.org/pypi/lxml

## Installation

Copy RedfishReferenceTool.py into any tool directory, and requires no extra configuration.

Run: python3 RedfishReferenceTool.py [url] [--nochkcert] [--alias file] [--file] [--timeout]

URL includes authority. Note that quotations or an escape must be used for '$' and '#' characters, when using ODATA Uris.

## Execution
Upon execution, attempts to get an XML file at the URL given, and exits with 1
on bad URLs or non xml formatted files, then dereferences all reference URLs
in the file.

Upon execution, attempts to get an XML file at the URL given, and exits with 1 on bad URLs or non xml formatted files, then dereferences all reference URLs in the file.

Upon specifying --nochkcert, it will not attempt to verify any certification provided. --timeout may be used to increase request timeouts.

Upon specifying --alias, it will read a json-formatted file that provides an alias for URIs or URLs not currently published online,
and instead points to a local file.
For single files, a single URL may be mapped on the left hand side to point to a file stored on the right.
If a URL is appended with /\*, then it may point to a directory appended with /\* on the right, such that each file in the directory will be mapped to its own URL.
Upon specifying --alias, it will read a json-formatted file that provides an alias for URIs or URLs not currently published online, and instead points to a local file. For single files, a single URL may be mapped on the left hand side to point to a file stored on the right. If a URL is appended with /\*, then it may point to a directory appended with /\* on the right, such that each file in the directory will be mapped to its own URL.

For a simpler way to test one local file, please use the parameter --file, which will interpret the URL given as a locally stored file relative to the current work directory. This mode will not interpret a "host", and thus will fail if the stored file contains relative references.

Exits with success if the amount of missing references is zero.

5 changes: 4 additions & 1 deletion RedfishReferenceTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

tool_version = '1.0.0'

def generateXmlReferences(reftags):
# unused block to write a valid xml file instead of just printing to file
Expand Down Expand Up @@ -109,7 +110,7 @@ def getAlias(uri, aliasDict):


if __name__ == "__main__":
argget = argparse.ArgumentParser(description='Tool that checks if reference contain all valid URLs')
argget = argparse.ArgumentParser(description='Redfish Reference Checker {}: A tool that checks if reference contain all valid URLs'.format(tool_version))
argget.add_argument('url', type=str, help='destination url to test')
argget.add_argument('--file', action='store_true', help='use url as filepath to local file')
argget.add_argument('--nochkcert', action='store_true', help='ignore check for certificate')
Expand All @@ -119,6 +120,8 @@ def getAlias(uri, aliasDict):

args = argget.parse_args()

print('Redfish Reference Checker {}'.format(tool_version))

rootURL = args.url
chkCert = not args.nochkcert
aliasFile = args.alias
Expand Down

0 comments on commit de35878

Please sign in to comment.