Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
foremanFS
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
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
Hugo Hörnquist
foremanFS
Commits
1994b158
Commit
1994b158
authored
4 years ago
by
Hugo Hörnquist
Browse files
Options
Downloads
Patches
Plain Diff
Start adding pagination again.
parent
1636ecca
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fetch/fetch.go
+15
-6
15 additions, 6 deletions
fetch/fetch.go
with
15 additions
and
6 deletions
fetch/fetch.go
+
15
−
6
View file @
1994b158
...
@@ -3,6 +3,7 @@ package fetch
...
@@ -3,6 +3,7 @@ package fetch
import
(
import
(
"fmt"
"fmt"
"log"
"log"
"math"
"crypto/tls"
"crypto/tls"
"encoding/json"
"encoding/json"
...
@@ -51,7 +52,7 @@ func Init(pw string) {
...
@@ -51,7 +52,7 @@ func Init(pw string) {
var
m2
PuppetclassMessage
var
m2
PuppetclassMessage
fff
(
"puppetclasses"
,
&
m2
)
fff
_pages
(
"puppetclasses"
,
&
m2
)
for
group
,
entries
:=
range
m2
.
Results
{
for
group
,
entries
:=
range
m2
.
Results
{
log
.
Print
(
"Handling "
,
group
)
log
.
Print
(
"Handling "
,
group
)
...
@@ -90,11 +91,19 @@ func fff (url string, message interface{}) {
...
@@ -90,11 +91,19 @@ func fff (url string, message interface{}) {
func
fff_pages
(
url
string
,
message
IsMessage
)
{
func
fff_pages
(
url
string
,
message
IsMessage
)
{
fff
(
url
,
&
message
)
fff
(
url
,
&
message
)
log
.
Printf
(
"message = %+v"
,
message
.
GetMessage
())
log
.
Printf
(
"message = %+v"
,
message
.
GetMessage
())
// TODO
// logic here for fetching additional pages
m
:=
message
.
GetMessage
()
// (preferably async)
pagecount
:=
int
(
math
.
Ceil
(
m
.
Total
/
m
.
Per_page
))
// IsMessage should require a Merge method
for
i
:=
2
;
i
<
pagecount
;
i
++
{
// TODO also figure out pointer stuff
// TODO this kind of works for dictionaries, since json.Unmarshal
// reuses an existing dictionary. I believe that it however
// "fails" if the same key is present in multiple responses, and
// that it doesn't work for list responses.
// TODO also, all these should run in paralell
fff
(
url
+
fmt
.
Sprintf
(
"?page=%d"
,
i
),
&
message
)
log
.
Printf
(
"message = %+v"
,
message
.
GetMessage
())
}
}
}
func
GetClassList
(
host
HostRecord
)
[]
string
{
func
GetClassList
(
host
HostRecord
)
[]
string
{
...
...
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