summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md34
-rw-r--r--pythonDocUpload.yml4
-rw-r--r--testing/docker-compose.yml17
-rw-r--r--testing/pythonDocUpload.yml4
-rw-r--r--uploadDocs.py (renamed from uploadDoc.py)2
-rw-r--r--wipeDocs.py19
6 files changed, 69 insertions, 11 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b20f864
--- /dev/null
+++ b/README.md
@@ -0,0 +1,34 @@
+# Python Doc Upload - Setup, Usage and Testing:
+
+
+## SETUP:
+
+* The doc uploader needs access to a checkout of the ndn-sysconf git repository, puppet (for puppet strings) and the ability to connect to portal.nordu.net.
+* Install python libraries:
+ * pip install atlassian-python-api pyyaml json2html pypandoc
+* Edit pythonDocUpload.yml - the values should be self explanatory.
+* Done!
+
+## USAGE:
+
+There are two scripts: uploadDocs.py and wipeDocs.py.
+
+Run uploadDocs to generate and upload the newest docs. Example:
+
+```python3 uploadDocs.py path/to/ndn-sysconf-checkout```
+
+The script takes a minute to run. It should finish with a list of the errors it encountered while generating documentation.
+
+If documentation is removed from ndn-sysconf, uploadDocs will not remove their old pages from confluence. If these need to be pruned, I suggest first running wipeDocs to remove the entire space Example:
+
+```python3 wipeDocs.py force```
+
+Doing so will obvious ruin the historics but expanding the uploadDocs script to prune intelligently seems like a poor time investment at the time of writing.
+
+## Testing:
+
+In the testing folder, you will find a docker-compose file which sets up an environment with two containers: One running Confluence and one running Puppet. The confluence instance needs to be set up with a trial version before testing can begin and the puppet docker needs an ndn-sysconf checkout available in a volume mount (as it is in the docker-compose.yml). Once this is set up, you can run the scripts from the puppet docker and observe the changes on the confluence docker.
+
+## Development notes:
+
+Confluence page names are globally unique, hence the naming scheme for the manifests pages and others. The exact processing of the documents done in uploadDocs may be overkill but at the time of writing it is unclear whether these scripts will be needed and it does work. \ No newline at end of file
diff --git a/pythonDocUpload.yml b/pythonDocUpload.yml
new file mode 100644
index 0000000..5567cad
--- /dev/null
+++ b/pythonDocUpload.yml
@@ -0,0 +1,4 @@
+confluenceUrl: "http://confluence:8090"
+confluenceUser: apiuser
+confluencePass: apiuserpass
+spaceName: TES
diff --git a/testing/docker-compose.yml b/testing/docker-compose.yml
new file mode 100644
index 0000000..04a819f
--- /dev/null
+++ b/testing/docker-compose.yml
@@ -0,0 +1,17 @@
+version: '3.3'
+services:
+ puppetserver:
+ image: puppet/puppetserver-standalone:latest
+ volumes:
+ - ./ndn-sysconf:/opt/data/etc
+ networks:
+ - test
+ confluence:
+ image: atlassian/confluence-server:latest
+ networks:
+ - test
+ ports:
+ - "8090:8090"
+ - "8091:8091"
+networks:
+ test:
diff --git a/testing/pythonDocUpload.yml b/testing/pythonDocUpload.yml
new file mode 100644
index 0000000..5567cad
--- /dev/null
+++ b/testing/pythonDocUpload.yml
@@ -0,0 +1,4 @@
+confluenceUrl: "http://confluence:8090"
+confluenceUser: apiuser
+confluencePass: apiuserpass
+spaceName: TES
diff --git a/uploadDoc.py b/uploadDocs.py
index a9a384e..8d2d02c 100644
--- a/uploadDoc.py
+++ b/uploadDocs.py
@@ -46,7 +46,7 @@ def prepareJSON(jsonFileContent):
pp = pprint.PrettyPrinter(indent=2)
-configuration = yaml.load(open("docUploadConfig.yml", "r").read())
+configuration = yaml.load(open("pythonDocUpload.yml", "r").read())
print(configuration)
confluence = Confluence(
diff --git a/wipeDocs.py b/wipeDocs.py
index 390f167..11e04de 100644
--- a/wipeDocs.py
+++ b/wipeDocs.py
@@ -1,19 +1,18 @@
-import pprint, json
+import pprint, json, yaml, sys
from atlassian import Confluence
-from base64 import b64encode
pp = pprint.PrettyPrinter(indent=2)
-confluence = Confluence(
- url='http://localhost:8090',
- username='apiuser',
- password='apiuserpass')
-
-spaceName = sys.argv[1]
+configuration = yaml.load(open("pythonDocUpload.yml", "r").read())
-pages = confluence.get_all_pages_from_space(spaceName)
+confluence = Confluence(
+ url=configuration.get('confluenceUrl'),
+ username=configuration.get('confluenceUser'),
+ password=configuration.get('confluencePass'))
-# jsonPages = json.loads(pages)
+pages = confluence.get_all_pages_from_space(configuration.get('spaceName'))
+if (len(sys.argv) > 0 && sys.argv[1] != "force"):
+ input("You are about to wipe everything in the space " + configuration.get('spaceName') + " - press Enter to continue.")
for page in pages:
print(pp.pprint(page))