Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command line support for Active Slave sync #6

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/clients/nis_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ def main
),
"type" => "string"
},
"sync_slave" => {
# command line help text for the 'sync_slave' option
"help" => _(
"Sync to NIS Slave servers"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using the full word here (Synchronize ... or maybe Push)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Sound nice, I guess this should be ok.
"Synchronize Master Nis server to Slave Nis servers"

),
"type" => "enum",
"typespec" => ["yes", "no"]
},
"securenets" => {
# command line help text for the 'hosts' option
"help" => _(
Expand All @@ -150,7 +158,7 @@ def main
},
"mappings" => {
"summary" => [],
"master" => ["domain", "yppasswd", "ypdir", "maps", "securenets"],
"master" => ["domain", "yppasswd", "ypdir", "maps", "securenets", "sync_slave"],
"slave" => ["domain", "master_ip", "securenets"]
}
}
Expand Down Expand Up @@ -365,6 +373,10 @@ def NisServerMasterHandler(options)
if Ops.get_string(options, "yppasswd", "") != ""
NisServer.start_yppasswdd = Ops.get_string(options, "yppasswd", "") == "yes"
end

if Ops.get_string(options, "sync_slave", "") != ""
NisServer.nopush = Ops.get_string(options, "sync_slave", "") == "yes"
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use get_string here. Just options["sync_slave"]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, just Option["sysc_slave"] would be a slim version, But I guess the get_string just go with flow of the code very well. let me know, both seems to be nice.

if Options["sync_slave", ""] != ""
        NisServer.nopush = Options["sync_slave", ""] == "yes"
end

NisServer.maps = deep_copy(maps)
NisServer.securenets = deep_copy(securenets)
Expand Down
2 changes: 1 addition & 1 deletion src/include/nis_server/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def MasterDialog
Id(:have_slave),
# To translators: checkbox label
_("Active Slave NIS server &exists"),
!nopush
nopush
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? The comment about @nopush in NisServer.rb says "Don't push the changes to slave servers"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, By default it should not send any data to any server, unless specified by user, in this case it will not send, unless the option passed by the users..
or am I missing here ??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is not about the default value. The check box is checked for !nopush value, not for nopush. You can also see at the line https://github.com/ashish1099/yast-nis-server/blob/master/src/include/nis_server/master.rb#L242 that the checkbox reflects opposite value

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.
Ok, got the point, basically I was setting the value to "yes". Now the line should be. inturn it will set no, if not passed "yes". Let me know.

      if Ops.get_string(options, "sync_slave", "") != ""
       NisServer.nopush = Ops.get_string(options, "sync_slave", "") != "yes"
      end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jsuchome

Any update on this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but also the value at line 171.

)
),
VSpacing(0.5),
Expand Down