Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Cloud
MAS
clonemap
Commits
ab3c4856
Commit
ab3c4856
authored
Mar 30, 2020
by
Stefan Dähling
Browse files
agency using new ams endpoint
parent
71fa94d0
Pipeline
#262299
passed with stages
in 53 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
pkg/agency/agency.go
View file @
ab3c4856
...
...
@@ -133,12 +133,13 @@ func (agency *Agency) init() (err error) {
agency
.
logInfo
.
Println
(
"Starting agency "
,
temp
)
hostname
:=
strings
.
Split
(
temp
,
"-"
)
agency
.
mutex
.
Lock
()
if
len
(
hostname
)
<
4
{
if
len
(
hostname
)
<
6
{
err
=
errors
.
New
(
"incorrect hostname"
)
return
}
agency
.
info
.
MASID
,
err
=
strconv
.
Atoi
(
hostname
[
1
])
agency
.
info
.
ID
,
err
=
strconv
.
Atoi
(
hostname
[
3
])
agency
.
info
.
ImageGroupID
,
err
=
strconv
.
Atoi
(
hostname
[
3
])
agency
.
info
.
ID
,
err
=
strconv
.
Atoi
(
hostname
[
5
])
agency
.
info
.
Name
=
temp
+
".mas"
+
hostname
[
1
]
+
"agencies"
agency
.
logger
=
newLoggerClient
(
agency
.
info
.
MASID
,
agency
.
logError
,
agency
.
logInfo
)
agency
.
mqtt
=
newMQTTClient
(
"mqtt"
,
1883
,
agency
.
info
.
Name
,
agency
.
logError
,
agency
.
logInfo
)
...
...
@@ -167,8 +168,12 @@ func (agency *Agency) terminate(gracefulStop chan os.Signal) {
func
(
agency
*
Agency
)
startAgents
()
(
err
error
)
{
// request configuration
var
agencyInfoFull
schemas
.
AgencyInfoFull
agencyInfoFull
,
_
,
err
=
amsclient
.
GetAgencyInfoFull
(
agency
.
info
.
MASID
,
agency
.
info
.
ID
)
agencyInfoFull
,
_
,
err
=
amsclient
.
GetContainerAgencyInfoFull
(
agency
.
info
.
MASID
,
agency
.
info
.
ImageGroupID
,
agency
.
info
.
ID
)
agency
.
mutex
.
Lock
()
agency
.
info
.
ID
=
agencyInfoFull
.
ID
agency
.
info
.
Logger
=
agencyInfoFull
.
Logger
agency
.
mutex
.
Unlock
()
if
err
!=
nil
{
agency
.
info
.
Status
=
schemas
.
Status
{
Code
:
status
.
Error
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment