summaryrefslogtreecommitdiff
path: root/doc/forum
diff options
context:
space:
mode:
authorJoey Hess2017-11-29 11:45:06 -0400
committerJoey Hess2017-11-29 11:45:06 -0400
commit578ebbf861a074c33050f4fb927f6f88d442947d (patch)
treed3d3787e4c8ee4c1b4f9413174497a09eee8b525 /doc/forum
parent3fc6850ee79ecf3e084cf99b19cf695b90a0129b (diff)
parentfbcfa185eb4cb79380a0db0c1772082d5619ba1d (diff)
Merge branch 'master' into joeyconfig
Diffstat (limited to 'doc/forum')
-rw-r--r--doc/forum/How_to_add_a_privdata_for_Gitlab_cookies.mdwn30
-rw-r--r--doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_1_17d2452b602a867862e688ad39f50ebe._comment21
-rw-r--r--doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_2_ab81471e6466944810906284f9a523cc._comment66
-rw-r--r--doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_3_32aaf0dd4d2a33d3ac7596bc47c15028._comment16
-rw-r--r--doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_4_ec1136accf484b572a1bcdfee40dcc92._comment14
5 files changed, 147 insertions, 0 deletions
diff --git a/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies.mdwn b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies.mdwn
new file mode 100644
index 00000000..c222e613
--- /dev/null
+++ b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies.mdwn
@@ -0,0 +1,30 @@
+Hello joey,
+
+First let me thank you and other contributors for this great tool, it helps me a lot in my day to day work :))
+
+
+I need to checkout something from a private area of a gitlab instance.
+In order to authenticate, I setup a personnal access token [1].
+
+It seems to me that PrivData is the right type to use in order to store it and avoid to have the token in clear text in the config.hs file.
+
+I will use it in order to generate the url of the Git type.
+
+(Git "https://<user name>:<token>@gitlab.xxxx.yy/user name/blabla.git" Nothing "<project>")
+
+This is the first time I will try to use the privdata and I do not know how to proceed.
+
+I saw that only a certain amount of constructors are available for these privdata.
+Should I add a new one for my gitlab personnal access token ?.
+
+What is the context which can be attach to the privdata in order to have something as flexible as possible ?
+It seems to me that the contex should be the gitlab url and the user name, but maybe you could think about a better solution.
+
+Could you explain with a code snipset how to proceed, becasue it is not really clear to me.
+Or point to an available example.
+
+thanks for your help
+
+Frederic
+
+[1] https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
diff --git a/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_1_17d2452b602a867862e688ad39f50ebe._comment b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_1_17d2452b602a867862e688ad39f50ebe._comment
new file mode 100644
index 00000000..0a10baaf
--- /dev/null
+++ b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_1_17d2452b602a867862e688ad39f50ebe._comment
@@ -0,0 +1,21 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2017-11-22T19:14:32Z"
+ content="""
+Privdata uses the combination of the Context and the PrivDataField
+to identify the piece of private data to use. So, you don't
+need to add a new constructor to PrivDataField as long as you can
+find a context that is sufficiently specific for your needs.
+The gitlab url (without the password) would make a fine context.
+
+So, I'd suggest something like `withPrivData (Password "thegitlaburl") (Context "thegitlaburl")`
+
+See the example in the haddock for withPrivData to for how to use that.
+
+(The only possible problem with that is you're claiming it's a password
+when it's really an API key. Propellor won't care, but it you wanted
+to store the actual gitlab password too, then you'd need to use a different
+username. It may make sense to add a new constructor to PrivDataField for
+an API key or something like that.)
+"""]]
diff --git a/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_2_ab81471e6466944810906284f9a523cc._comment b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_2_ab81471e6466944810906284f9a523cc._comment
new file mode 100644
index 00000000..a9b50d81
--- /dev/null
+++ b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_2_ab81471e6466944810906284f9a523cc._comment
@@ -0,0 +1,66 @@
+[[!comment format=mdwn
+ username="picca"
+ avatar="http://cdn.libravatar.org/avatar/7e61c80d28018b10d31f6db7dddb864c"
+ subject="comment 2"
+ date="2017-11-27T15:50:08Z"
+ content="""
+Hello, joey
+
+I try this but It ends up with an error during the compilation
+
+ blabla' :: Property (HasInfo + DebianLike)
+ blabla' = withPrivData (Password \"xxxxxxxxxxxxxx\") (Context \"yyyyyyyyyyyyy\") $ \getdata ->
+ property' \"blabla\" $ \w -> getdata $ \privdata -> ensureProperty w
+ (buildAndInstall (Git (\"https://toto:\" ++ (privDataVal privdata) ++ \"@xxxxxxxxxxxxxx\") Nothing \"blabla\"))
+
+ blabla :: Property (HasInfo + DebianLike)
+ blabla = withOS \"Install BlaBla Stack\" $ \w o -> case o of
+ (Just (System (Debian _ Unstable) _)) -> ensureProperty w $ unstable
+ (Just (System (Debian _ (Stable \"jessie\")) _)) -> ensureProperty w $ jessie
+ (Just (System (Debian _ (Stable \"stretch\")) _)) -> ensureProperty w $ stretch
+ _ -> error $ \"Blabla installation not yet implemented on \" ++ show o
+ where
+ unstable :: Property (HasInfo + DebianLike)
+ unstable = propertyList \"Stretch Blabla\" $ props
+ & Apt.installed [\"python3-gpyfft\"]
+ & blabla'
+
+ jessie :: Property (HasInfo + Debian)
+ jessie = propertyList \"Jessie Blabla\" $ props
+ & Apt.installedBackport [\"cython\", \"cython3\"]
+ & Apt.installedBackport [\"python-sphinx\", \"python3-sphinx\"]
+ & buildAndInstall (Backport \"appdirs\" Nothing Nothing)
+ & buildAndInstall (Backport \"pytools\" Nothing Nothing)
+ & buildAndInstall (Backport \"pyopencl\" Nothing (Just \"nodocs\"))
+ & buildAndInstall (Backport \"clfft\" Nothing Nothing)
+ & buildAndInstall (Backport \"gpyfft\" (Just \"nostrip\") Nothing)
+ & blabla'
+
+ stretch :: Property (HasInfo + DebianLike)
+ stretch = propertyList \"Stretch Blabla\" $ props
+ & buildAndInstall (Backport \"gpyfft\" (Just \"nostrip\") Nothing)
+ & blabla'
+
+
+
+here the error
+
+ src/propellor-config.hs:810:60-75: error:
+ • Couldn't match type ‘'False’ with ‘'True’
+ arising from a use of ‘ensureProperty’
+ • In the expression: ensureProperty w
+ In the expression: ensureProperty w $ unstable
+ In a case alternative:
+ (Just (System (Debian _ (Unstable)) _))
+ -> ensureProperty w $ stretch
+
+It seems to me that this is an error with the HasInfo, but I could not manage to solve this problem by myself.
+
+do you have a Idea in ordert o solve this ?
+
+thanks
+
+Frederic
+
+
+"""]]
diff --git a/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_3_32aaf0dd4d2a33d3ac7596bc47c15028._comment b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_3_32aaf0dd4d2a33d3ac7596bc47c15028._comment
new file mode 100644
index 00000000..beaa631f
--- /dev/null
+++ b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_3_32aaf0dd4d2a33d3ac7596bc47c15028._comment
@@ -0,0 +1,16 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2017-11-27T20:41:40Z"
+ content="""
+Yes, ensureProperty cannot be used with a Property HasInfo as that would
+prevent propellor from collecting that Info.
+
+You could avoid that by factoring the `blabla'` out of the properties
+that install packages, to the top level of the property:
+
+ blabla = blabla' `requires` installpackages
+ where
+ installpackages = withOS "Install BlaBla Stack" $ \w o -> case o of
+ ...
+"""]]
diff --git a/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_4_ec1136accf484b572a1bcdfee40dcc92._comment b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_4_ec1136accf484b572a1bcdfee40dcc92._comment
new file mode 100644
index 00000000..596e2141
--- /dev/null
+++ b/doc/forum/How_to_add_a_privdata_for_Gitlab_cookies/comment_4_ec1136accf484b572a1bcdfee40dcc92._comment
@@ -0,0 +1,14 @@
+[[!comment format=mdwn
+ username="picca"
+ avatar="http://cdn.libravatar.org/avatar/7e61c80d28018b10d31f6db7dddb864c"
+ subject="comment 4"
+ date="2017-11-28T06:37:34Z"
+ content="""
+Thanks a lot,
+
+if I understand correctly,it means that it is not possible to use withPrivData with ensureProperty if the property HasInfo.
+
+Cheers
+
+Fred
+"""]]