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
1636ecca
Commit
1636ecca
authored
4 years ago
by
Hugo Hörnquist
Browse files
Options
Downloads
Patches
Plain Diff
Classes.
parent
7369fe2f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dir/dir.go
+27
-0
27 additions, 0 deletions
dir/dir.go
fetch/fetch.go
+12
-1
12 additions, 1 deletion
fetch/fetch.go
link/link.go
+6
-0
6 additions, 0 deletions
link/link.go
with
45 additions
and
1 deletion
dir/dir.go
+
27
−
0
View file @
1636ecca
...
@@ -20,6 +20,8 @@ type HostList struct{}
...
@@ -20,6 +20,8 @@ type HostList struct{}
// list of all known puppet classes
// list of all known puppet classes
type
ClassList
struct
{}
type
ClassList
struct
{}
type
PuppetClass
struct
{
name
string
}
// directory for a single host (machine)
// directory for a single host (machine)
type
Host
struct
{
hostname
string
}
type
Host
struct
{
hostname
string
}
...
@@ -141,7 +143,32 @@ func (ClassList) Attr(ctx context.Context, a *fuse.Attr) error {
...
@@ -141,7 +143,32 @@ func (ClassList) Attr(ctx context.Context, a *fuse.Attr) error {
return
nil
return
nil
}
}
func
(
ClassList
)
Lookup
(
ctx
context
.
Context
,
name
string
)
(
fs
.
Node
,
error
)
{
for
key
,
_
:=
range
fetch
.
AllClasses
{
if
key
==
name
{
return
PuppetClass
{
name
},
nil
}
}
return
nil
,
syscall
.
ENOENT
}
func
(
ClassList
)
ReadDirAll
(
ctx
context
.
Context
)
([]
fuse
.
Dirent
,
error
)
{
var
dirents
[]
fuse
.
Dirent
for
key
,
_
:=
range
fetch
.
AllClasses
{
dirents
=
append
(
dirents
,
fuse
.
Dirent
{
Inode
:
0
,
Name
:
key
,
Type
:
fuse
.
DT_Dir
})
}
return
dirents
,
nil
}
// --------------------------------------------------
// --------------------------------------------------
func
(
PuppetClass
)
Attr
(
ctx
context
.
Context
,
a
*
fuse
.
Attr
)
error
{
a
.
Inode
=
0
a
.
Mode
=
os
.
ModeDir
|
0
o555
return
nil
}
// --------------------------------------------------
// --------------------------------------------------
// --------------------------------------------------
// --------------------------------------------------
// --------------------------------------------------
// --------------------------------------------------
This diff is collapsed.
Click to expand it.
fetch/fetch.go
+
12
−
1
View file @
1636ecca
...
@@ -16,7 +16,7 @@ const apiurl = "https://chapman.lysator.liu.se/api/"
...
@@ -16,7 +16,7 @@ const apiurl = "https://chapman.lysator.liu.se/api/"
// which classes a given host has
// which classes a given host has
var
hostClasses
map
[
float64
][]
Puppetclass
var
hostClasses
map
[
float64
][]
Puppetclass
var
AllClasses
map
[
string
]
[]
Puppetclass
var
AllClasses
map
[
string
]
Puppetclass
// password for foreman access, TODO replace with API key
// password for foreman access, TODO replace with API key
var
password
string
var
password
string
...
@@ -34,6 +34,7 @@ func Init(pw string) {
...
@@ -34,6 +34,7 @@ func Init(pw string) {
password
=
pw
password
=
pw
hostClasses
=
map
[
float64
][]
Puppetclass
{}
hostClasses
=
map
[
float64
][]
Puppetclass
{}
AllClasses
=
map
[
string
]
Puppetclass
{}
tr
:=
&
http
.
Transport
{
tr
:=
&
http
.
Transport
{
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
true
},
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
true
},
...
@@ -48,7 +49,17 @@ func Init(pw string) {
...
@@ -48,7 +49,17 @@ func Init(pw string) {
Hosts
[
record
.
Name
]
=
Host
{
record
}
Hosts
[
record
.
Name
]
=
Host
{
record
}
}
}
var
m2
PuppetclassMessage
fff
(
"puppetclasses"
,
&
m2
)
for
group
,
entries
:=
range
m2
.
Results
{
log
.
Print
(
"Handling "
,
group
)
for
_
,
entry
:=
range
entries
{
// e := entry.(map[string]interface{})
AllClasses
[
entry
.
Name
]
=
entry
}
}
}
}
func
fff
(
url
string
,
message
interface
{})
{
func
fff
(
url
string
,
message
interface
{})
{
...
...
This diff is collapsed.
Click to expand it.
link/link.go
+
6
−
0
View file @
1636ecca
...
@@ -13,3 +13,9 @@ func (PuppetClass) Attr(ctx context.Context, a *fuse.Attr) error {
...
@@ -13,3 +13,9 @@ func (PuppetClass) Attr(ctx context.Context, a *fuse.Attr) error {
a
.
Mode
=
os
.
ModeSymlink
|
0
o444
a
.
Mode
=
os
.
ModeSymlink
|
0
o444
return
nil
return
nil
}
}
func
(
c
PuppetClass
)
Readlink
(
ctx
context
.
Context
,
req
*
fuse
.
ReadlinkRequest
)
(
string
,
error
)
{
return
"../../../classes/"
+
c
.
Classname
,
nil
// return "[empty]", nil
}
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