Merge pull request #7 from pawansingh126/master

Update build settings and documentation
This commit is contained in:
hemanthnakkina 2018-11-29 23:32:45 +05:30 committed by GitHub
commit e6585e48af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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/static *
recursive-include spyglass/utils/editor/templates * 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> spyglass -mg --type tugboat -x <Excel File> -e <Excel Spec> -d <Site Config> -s <Region> --template_dir=<j2 template dir>
for example: 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' Where sample 'excel_spec_upstream.yaml', 'SiteDesignSpec_v0.1.xlsx'
'site_config.yaml' and J2 templates can be found under 'spyglass/examples' '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 Example: Tugboat Plugin Usage
----------------------------- -----------------------------
1. Required Input(Refer to 'spyglass/examples' folder to get these inputs) 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 a) Excel File: SiteDesignSpec_v0.1.xlsx
c) Site Config: site_config.yaml b) Excel Spec: excel_spec_upstream.yaml
d) Template_dir: '../examples/templates' c) Site Config: site_config.yaml
e) Site name: airship-seaworthy d) Template_dir: '../examples/templates'
e) Site name: airship-seaworthy
2. Spyglass CLI Command: 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 Yaml Editor Utility Inputs
-------------------------- --------------------------
a) Yaml File: Yaml file required to be edited (This is required field) a) Yaml File: Yaml file required to be edited (This is required field)
b) Port: Port on which app shall be running 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 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') d) String: String which is required to be updated in the file (default is '#CHANGE_ME')
Yaml Editor Utility Usage Yaml Editor Utility Usage
------------------------- -------------------------

View File

@ -19,7 +19,7 @@ setup(
name='spyglass', name='spyglass',
version='0.0.1', version='0.0.1',
description='Generate Airship specific yaml manifests from data sources', 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', python_requires='>=3.5.0',
license='Apache 2.0', license='Apache 2.0',
packages=find_packages(), packages=find_packages(),

View File

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