Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Command line client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EOLE
Zéphir
Command line client
Commits
bff1e404
Commit
bff1e404
authored
6 years ago
by
gwenael remond
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/OutputYaml' into 'develop'
Add output in yaml See merge request
!10
parents
188cee62
7d0af930
No related branches found
Branches containing commit
No related tags found
1 merge request
!10
Add output in yaml
Pipeline
#191
failed
6 years ago
Stage: test
Stage: external
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.py
+4
-1
4 additions, 1 deletion
config.py
zephir-client
+7
-2
7 additions, 2 deletions
zephir-client
zephir_client.py
+3
-3
3 additions, 3 deletions
zephir_client.py
with
14 additions
and
6 deletions
config.py
+
4
−
1
View file @
bff1e404
...
...
@@ -17,10 +17,12 @@ class ZcliConfig:
print
(
"""
Attention, le fichier de configuration de zephir-cli est inexistant !
"""
)
url
=
input
(
"
Entrez l
'
adresse du serveur Zephir :
"
)
version
=
input
(
"
Entrez la version du zephir (defaut:
'
v1
'
) :
"
)
output
=
"
json
"
if
not
version
:
version
=
"
v1
"
yaml_template
=
f
"""
url:
{
url
}
version:
{
version
}
"""
version:
{
version
}
output:
{
output
}
"""
with
ZcliConfig
.
config_file
.
open
(
"
w
"
,
encoding
=
"
utf-8
"
)
as
fh
:
fh
.
write
(
yaml_template
)
...
...
@@ -35,3 +37,4 @@ version: {version}"""
self
.
url
=
config
.
get
(
'
url
'
)
self
.
version
=
config
.
get
(
'
version
'
)
self
.
output
=
config
.
get
(
'
output
'
)
This diff is collapsed.
Click to expand it.
zephir-client
+
7
−
2
View file @
bff1e404
#!/usr/bin/env python3
"""
Zephir-cmd-input script
"""
import
yaml
from
zephir_client
import
remote_json_to_config
,
cmdline_factory
,
send
import
config
as
zconf
zcliconf
=
zconf
.
ZcliConfig
()
URL
=
zcliconf
.
url
VERSION
=
zcliconf
.
version
OUTPUT
=
zcliconf
.
output
remote_config
=
remote_json_to_config
(
URL
,
VERSION
)
config
=
cmdline_factory
(
remote_config
)
...
...
@@ -18,4 +19,8 @@ for key in config.value.mandatory():
config
.
option
(
key
).
value
.
set
(
int
(
text
))
else
:
config
.
option
(
key
).
value
.
set
(
text
)
send
(
URL
,
VERSION
,
config
)
\ No newline at end of file
result
=
send
(
URL
,
VERSION
,
config
)
if
OUTPUT
==
"
yaml
"
:
print
(
yaml
.
dump
(
result
,
default_flow_style
=
False
))
else
:
print
(
result
)
This diff is collapsed.
Click to expand it.
zephir_client.py
+
3
−
3
View file @
bff1e404
...
...
@@ -59,14 +59,14 @@ def send(url, version, config):
else
:
auth_ok
=
True
if
'
error
'
in
response
:
print
(
f
"
Erreur :
{
response
[
'
error
'
][
'
kwargs
'
][
'
reason
'
]
}
"
)
return
(
f
"
Erreur :
{
response
[
'
error
'
][
'
kwargs
'
][
'
reason
'
]
}
"
)
else
:
print
(
response
)
return
(
response
)
except
ValueError
:
token
=
authenticate
(
url
)
continue
except
Exception
as
err
:
print
(
f
"
Erreur :
{
err
}
"
)
return
(
f
"
Erreur :
{
err
}
"
)
sys
.
exit
(
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment