Add index_links option to zuul manifest
This allows a deployer to indicate that they prefer the Zuul dashboard to link to "dir/index.html" rather than just "/dir" when displaying directory entries in the log browser. This helps with log storage systems which do not automatically serve index.html files at directory urls. Change-Id: I0444798c689667e51d8761a20b661f8a9b90323d
This commit is contained in:
parent
b8ce30f3cb
commit
2aa0dbcf29
@ -26,3 +26,9 @@ display logs from a build.
|
|||||||
:default: zuul_manifest
|
:default: zuul_manifest
|
||||||
|
|
||||||
The artifact type to return to Zuul.
|
The artifact type to return to Zuul.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: generate_zuul_manifest_index_links
|
||||||
|
:default: False
|
||||||
|
|
||||||
|
If True, the Zuul dashboard will link to "index.html" for directory
|
||||||
|
entries; if False, it will link to the bare directory.
|
||||||
|
@ -2,3 +2,4 @@ generate_zuul_manifest_root: "{{ zuul.executor.log_root }}"
|
|||||||
generate_zuul_manifest_filename: "zuul-manifest.json"
|
generate_zuul_manifest_filename: "zuul-manifest.json"
|
||||||
generate_zuul_manifest_output: "{{ zuul.executor.log_root }}/{{ generate_zuul_manifest_filename }}"
|
generate_zuul_manifest_output: "{{ zuul.executor.log_root }}/{{ generate_zuul_manifest_filename }}"
|
||||||
generate_zuul_manifest_type: "zuul_manifest"
|
generate_zuul_manifest_type: "zuul_manifest"
|
||||||
|
generate_zuul_manifest_index_links: False
|
||||||
|
@ -87,10 +87,11 @@ def walk(root, original_root=None):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def run(root_path, output):
|
def run(root_path, output, index_links):
|
||||||
data = walk(root_path, root_path)
|
data = walk(root_path, root_path)
|
||||||
with open(output, 'w') as f:
|
with open(output, 'w') as f:
|
||||||
f.write(json.dumps({'tree': data}))
|
f.write(json.dumps({'tree': data,
|
||||||
|
'index_links': index_links}))
|
||||||
|
|
||||||
|
|
||||||
def ansible_main():
|
def ansible_main():
|
||||||
@ -98,11 +99,12 @@ def ansible_main():
|
|||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
root=dict(type='path'),
|
root=dict(type='path'),
|
||||||
output=dict(type='path'),
|
output=dict(type='path'),
|
||||||
|
index_links=dict(type='bool', default=False),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
p = module.params
|
p = module.params
|
||||||
run(p.get('root'), p.get('output'))
|
run(p.get('root'), p.get('output'), p.get('index_links'))
|
||||||
|
|
||||||
module.exit_json(changed=True)
|
module.exit_json(changed=True)
|
||||||
|
|
||||||
@ -117,13 +119,15 @@ def cli_main():
|
|||||||
help='Root of upload directory')
|
help='Root of upload directory')
|
||||||
parser.add_argument('output',
|
parser.add_argument('output',
|
||||||
help='Output file path')
|
help='Output file path')
|
||||||
|
parser.add_argument('index_links', action='store_true',
|
||||||
|
help='Link to index.html instead of dirs')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
run(args.root, args.output)
|
run(args.root, args.output, args.index_links)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
artifacts:
|
artifacts:
|
||||||
- name: Zuul Manifest
|
- name: Zuul Manifest
|
||||||
url: "{{ generate_zuul_manifest_filename }}"
|
url: "{{ generate_zuul_manifest_filename }}"
|
||||||
|
index_links: "{{ generate_zuul_manifest_index_links }}"
|
||||||
metadata:
|
metadata:
|
||||||
type: "{{ generate_zuul_manifest_type }}"
|
type: "{{ generate_zuul_manifest_type }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user