Update build settings and documentation

This commit is contained in:
Pawan Singh Pal 2018-11-29 23:29:17 +05:30
parent a2eedb6370
commit c82debd18a
7 changed files with 35 additions and 19 deletions

View File

@ -1,2 +1,4 @@
recursive-include spyglass/utils/editor/static *
recursive-include spyglass/utils/editor/templates *
recursive-include spyglass/ **.yaml
recursive-include spyglass/ **.json

View File

@ -187,7 +187,17 @@ spyglass -mg --type formation -f <URL> -u <user_id> -p <password> -d <site_confi
spyglass -mg --type tugboat -x <Excel File> -e <Excel Spec> -d <Site Config> -s <Region> --template_dir=<j2 template dir>
for example:
spyglass -mg -t tugboat -x SiteDesignSpec_v1.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<j2 template dir>
2.1 Generating intermediary and manifests
spyglass -mg -t tugboat -x SiteDesignSpec_v1.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<j2 template dir>
2.2 Generating intermediary without manifests
spyglass -g -t tugboat -x SiteDesignSpec_v1.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy
2.3 Generating manifests without intermediary
spyglass -m -t tugboat -x SiteDesignSpec_v1.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<j2 template dir>
2.4 Generating manifests using intermediary
spyglass -mi <intermediary.yaml> --template_dir=<j2 template dir>
Where sample 'excel_spec_upstream.yaml', 'SiteDesignSpec_v0.1.xlsx'
'site_config.yaml' and J2 templates can be found under 'spyglass/examples'

View File

@ -85,13 +85,16 @@ Below is the definition for each key in the Excel spec
Example: Tugboat Plugin Usage
-----------------------------
1. Required Input(Refer to 'spyglass/examples' folder to get these inputs)
a) Excel File: SiteDesignSpec_v0.1.xlsx
b) Excel Spec: excel_spec_upstream.yaml
c) Site Config: site_config.yaml
d) Template_dir: '../examples/templates'
e) Site name: airship-seaworthy
a) Excel File: SiteDesignSpec_v0.1.xlsx
b) Excel Spec: excel_spec_upstream.yaml
c) Site Config: site_config.yaml
d) Template_dir: '../examples/templates'
e) Site name: airship-seaworthy
2. Spyglass CLI Command:
spyglass -mg -t tugboat -x SiteDesignSpec_v0.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<relative path to '../examples/templates'
::
spyglass -mg -t tugboat -x SiteDesignSpec_v0.1.xlsx -e excel_spec_upstream.yaml -d site_config.yaml -s airship-seaworthy --template_dir=<relative path to '../examples/templates'

View File

@ -32,10 +32,10 @@ could not be fetched via :ref:`tugboatinfo` plugin.
Yaml Editor Utility Inputs
--------------------------
a) Yaml File: Yaml file required to be edited (This is required field)
b) Port: Port on which app shall be running
c) Host: This is only used to form URL which can be followed to open file in browser
d) String: String which is required to be updated in the file (default is '#CHANGE_ME')
a) Yaml File: Yaml file required to be edited (This is required field)
b) Port: Port on which app shall be running
c) Host: This is only used to form URL which can be followed to open file in browser
d) String: String which is required to be updated in the file (default is '#CHANGE_ME')
Yaml Editor Utility Usage
-------------------------

View File

@ -19,7 +19,7 @@ setup(
name='spyglass',
version='0.0.1',
description='Generate Airship specific yaml manifests from data sources',
url='http://github.com/att-comdev/tugboat',
url='http://github.com/att-comdev/spyglass',
python_requires='>=3.5.0',
license='Apache 2.0',
packages=find_packages(),

View File

@ -121,8 +121,8 @@ class ProcessDataSource():
json_schema = json.load(f)
try:
# Suppressing writing of data2.json. Can use it for debugging
with open('data2.json', 'w') as outfile:
json.dump(temp_data, outfile, sort_keys=True, indent=4)
# with open('data2.json', 'w') as outfile:
# json.dump(temp_data, outfile, sort_keys=True, indent=4)
jsonschema.validate(json_data, json_schema)
except jsonschema.exceptions.ValidationError as e:
LOG.error("Validation Error")
@ -336,11 +336,12 @@ class ProcessDataSource():
self.data = extracted_data
LOG.debug("Extracted data from plugin:\n{}".format(
pprint.pformat(extracted_data)))
extracted_file = "extracted_file.yaml"
yaml_file = yaml.dump(extracted_data, default_flow_style=False)
with open(extracted_file, 'w') as f:
f.write(yaml_file)
f.close()
# Uncommeent following segment for debugging purpose.
# extracted_file = "extracted_file.yaml"
# yaml_file = yaml.dump(extracted_data, default_flow_style=False)
# with open(extracted_file, 'w') as f:
# f.write(yaml_file)
# f.close()
# Append region_data supplied from CLI to self.data
self.data['region_name'] = self.region_name